Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarvarela committed Jun 5, 2024
1 parent 7f94c3d commit 3b5905c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions site/gatsby-site/playwright/e2e/cite.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ test.describe('Cite pages', () => {
await page.waitForSelector('h5:has-text("Is Starbucks shortchanging its baristas?")', { timeout: 8000 });
const incidentReportCard = await page.$('[data-cy="incident-report-card"]');
const boundingBox = await incidentReportCard.boundingBox();
expect(boundingBox.top).toBeCloseTo(0, 30);
expect(boundingBox.y).toBeLessThanOrEqual(20);
}).toPass();
},
{ retries: 4 }
Expand All @@ -103,7 +103,7 @@ test.describe('Cite pages', () => {
await expect(async () => {
const incidentReportCard = await page.$('[data-cy="incident-report-card"] h5:has-text("For some Starbucks workers, job leaves bitter taste")');
const boundingBox = await incidentReportCard!.boundingBox();
expect(boundingBox?.y).toBeCloseTo(17, 0);
expect(boundingBox?.y).toBeLessThanOrEqual(20);
}).toPass();
});

Expand Down
4 changes: 4 additions & 0 deletions site/gatsby-site/playwright/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ export async function login(page: Page, email: string, password: string, options
await loginSteps(page, email, password);
await page.context().storageState({ path: 'session.json' });
} else {

// to be able to restore session state, we'll need to refactor when we perform the login call, but that's for another PR
// https://playwright.dev/docs/auth#avoid-authentication-in-some-tests

await page.context().addCookies(sessionState.cookies);
}
}
Expand Down

0 comments on commit 3b5905c

Please sign in to comment.