diff --git a/frontend/e2e/pages/page.ts b/frontend/e2e/pages/page.ts index 49985505b..391b47de2 100644 --- a/frontend/e2e/pages/page.ts +++ b/frontend/e2e/pages/page.ts @@ -17,7 +17,10 @@ export class PTPage { public accountButton: Locator; public static naicsCodes: INaicsCode[] = []; public static employeeCountRanges: IEmployeeCountRange[] = []; - constructor(public readonly instance: Page, public user = undefined) {} + constructor( + public readonly instance: Page, + public user = undefined, + ) {} async setup() { this.accountButton = await this.instance.getByTestId( @@ -37,6 +40,7 @@ export class PTPage { const legalName = await this.instance.getByTestId('header-legal-name'); await expect(legalName).toBeVisible(); await expect(legalName).toContainText(user.legalName); + await this.accountButton.click(); } async logout() { diff --git a/frontend/e2e/pages/report.ts b/frontend/e2e/pages/report.ts index fce6bcf27..b26b61d31 100644 --- a/frontend/e2e/pages/report.ts +++ b/frontend/e2e/pages/report.ts @@ -22,12 +22,6 @@ export class BaseReportPage extends PTPage { this.backButton = ( await this.instance.getByRole('link', { name: 'Back' }) ).first(); - - await super.verifyUser(this.user); - } - - async verifyUser(user) { - await super.verifyUser(user); } async verifyEmployeerDetails(user, report) { @@ -80,16 +74,18 @@ export class DraftReportPage extends BaseReportPage { } async finalizedReport(reportId: string) { - const publishReportRequest = this.instance.waitForResponse(res => - res.url().includes('/api/v1/report') && res.request().method().toLowerCase() === 'put' - ) - const finalizeReportResponse = this.instance.waitForResponse((res) => - res.url().includes(`/api/v1/report/${reportId}`) && res.request().method().toLowerCase() === 'get', + const publishReportRequest = this.instance.waitForResponse( + (res) => + res.url().includes('/api/v1/report') && + res.request().method().toLowerCase() === 'put', ); - const getReportsRequest = this.instance.waitForResponse( + const finalizeReportResponse = this.instance.waitForResponse( (res) => - res.url().includes('reporting_year=') && - res.status() === 200, + res.url().includes(`/api/v1/report/${reportId}`) && + res.request().method().toLowerCase() === 'get', + ); + const getReportsRequest = this.instance.waitForResponse( + (res) => res.url().includes('reporting_year=') && res.status() === 200, ); await this.finalReportCheckBox.scrollIntoViewIfNeeded(); await this.finalReportCheckBox.click(); diff --git a/frontend/e2e/utils/edit-report.ts b/frontend/e2e/utils/edit-report.ts index a5b1515ce..9bfc9f3fa 100644 --- a/frontend/e2e/utils/edit-report.ts +++ b/frontend/e2e/utils/edit-report.ts @@ -37,6 +37,5 @@ export const editReport = async (page: Page) => { const publishedReportPage = new PublishedReportPage(page, user); await publishedReportPage.setup(); - await publishedReportPage.verifyUser(user); await publishedReportPage.verifyEmployeerDetails(user, report); };