Skip to content

Commit

Permalink
test: updated test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
tikazyq committed Nov 4, 2024
1 parent 10b1635 commit e7414be
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
19 changes: 18 additions & 1 deletion tests/project/projectList.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { test, expect } from '@playwright/test';
import { ProjectListPage } from '@/page-objects/views/project/projectListPage';
import { ProjectFormPage } from '@/page-objects/views/project/projectFormPage';
import { TAG_PRIORITY_HIGH, TAG_PRIORITY_MEDIUM } from '@/constants/priority';
import projectData from '@/fixtures/projectData.json';
import { CATEGORY_CREATE_DELETE_ROW, CATEGORY_FILTER_ROWS, CATEGORY_ROW_ACTIONS } from '@/constants/category';
Expand All @@ -14,6 +13,24 @@ test.beforeAll(async ({ browser }) => {
project = await projectListPage.createRowWithRandomName(projectData.single as Project);
});

test.afterAll(async ({ browser }) => {
test.slow();

// Open a new page
const page = await browser.newPage();

// Delete the project
const projectListPage = new ProjectListPage(page);
await projectListPage.navigate();
await projectListPage.searchRows(project.name);
if (await projectListPage.getTableRowCount() > 0) {
await projectListPage.deleteRow(0);
}

// Close the browser
await page.close();
});

test.describe('Project List Tests', () => {
let projectListPage: ProjectListPage;

Expand Down
10 changes: 4 additions & 6 deletions tests/spider/spiderList.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ let spider: Spider;
let project: Project;

test.beforeAll(async ({ browser }) => {
test.slow();

const page = await browser.newPage();

// Create a project to associate with the spider
Expand Down Expand Up @@ -41,20 +43,16 @@ test.afterAll(async ({ browser }) => {
const spiderListPage = new SpiderListPage(page);
await spiderListPage.navigate();
await spiderListPage.searchRows(spider.name);
await page.waitForTimeout(1000); // Wait for search results
if (await spiderListPage.getTableRowCount() > 0) {
await spiderListPage.deleteRow(0);
await page.waitForTimeout(1000); // Wait for deletion to process
}

// Delete the project
const projectListPage = new ProjectListPage(page);
await projectListPage.navigate();
await projectListPage.searchRows(project.name);
await page.waitForTimeout(1000); // Wait for search results
if (await projectListPage.getTableRowCount() > 0) {
await projectListPage.deleteRow(0);
await page.waitForTimeout(1000); // Wait for deletion to process
}

// Close the browser
Expand Down Expand Up @@ -207,7 +205,7 @@ test.describe('Spider List Tests', () => {
});

test.describe(CATEGORY_FILTER_ROWS, { tag: TAG_PRIORITY_MEDIUM }, () => {
test('should search for a spider', async ({ page }) => {
test('should search for a spider', async () => {
await spiderListPage.searchRows(spider.name);

// Verify the spider appears in the list
Expand All @@ -217,7 +215,7 @@ test.describe('Spider List Tests', () => {
expect(firstSpiderData.name).toContain(spider.name);
});

test('should filter spiders by project', async ({ page }) => {
test('should filter spiders by project', async () => {
await spiderListPage.filterByProject(spider.project);

// Verify the spiders are filtered by project
Expand Down

0 comments on commit e7414be

Please sign in to comment.