Skip to content

Commit 83a721f

Browse files
committed
fix(e2e): refine footer Opt-Out button tests with production checks
- Add `isProduction` usage in `footer-kotlin-ecosystem-buttons.spec.ts` to conditionally verify Opt-Out popup only in production. - Fix imports formatting and adjust parameters for consistent test structure. - Correct indentation in test blocks for better readability.
1 parent c616284 commit 83a721f

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

test/production/footer-kotlin-ecosystem-buttons.spec.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { test, expect } from '@playwright/test';
1+
import { expect, test } from '@playwright/test';
2+
import { isProduction } from '../utils';
23

34
test.describe('Footer kotlin ecosystem buttons', () => {
45
test.beforeEach(async ({ page }) => {
@@ -28,7 +29,7 @@ test.describe('Footer kotlin ecosystem buttons', () => {
2829
await expect(pressKitButton).toBeVisible();
2930
const href = await pressKitButton.getAttribute('href');
3031
expect(href).toBe('https://kotlinlang.org/assets/kotlin-media-kit.pdf');
31-
});
32+
});
3233

3334
test('Security button should navigate to Security page', async ({ page }) => {
3435
const securityButton = page.getByTestId('footer').getByRole('link', { name: 'Security' });
@@ -87,13 +88,18 @@ test.describe('Footer kotlin ecosystem buttons', () => {
8788
await expect(newPage.url()).toContain('https://www.jetbrainsmerchandise.com/view-all.html?brand=32');
8889
});
8990

90-
test('Opt-Out button should navigate to Opt-Out page', async ({ page }) => {
91+
test('Opt-Out button should navigate to Opt-Out page', async ({ page, baseURL }) => {
9192
const optOutButton = page.getByTestId('footer').getByRole('link', { name: 'Opt-Out' });
9293
await expect(optOutButton).toBeVisible();
9394
await optOutButton.click();
94-
const cookieSettingsPopup = page.locator('#ch2-settings-dialog');
95-
await expect(cookieSettingsPopup).toBeVisible();
96-
await expect(cookieSettingsPopup).toContainText('Cookie Settings');
95+
96+
if (isProduction(baseURL)) {
97+
await test.step('check Opt-Out popup', async () => {
98+
const cookieSettingsPopup = page.locator('#ch2-settings-dialog');
99+
await expect(cookieSettingsPopup).toBeVisible();
100+
await expect(cookieSettingsPopup).toContainText('Cookie Settings');
101+
});
102+
}
97103
});
98104

99105
// Click on the JetBrains logo button in footer.

0 commit comments

Comments
 (0)