Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Playwright fix for windows #448

Merged
merged 1 commit into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion frontend/e2e/pages/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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() {
Expand Down
24 changes: 10 additions & 14 deletions frontend/e2e/pages/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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();
Expand Down
1 change: 0 additions & 1 deletion frontend/e2e/utils/edit-report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};