-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed unintentional removal of countryCode filter, handling an empty …
…("") initial countryCode filter
- Loading branch information
Showing
3 changed files
with
64 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { expect, Page, test } from "@playwright/test"; | ||
import { E2eTestManager } from "@shared/lib/e2e-test-manager"; | ||
import { User } from "@shared/entities/users/user.entity"; | ||
import {Country} from "@shared/entities/country.entity"; | ||
|
||
let testManager: E2eTestManager; | ||
let page: Page; | ||
|
||
test.describe.configure({ mode: "serial" }); | ||
|
||
test.describe("Projects - Overview Table", () => { | ||
test.beforeAll(async ({ browser }) => { | ||
page = await browser.newPage(); | ||
testManager = await E2eTestManager.load(page); | ||
await testManager.ingestCountries() | ||
}); | ||
|
||
test.afterAll(async () => { | ||
await testManager.clearDatabase(); | ||
await testManager.close(); | ||
}); | ||
|
||
test('I can filter Projects by Country', async () => { | ||
const china = await testManager.getDataSource().getRepository(Country).findOneOrFail({where: {name: 'China'}}); | ||
const india = await testManager.getDataSource().getRepository(Country).findOneOrFail({where: {name: 'India'}}); | ||
const chinaProject = await testManager.mocks().createProject({countryCode: china.code, projectName: 'China Mangrove Conservation Large'}); | ||
const indiaProject = await testManager.mocks().createProject({countryCode: india.code, projectName: 'India Mangrove Conservation Large'}); | ||
await page.goto('http://localhost:3000'); | ||
await page.getByRole('button', { name: 'Filters' }).click(); | ||
await page.locator('button').filter({ hasText: 'All countries' }).click(); | ||
await page.getByText('China', {exact: true }).click(); | ||
const projectsTable = page.locator('table tbody tr') | ||
const projectsInTable = await projectsTable.count(); | ||
expect(projectsInTable).toBe(1); | ||
const firstRowCells = await projectsTable.nth(0).locator('td').allTextContents(); | ||
expect(firstRowCells).toContain(chinaProject.projectName); | ||
|
||
}); | ||
}); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters