-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: geo 1176 for consistency we should be capitalizing field names t…
…hroughout the admin portal (#811)
- Loading branch information
Showing
11 changed files
with
84 additions
and
13 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,17 @@ | ||
import { test } from '@playwright/test'; | ||
|
||
import { EmployerSearchPage } from './pages/employer-search/employer-search-page'; | ||
import { PagePaths } from './utils'; | ||
|
||
test.describe('Employer Search', () => { | ||
let employerSearchPage: EmployerSearchPage; | ||
test.beforeEach(async ({ page }) => { | ||
await page.goto(PagePaths.EMPLOYERS); | ||
employerSearchPage = new EmployerSearchPage(page); | ||
await employerSearchPage.setup(); | ||
}); | ||
|
||
test('search employer by name', async () => { | ||
await employerSearchPage.searchEmployerByAndVerify(); | ||
}); | ||
}); |
50 changes: 50 additions & 0 deletions
50
admin-frontend/e2e/pages/employer-search/employer-search-page.ts
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,50 @@ | ||
import { expect, Locator } from 'playwright/test'; | ||
import { AdminPortalPage } from '../admin-portal-page'; | ||
|
||
export class EmployerSearchPage extends AdminPortalPage { | ||
searchInput: Locator; | ||
calendarYearInput: Locator; | ||
searchButton: Locator; | ||
resetButton: Locator; | ||
|
||
async setup(): Promise<void> { | ||
this.searchInput = await this.page.getByLabel('Search by employer name'); | ||
this.calendarYearInput = await this.page.getByLabel('Calendar Year(s)'); | ||
this.searchButton = await this.page.getByRole('button', { | ||
name: 'Search', | ||
}); | ||
this.resetButton = await this.page.getByRole('button', { | ||
name: 'Reset', | ||
}); | ||
|
||
await expect(this.searchInput).toBeVisible(); | ||
await expect(this.calendarYearInput).toBeVisible(); | ||
await expect(this.searchButton).toBeVisible(); | ||
await expect(this.resetButton).toBeVisible(); | ||
} | ||
|
||
async searchEmployerByAndVerify(): Promise<void> { | ||
await this.searchInput.fill(''); | ||
const waitForResults = this.waitForResultsToLoad(); | ||
await this.searchButton.click(); | ||
const response = await waitForResults; | ||
const { employers } = await response.json(); | ||
const table = await this.page.getByRole('table'); | ||
await expect(table).toBeVisible(); | ||
|
||
for (const employer of employers) { | ||
const employerName = await this.page.getByText(employer.company_name); | ||
const count = employers.filter((e) => e.company_name === employer.company_name).length; | ||
await expect(await employerName.count()).toBe(count); | ||
} | ||
} | ||
|
||
private waitForResultsToLoad() { | ||
return this.page.waitForResponse( | ||
(response) => | ||
response.url().includes('admin-api/v1/employers') && | ||
response.status() === 200 && | ||
response.request().method() === 'GET', | ||
); | ||
} | ||
} |
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
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
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
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