Skip to content

Commit fc21ddd

Browse files
committed
Add Playwright tests for Kotlin ecosystem buttons in footer.
1 parent 009ff27 commit fc21ddd

File tree

1 file changed

+140
-0
lines changed

1 file changed

+140
-0
lines changed
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
import { test, expect } from '@playwright/test';
2+
3+
test.describe('Footer kotlin ecosystem buttons', () => {
4+
test.beforeEach(async ({ page }) => {
5+
await page.goto('/');
6+
await page.waitForSelector('button.ch2-btn.ch2-btn-primary');
7+
await page.click('button.ch2-btn.ch2-btn-primary');
8+
await page.evaluate(() => {
9+
window.scrollTo(0, document.body.scrollHeight);
10+
});
11+
});
12+
13+
test('Contributing to Kotlin button should navigate to Contributing page', async ({ page }) => {
14+
const contributingButton = page.getByRole('link', { name: 'Contributing to Kotlin' });
15+
await expect(contributingButton).toBeVisible();
16+
await contributingButton.click();
17+
await expect(page.url()).toContain('/docs/contribute.html');
18+
});
19+
20+
test('Releases button should navigate to Releases page', async ({ page }) => {
21+
const releasesButton = page.getByRole('link', { name: 'Releases' });
22+
await expect(releasesButton).toBeVisible();
23+
await releasesButton.click();
24+
await expect(page.url()).toContain('/releases.html');
25+
});
26+
27+
// Without click on the button, but it checks that the button contains the right link. Playwright can't check the PDF.
28+
test('Press Kit button should navigate to Press Kit page', async ({ page }) => {
29+
const pressKitButton = page.getByRole('link', { name: 'Press Kit' });
30+
await expect(pressKitButton).toBeVisible();
31+
const href = await pressKitButton.getAttribute('href');
32+
expect(href).toBe('https://kotlinlang.org/assets/kotlin-media-kit.pdf');
33+
});
34+
35+
test('Security button should navigate to Security page', async ({ page }) => {
36+
const securityButton = page.getByRole('link', { name: 'Security' });
37+
await expect(securityButton).toBeVisible();
38+
await securityButton.click();
39+
await expect(page.url()).toContain('/security.html');
40+
});
41+
42+
test('Blog button should navigate to Kotlin Blog page', async ({ page, context }) => {
43+
const blogButton = page.getByRole('link', { name: 'Blog' }).last();
44+
await expect(blogButton).toBeVisible();
45+
const pagePromise = context.waitForEvent('page');
46+
await blogButton.click();
47+
const newPage = await pagePromise;
48+
await newPage.waitForLoadState();
49+
await expect(newPage.url()).toContain('https://blog.jetbrains.com/kotlin');
50+
});
51+
52+
test('Issue Tracker button should navigate to the YouTrack page', async ({ page, context }) => {
53+
const issueTrackerButton = page.getByRole('link', { name: 'Issue Tracker' });
54+
await expect(issueTrackerButton).toBeVisible();
55+
const newPagePromise = context.waitForEvent('page');
56+
await issueTrackerButton.click();
57+
const newPage = await newPagePromise;
58+
await newPage.waitForLoadState();
59+
await expect(newPage.url()).toContain('https://youtrack.jetbrains.com/issues/');
60+
});
61+
62+
test('Brand Assets button should navigate to Brand Assets page', async ({ page, context }) => {
63+
const brandAssetsButton = page.getByRole('link', { name: 'Brand Assets' });
64+
await expect(brandAssetsButton).toBeVisible();
65+
const newPagePromise = context.waitForEvent('page');
66+
await brandAssetsButton.click();
67+
const newPage = await newPagePromise;
68+
await newPage.waitForLoadState();
69+
await expect(newPage.url()).toContain('https://kotlinlang.org/docs/kotlin-brand-assets.html');
70+
});
71+
72+
test('Careers button should navigate to Careers page', async ({ page, context }) => {
73+
const careersButton = page.getByRole('link', { name: 'Careers' });
74+
await expect(careersButton).toBeVisible();
75+
const newPagePromise = context.waitForEvent('page');
76+
await careersButton.click();
77+
const newPage = await newPagePromise;
78+
await newPage.waitForLoadState();
79+
await expect(newPage.url()).toContain('jetbrains.com/careers');
80+
});
81+
82+
test('Kotlin Merch button should navigate to Kotlin Merch page', async ({ page, context }) => {
83+
const kotlinMerchButton = page.getByRole('link', { name: 'Kotlin Merch' });
84+
await expect(kotlinMerchButton).toBeVisible();
85+
const newPagePromise = context.waitForEvent('page');
86+
await kotlinMerchButton.click();
87+
const newPage = await newPagePromise;
88+
await newPage.waitForLoadState();
89+
await expect(newPage.url()).toContain('https://www.jetbrainsmerchandise.com/brand/kotlin.html');
90+
});
91+
92+
test('Opt-Out button should navigate to Opt-Out page', async ({ page }) => {
93+
const optOutButton = page.getByRole('link', { name: 'Opt-Out' });
94+
await expect(optOutButton).toBeVisible();
95+
await optOutButton.click();
96+
const cookieSettingsPopup = page.locator('#ch2-settings-dialog');
97+
await expect(cookieSettingsPopup).toBeVisible();
98+
await expect(cookieSettingsPopup).toContainText('Cookie Settings');
99+
});
100+
101+
// Click on the JetBrains logo button in footer.
102+
test('JetBrains logo button should navigate to JetBrains homepage', async ({ page, context }) => {
103+
const jetBrainsLink = page.getByRole('link', { name: 'JetBrains' }).nth(3);
104+
await expect(jetBrainsLink).toBeVisible();
105+
const newPagePromise = context.waitForEvent('page');
106+
await jetBrainsLink.click();
107+
const newPage = await newPagePromise;
108+
await newPage.waitForLoadState();
109+
await expect(newPage.url()).toContain('https://www.jetbrains.com/');
110+
});
111+
112+
// Click on the last JetBrains link on the page. It's here: "Supported and developed by JetBrains."
113+
test('JetBrains link should navigate to JetBrains homepage', async ({ page, context }) => {
114+
const jetBrainsLink = page.getByRole('link', { name: 'JetBrains' }).last();
115+
await expect(jetBrainsLink).toBeVisible();
116+
const newPagePromise = context.waitForEvent('page');
117+
await jetBrainsLink.click();
118+
const newPage = await newPagePromise;
119+
await newPage.waitForLoadState();
120+
await expect(newPage.url()).toContain('https://www.jetbrains.com/');
121+
});
122+
123+
test('Kotlin Foundation link should navigate to Kotlin Foundation homepage', async ({ page }) => {
124+
const kotlinFoundationLink = page.getByRole('link', { name: 'Kotlin Foundation' });
125+
await expect(kotlinFoundationLink).toBeVisible();
126+
await kotlinFoundationLink.click();
127+
await page.waitForLoadState();
128+
await expect(page.url()).toContain('https://kotlinfoundation.org/');
129+
});
130+
131+
test('Apache 2 license link should navigate to related page on GitHub', async ({ page, context }) => {
132+
const apacheLicenseLink = page.getByRole('link', { name: 'Apache 2 license' });
133+
await expect(apacheLicenseLink).toBeVisible();
134+
const newPagePromise = context.waitForEvent('page');
135+
await apacheLicenseLink.click();
136+
const newPage = await newPagePromise;
137+
await newPage.waitForLoadState();
138+
await expect(newPage.url()).toContain('https://github.com/JetBrains/kotlin-web-site/blob/master/LICENSE');
139+
});
140+
});

0 commit comments

Comments
 (0)