Skip to content

Commit a2e910a

Browse files
committed
Updates to fix flaky tests: carousel.spec.ts now samples multiple short animation-frame bursts with the new helper, footer.spec.ts switches to waitForPageLoad() + waitForURL('**/privacy'), so the assertion runs after Astro’s client-side navigation settles, internal privacy/consent links now honor trailingSlash: 'never', updated anchors in index.astro, GDPR checkbox defaults in index.astro, the confirmation copy in [token].astro, and the canonical path metadata in index.astro and index.astro, specs that relied on /privacy/ were aligned with the canonical slug (package-release.spec.ts, privacy-policy-version.spec.ts) so they no longer trigger the trailing-slash 404 banner.
1 parent 15cc855 commit a2e910a

9 files changed

Lines changed: 24 additions & 14 deletions

File tree

src/components/Consent/Checkbox/index.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ export type { ConsentCheckboxProps as Props } from './props'
1919
const {
2020
purpose,
2121
customText,
22-
privacyPolicyUrl = '/privacy/',
23-
cookiePolicyUrl = '/consent/',
22+
privacyPolicyUrl = '/privacy',
23+
cookiePolicyUrl = '/consent',
2424
name = 'consent',
2525
id = 'gdpr-consent',
2626
formId,

src/components/Footer/index.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,13 @@ const year = new Date().getFullYear()
110110
{/* Page footer Privacy Policy links */}
111111
<span class="flex flex-col justify-center lg:pt-3">
112112
<span>
113-
<a href="/consent/" class="text-text underline decoration-dotted decoration-text underline-offset-4 hover:text-secondary hover:decoration-secondary focus:text-secondary focus:decoration-secondary focus:outline-none">
113+
<a href="/consent" class="text-text underline decoration-dotted decoration-text underline-offset-4 hover:text-secondary hover:decoration-secondary focus:text-secondary focus:decoration-secondary focus:outline-none">
114114
<span class="lg:font-bold lg:uppercase">Consent</span>
115115
<span class="hidden lg:block text-text"> Manage your privacy preferences and data consent </span>
116116
</a>
117117
</span>
118118
<span>
119-
<a href="/privacy/" class="text-text underline decoration-dotted decoration-text underline-offset-4 hover:text-secondary hover:decoration-secondary focus:text-secondary focus:decoration-secondary focus:outline-none">
119+
<a href="/privacy" class="text-text underline decoration-dotted decoration-text underline-offset-4 hover:text-secondary hover:decoration-secondary focus:text-secondary focus:decoration-secondary focus:outline-none">
120120
<span class="lg:font-bold lg:uppercase">Privacy Policy</span>
121121
<span class="hidden lg:block text-text"> Learn what data we collect and how we use it </span>
122122
</a>

src/pages/consent/index.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import BaseLayout from '@layouts/BaseLayout.astro'
33
import ConsentPreferences from '@components/Consent/Preferences/index.astro'
44
55
const pageTitle = 'Consent Policy'
6-
const path = '/consent/'
6+
const path = '/consent'
77
---
88

99
<BaseLayout pageTitle={pageTitle} path={path}>

src/pages/newsletter/confirm/[token].astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const subtitle = 'Please wait while we confirm your subscription'
5959
<p class="font-semibold mb-2">Your Rights:</p>
6060
<p>
6161
You can unsubscribe at any time using the link in any email we send.
62-
See our <a href="/privacy/" class="text-accent hover:underline">Privacy Policy</a>
62+
See our <a href="/privacy" class="text-accent hover:underline">Privacy Policy</a>
6363
for details about how we handle your data.
6464
</p>
6565
</div>

src/pages/privacy/index.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import BaseLayout from '@layouts/BaseLayout.astro'
33
import contactData from '@content/contact.json'
44
55
const pageTitle = 'Privacy Policy'
6-
const path = '/privacy/'
6+
const path = '/privacy'
77
---
88

99
<BaseLayout pageTitle={pageTitle} path={path}>

test/e2e/specs/04-components/carousel.spec.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,18 @@ async function invokeCarouselControl(page: BasePage, action: 'pause' | 'resume')
5555
}, action)
5656
}
5757

58+
/**
59+
* Verify the carousel does not advance by sampling several short animation chunks
60+
*/
61+
async function expectCarouselRemainsOnSlide(page: BasePage, expectedIndex: number, checks = 6, framesPerCheck = 8): Promise<void> {
62+
for (let iteration = 0; iteration < checks; iteration++) {
63+
await waitForAnimationFrames(page.page, framesPerCheck)
64+
const currentIndex = await getActiveDotIndex(page)
65+
assertIndex(currentIndex)
66+
expect(currentIndex).toBe(expectedIndex)
67+
}
68+
}
69+
5870
function assertIndex(value: number | null): asserts value is number {
5971
if (value === null) {
6072
throw new EvaluationError('Carousel did not report an active pagination dot')
@@ -131,10 +143,7 @@ test.describe('Carousel Component', () => {
131143

132144
const pausedIndex = await getActiveDotIndex(page)
133145
assertIndex(pausedIndex)
134-
for (let iteration = 0; iteration < 3; iteration++) {
135-
await waitForAnimationFrames(page.page, 90)
136-
expect(await getActiveDotIndex(page)).toBe(pausedIndex)
137-
}
146+
await expectCarouselRemainsOnSlide(page, pausedIndex)
138147

139148
await invokeCarouselControl(page, 'resume')
140149
await expect(slider).toHaveAttribute('data-carousel-autoplay', 'playing')

test/e2e/specs/04-components/footer.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ test.describe('Footer Component', () => {
5959

6060
// Test privacy link navigation
6161
await page.click('footer[role="contentinfo"] a[href*="/privacy"]')
62-
await page.waitForLoadState('networkidle')
62+
await page.waitForPageLoad()
63+
await page.waitForURL('**/privacy')
6364
await page.expectUrlContains('/privacy')
6465
})
6566

test/e2e/specs/14-system/package-release.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ test.describe('Package Release Integration', () => {
7474
})
7575

7676
// Get release from privacy page
77-
await page.goto('/privacy/')
77+
await page.goto('/privacy')
7878
await page.waitForLoadState('networkidle')
7979

8080
const releaseFromPrivacy = await page.page.evaluate(async () => {

test/e2e/specs/14-system/privacy-policy-version.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ test.describe('Privacy Policy Version Integration', () => {
7272
})
7373

7474
// Get version from privacy page
75-
await page.goto('/privacy/')
75+
await page.goto('/privacy')
7676
await page.waitForLoadState('networkidle')
7777

7878
const versionFromPrivacy = await page.page.evaluate(async () => {

0 commit comments

Comments
 (0)