-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix production e2e tests: block ads in Playwright (#138)
* chore: block ads in Playwright * review fix: explain this better * review fix: also do this for playground * chore: block gtm in all tests * chore: fix typo
- Loading branch information
Showing
14 changed files
with
94 additions
and
53 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import { resetScenarios } from './e2eTestUtils'; | ||
import { assertAlert, blockGoogleTagManager, resetScenarios } from './e2eTestUtils'; | ||
import { TEST_IDS } from '../src/client/testIDs'; | ||
import { PAYWALL_COPY } from '../src/server/paywall/paywallCopy'; | ||
|
||
test.describe('Paywall', () => { | ||
test.beforeEach(async ({ page }) => { | ||
await page.goto('/paywall'); | ||
await resetScenarios(page); | ||
}); | ||
test.beforeEach(async ({ page }) => { | ||
await blockGoogleTagManager(page); | ||
await page.goto('/paywall'); | ||
await resetScenarios(page); | ||
}); | ||
|
||
test.describe('Paywall', () => { | ||
test('Should show two articles, then show a paywall', async ({ page }) => { | ||
const articles = await page.getByTestId(TEST_IDS.paywall.articleCard); | ||
|
||
await articles.first().click(); | ||
await page.getByText(PAYWALL_COPY.nArticlesRemaining(1)).waitFor(); | ||
await assertAlert({ page, text: PAYWALL_COPY.nArticlesRemaining(1), severity: 'warning' }); | ||
await expect(page.getByTestId(TEST_IDS.paywall.articleContent)).toBeVisible(); | ||
await page.goBack(); | ||
|
||
await articles.nth(1).click(); | ||
await page.getByText(PAYWALL_COPY.lastArticle).waitFor(); | ||
await assertAlert({ page, text: PAYWALL_COPY.lastArticle, severity: 'warning' }); | ||
await expect(page.getByTestId(TEST_IDS.paywall.articleContent)).toBeVisible(); | ||
await page.goBack(); | ||
|
||
await articles.nth(2).click(); | ||
|
||
await page.getByText(PAYWALL_COPY.limitReached).waitFor(); | ||
await assertAlert({ page, text: PAYWALL_COPY.limitReached, severity: 'error' }); | ||
await expect(page.getByTestId(TEST_IDS.paywall.articleContent)).toBeHidden(); | ||
}); | ||
}); |
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