Skip to content

Commit

Permalink
chore: remove waiting for network idle
Browse files Browse the repository at this point in the history
  • Loading branch information
JuroUhlar committed Feb 29, 2024
1 parent 72b1e50 commit 6886ac9
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/production_e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ on:
schedule:
- cron: '0 * * * *' # Run every hour
workflow_dispatch:
pull_request:
branches: [main]
env:
# Playwright headless browsers running in CI get low confidence scores, causing flaky e2e tests. Lower the confidence score threshold for CI testing.
MIN_CONFIDENCE_SCORE: 0
Expand Down
4 changes: 1 addition & 3 deletions e2e/personalization.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ const PERS_ID = TEST_IDS.personalization;

test.describe('Personalization', () => {
test.beforeEach(async ({ page }) => {
await page.goto('/personalization', {
waitUntil: 'networkidle',
});
await page.goto('/personalization');
await page.getByText('Okay, I understand').click();
await resetScenarios(page);
});
Expand Down
2 changes: 0 additions & 2 deletions e2e/playground.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const getServerResponse = async (page: Page) => {

const clickPlaygroundRefreshButton = async (page: Page) => {
await page.getByTestId(PLAYGROUND_TAG.refreshButton).first().click();
await page.waitForLoadState('networkidle');
// Artificial wait necessary to make sure you get the updated response every time
await page.waitForTimeout(3000);
};
Expand Down Expand Up @@ -103,6 +102,5 @@ test.describe('Proxy integration', () => {

await page.goto('/playground');
await clickPlaygroundRefreshButton(page);
await page.waitForLoadState('networkidle');
});
});
1 change: 0 additions & 1 deletion e2e/resetHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ import { TEST_IDS } from '../src/client/testIDs';
// Assumes you already are on a use case page with the Reset button present
export async function resetScenarios(page: Page) {
await page.getByTestId(TEST_IDS.reset.resetButton).click();
await page.waitForLoadState('networkidle');
await page.getByTestId(TEST_IDS.reset.resetSuccess).waitFor({ timeout: 10000 });
}
2 changes: 1 addition & 1 deletion e2e/scraping/protected.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { TEST_IDS } from '../../src/client/testIDs';

test.describe('Scraping flights', () => {
test('is not possible with Bot detection on', async ({ page }) => {
await page.goto('/web-scraping', { waitUntil: 'networkidle' });
await page.goto('/web-scraping');
await expect(page.getByTestId(TEST_IDS.common.alert)).toContainText('Malicious bot detected', {

Check failure on line 7 in e2e/scraping/protected.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright e2e tests (2, 3)

[firefox] › scraping/protected.spec.ts:5:7 › Scraping flights › is not possible with Bot detection on

1) [firefox] › scraping/protected.spec.ts:5:7 › Scraping flights › is not possible with Bot detection on Error: Timed out 10000ms waiting for expect(locator).toContainText(expected) Locator: getByTestId('alert') Expected string: "Malicious bot detected" Received string: "" Call log: - expect.toContainText with timeout 10000ms - waiting for getByTestId('alert') 5 | test('is not possible with Bot detection on', async ({ page }) => { 6 | await page.goto('/web-scraping'); > 7 | await expect(page.getByTestId(TEST_IDS.common.alert)).toContainText('Malicious bot detected', { | ^ 8 | timeout: 10000, 9 | }); 10 | }); at /home/runner/work/fingerprintjs-pro-use-cases/fingerprintjs-pro-use-cases/e2e/scraping/protected.spec.ts:7:59

Check failure on line 7 in e2e/scraping/protected.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright e2e tests (2, 3)

[firefox] › scraping/protected.spec.ts:5:7 › Scraping flights › is not possible with Bot detection on

1) [firefox] › scraping/protected.spec.ts:5:7 › Scraping flights › is not possible with Bot detection on Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: Timed out 10000ms waiting for expect(locator).toContainText(expected) Locator: getByTestId('alert') Expected string: "Malicious bot detected" Received string: "" Call log: - expect.toContainText with timeout 10000ms - waiting for getByTestId('alert') 5 | test('is not possible with Bot detection on', async ({ page }) => { 6 | await page.goto('/web-scraping'); > 7 | await expect(page.getByTestId(TEST_IDS.common.alert)).toContainText('Malicious bot detected', { | ^ 8 | timeout: 10000, 9 | }); 10 | }); at /home/runner/work/fingerprintjs-pro-use-cases/fingerprintjs-pro-use-cases/e2e/scraping/protected.spec.ts:7:59

Check failure on line 7 in e2e/scraping/protected.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright e2e tests (2, 3)

[firefox] › scraping/protected.spec.ts:5:7 › Scraping flights › is not possible with Bot detection on

1) [firefox] › scraping/protected.spec.ts:5:7 › Scraping flights › is not possible with Bot detection on Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: Timed out 10000ms waiting for expect(locator).toContainText(expected) Locator: getByTestId('alert') Expected string: "Malicious bot detected" Received string: "" Call log: - expect.toContainText with timeout 10000ms - waiting for getByTestId('alert') 5 | test('is not possible with Bot detection on', async ({ page }) => { 6 | await page.goto('/web-scraping'); > 7 | await expect(page.getByTestId(TEST_IDS.common.alert)).toContainText('Malicious bot detected', { | ^ 8 | timeout: 10000, 9 | }); 10 | }); at /home/runner/work/fingerprintjs-pro-use-cases/fingerprintjs-pro-use-cases/e2e/scraping/protected.spec.ts:7:59
timeout: 10000,
});
Expand Down
2 changes: 1 addition & 1 deletion e2e/scraping/unprotected.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const scrapeText = async (parent: Locator, testId: string) => {

test.describe('Scraping flights', () => {
test('is possible with Bot detection off', async ({ page }) => {
await page.goto('/web-scraping?disableBotDetection=1', { waitUntil: 'networkidle' });
await page.goto('/web-scraping?disableBotDetection=1');
// Artificial wait necessary to prevent flakiness
await page.waitForTimeout(3000);

Expand Down

0 comments on commit 6886ac9

Please sign in to comment.