diff --git a/e2e/web/tests/actPage.spec.ts b/e2e/web/tests/actPage.spec.ts index d178efa9b6f125f52aec27b2244f6172102ff6c8..21aada4cd3325300878e6e75652eca59c1fee65b 100644 --- a/e2e/web/tests/actPage.spec.ts +++ b/e2e/web/tests/actPage.spec.ts @@ -1,21 +1,12 @@ import { type Page, expect } from '@playwright/test' -import { - byTestId, - clickElementByTestId, - denyConsent, - donationsRequestTimeout, - volunteeringRequestTimeout, - withSSR, -} from './helpers' +import { byTestId, clickElementByTestId, donationsRequestTimeout, volunteeringRequestTimeout, withSSR } from './helpers' import { test } from './testmaster' test.describe('@ActPage', () => { test('user journey', async ({ page, browser }) => { await page.goto('/act') - await denyConsent(page) - await testActPageContent(page) await withSSR(browser, page.url(), testActPageContent) diff --git a/e2e/web/tests/helpers.ts b/e2e/web/tests/helpers.ts index 480e3ba48824b167a9a3b2456ee8a22bb8269221..e00c536faf4adfa9c0835e02caccb3ec676afb47 100644 --- a/e2e/web/tests/helpers.ts +++ b/e2e/web/tests/helpers.ts @@ -46,25 +46,12 @@ export const clickButtonByText = async (page: Page, buttonText: string): Promise await page.click(`button:has-text("${buttonText}")`) } -export const dismissConsentDialog = (page: Page) => page.getByRole('button', { name: 'Decline all' }).click() - -export const denyConsent = async (page: Page) => { - // Store the denial in local storage - await page.evaluate(() => { - localStorage.setItem('HOLI_TRACKING_CONSENT', '{"ANALYTICS":"denied","PERSONALIZATION":"denied"}') - }) - // Now reload the page - the consent logic will read what's in local storage and not show the dialog - await page.reload() -} - const prepareForLoginOrRegistration = async (context: BrowserContext, page: Page) => { await context.clearCookies() //Introduced exception handling if first attempt to hit the server does not succeed await gotoWithRetries(page, '/profile') - - await denyConsent(page) } export const login = async (context: BrowserContext, page: Page, email: string, password: string): Promise<void> => { @@ -129,16 +116,22 @@ const fillOutOnboarding = async (page: Page, userData: OnboardingUserData) => { await clickElementByTestId(page, userData.content) } await clickElementByTestId(page, 'onboarding-stepper-nav-buttons-next-btn') - // Handle location selection - await page.waitForSelector(byTestId('onboarding-location-selection')) - if (userData.location) { - const locationInput = await locateElementByTestId(page, 'onboarding-location-selection-autocomplete-input') - await locationInput.fill(userData.location.label) - const locationOption = `onboarding-location-selection-autocomplete-item-${userData.location.id}` - await page.waitForSelector(byTestId(locationOption)) - await clickElementByTestId(page, locationOption) + + if (isRunningLocally()) { + await page.getByRole('button', { name: 'Skip' }).click() + } else { + // Handle location selection + await page.waitForSelector(byTestId('onboarding-location-selection')) + if (userData.location) { + const locationInput = await locateElementByTestId(page, 'onboarding-location-selection-autocomplete-input') + await locationInput.fill(userData.location.label) + const locationOption = `onboarding-location-selection-autocomplete-item-${userData.location.id}` + await page.waitForSelector(byTestId(locationOption)) + await clickElementByTestId(page, locationOption) + } + await clickElementByTestId(page, 'onboarding-stepper-nav-buttons-next-btn') } - await clickElementByTestId(page, 'onboarding-stepper-nav-buttons-next-btn') + // Handle interests selection await page.waitForSelector(byTestId('onboarding-interests-selection')) for (const slug of userData.interests) { @@ -223,8 +216,6 @@ export const proceedAsGuest = async (page: Page): Promise<void> => { //Introduced exception handling if first attempt to hit the server does not succeed await gotoWithRetries(page, '/') - await denyConsent(page) - await skipOnboardingInitialSteps(page) await clickElementByTestId(page, 'onboarding-account-creation-btn-continue-as-guest') @@ -389,7 +380,7 @@ export const retry = async (expectationFn: () => Promise<void>) => { await expectationFn() }).toPass({ intervals: [3_000], - timeout: 20_000, + timeout: 30_000, }) } diff --git a/e2e/web/tests/needs-staging-test-data/donations.spec.ts b/e2e/web/tests/needs-staging-test-data/donations.spec.ts index 43199901c63f64ab6bc946bdda155b978d67b3cf..a45496c7e621716a00bb7b01db90d2ea394e2a43 100644 --- a/e2e/web/tests/needs-staging-test-data/donations.spec.ts +++ b/e2e/web/tests/needs-staging-test-data/donations.spec.ts @@ -7,7 +7,6 @@ import { checkAccessibility, clickElementByTestId, clickFirstElement, - denyConsent, donationsRequestTimeout, isRunningLocally, locateElementByTestId, @@ -20,7 +19,6 @@ test.describe('@Donations', () => { test.skip(isRunningLocally(), 'These features have no local test data and can only be tested on staging.') // prepare await page.goto('/donations') - await denyConsent(page) await testProjectListAndPagination(page) await withSSR(browser, page.url(), testDisplaysProjectList) diff --git a/e2e/web/tests/needs-staging-test-data/goodnews.spec.ts b/e2e/web/tests/needs-staging-test-data/goodnews.spec.ts index 1e5f52db24fe0cf5aad91e9d3005e0770236e50e..2da95cd956ac6c636ff6ed2cc9ad2419123b81d2 100644 --- a/e2e/web/tests/needs-staging-test-data/goodnews.spec.ts +++ b/e2e/web/tests/needs-staging-test-data/goodnews.spec.ts @@ -1,6 +1,6 @@ import { expect } from '@playwright/test' -import { byTestId, checkAccessibility, denyConsent, isRunningLocally } from '../helpers' +import { byTestId, checkAccessibility, isRunningLocally } from '../helpers' import { test } from '../testmaster' test.describe('@GoodNews', () => { @@ -8,7 +8,6 @@ test.describe('@GoodNews', () => { test.skip(isRunningLocally(), 'These features have no local test data and can only be tested on staging.') await page.goto('/apps/goodnews') - await denyConsent(page) const firstArticle = page.locator(byTestId('goodnews-detailview-container')).first() diff --git a/e2e/web/tests/needs-staging-test-data/volunteering.spec.ts b/e2e/web/tests/needs-staging-test-data/volunteering.spec.ts index 2bcc2032d75d1fee3915ea6ecee4c4a4583cd39c..09c871f9d2a5e093392438a23b94945c15f9641b 100644 --- a/e2e/web/tests/needs-staging-test-data/volunteering.spec.ts +++ b/e2e/web/tests/needs-staging-test-data/volunteering.spec.ts @@ -5,7 +5,6 @@ import { checkAccessibility, clickElementByTestId, clickFirstElement, - denyConsent, isRunningLocally, locateElementByTestId, volunteeringRequestTimeout, @@ -19,7 +18,6 @@ test.describe('@Volunteering', () => { //prepare await page.goto('/volunteering') - await denyConsent(page) await testAllowsPagination(page) await withSSR(browser, page.url(), testDisplaysList) diff --git a/e2e/web/tests/search.spec.ts b/e2e/web/tests/search.spec.ts index 10be0c2390229dee98793cdad443b7f8a49259cd..d3c2c57379d609dfc8958cc81e8855188303f23d 100644 --- a/e2e/web/tests/search.spec.ts +++ b/e2e/web/tests/search.spec.ts @@ -1,12 +1,10 @@ -import { byTestId, checkAccessibility, clickElementByTestId, denyConsent, locateElementByTestId } from './helpers' +import { byTestId, checkAccessibility, clickElementByTestId, locateElementByTestId } from './helpers' import { test } from './testmaster' test.describe('@Search', () => { test('user journey', async ({ page }) => { await page.goto('/search') - await denyConsent(page) - const oldSearch = await locateElementByTestId(page, 'search-content') const oldSearchVisible = await oldSearch.isVisible() if (oldSearchVisible) { diff --git a/e2e/web/tests/testmaster.ts b/e2e/web/tests/testmaster.ts index 74bcc6d1d173e2ba6c424a33fd4ef6ef808859dd..7ff59234028dbbc7bbab5ff36905d2f61d02fb07 100644 --- a/e2e/web/tests/testmaster.ts +++ b/e2e/web/tests/testmaster.ts @@ -1,7 +1,6 @@ import { type Browser, type BrowserContext, type Page, test as baseTest } from '@playwright/test' import { OnboardingUserData } from '@holi/core/screens/onboarding/types' -import { gotoWithRetries } from './helpers' import { withRandomUserSession } from './helpers' import { E2ETestSpaceResponse, @@ -69,21 +68,7 @@ export class SessionHandler { this.signInContexts.push(context) const newPage = await context.newPage() - //Introduced exception handling if first attempt to hit the server does not succeed - try { - // First attempt to navigate normally - await newPage.goto('/') - } catch (error) { - if (error instanceof Error) { - console.error(`Initial navigation to '/' failed: ${error.message}`) // eslint-disable-line no-console - } else { - console.error("Initial navigation to '/' failed with an unknown error.") // eslint-disable-line no-console - } - - // If the initial attempt fails, fall back to retry logic - await gotoWithRetries(newPage, '/') - } - //await denyConsent(newPage) + await newPage.goto('/') return { user,