Skip to content

Commit a28d47e

Browse files
authored
Merge pull request #4939 from JetBrains/autotests_footer
Add Playwright tests for the footer buttons
2 parents 321c0c0 + fc21ddd commit a28d47e

File tree

2 files changed

+221
-0
lines changed

2 files changed

+221
-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+
});
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
import { test, expect } from '@playwright/test';
2+
3+
test.describe('Footer social media 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('GitHub button should navigate to Kotlin GitHub page', async ({ page, context }) => {
14+
const githubButton = page.getByRole('link', { name: 'Kotlin on GitHub' });
15+
await expect(githubButton).toBeVisible();
16+
const newPagePromise = context.waitForEvent('page');
17+
await githubButton.click();
18+
const newPage = await newPagePromise;
19+
await newPage.waitForLoadState();
20+
await expect(newPage.url()).toContain('github.com/JetBrains/kotlin');
21+
});
22+
23+
test('Twitter/X button should navigate to Kotlin Twitter page', async ({ page, context }) => {
24+
const twitterButton = page.getByRole('link', { name: 'Kotlin on Twitter' });
25+
await expect(twitterButton).toBeVisible();
26+
const newPagePromise = context.waitForEvent('page');
27+
await twitterButton.click();
28+
const newPage = await newPagePromise;
29+
await newPage.waitForLoadState()
30+
await expect(newPage.url()).toContain('https://x.com/kotlin');
31+
});
32+
33+
test('Bluesky button should navigate to Bluesky page', async ({ page, context }) => {
34+
const blueskyButton = page.getByRole('link', { name: 'Kotlin on Bluesky' });
35+
await expect(blueskyButton).toBeVisible();
36+
const newPagePromise = context.waitForEvent('page');
37+
await blueskyButton.click();
38+
const newPage = await newPagePromise;
39+
await newPage.waitForLoadState()
40+
await expect(newPage.url()).toContain('https://bsky.app/profile/kotlinlang.org');
41+
});
42+
43+
test('Slack button should navigate to Kotlin Slack Sign-up page', async ({ page, context }) => {
44+
const slackButton = page.getByRole('link', { name: 'Kotlin Slack' });
45+
await expect(slackButton).toBeVisible();
46+
const newPagePromise = context.waitForEvent('page');
47+
await slackButton.click();
48+
const newPage = await newPagePromise;
49+
await newPage.waitForLoadState()
50+
await expect(newPage.url()).toContain('https://surveys.jetbrains.com/s3/kotlin-slack-sign-up');
51+
});
52+
53+
test('Reddit button should navigate to Kotlin on Reddit', async ({ page, context }) => {
54+
const redditButton = page.getByRole('link', { name: 'Kotlin on Reddit' });
55+
await expect(redditButton).toBeVisible();
56+
const newPagePromise = context.waitForEvent('page');
57+
await redditButton.click();
58+
const newPage = await newPagePromise;
59+
await newPage.waitForLoadState()
60+
await expect(newPage.url()).toContain('https://www.reddit.com/r/Kotlin/');
61+
});
62+
63+
test('Stackoverflow button should navigate to Kotlin on Stackoverflow', async ({ page, context }) => {
64+
const stackoverflowButton = page.getByRole('link', { name: 'Kotlin on Stack Overflow' });
65+
await expect(stackoverflowButton).toBeVisible();
66+
const newPagePromise = context.waitForEvent('page');
67+
await stackoverflowButton.click();
68+
const newPage = await newPagePromise;
69+
await newPage.waitForLoadState()
70+
await expect(newPage.url()).toContain('https://stackoverflow.com/questions/tagged/kotlin');
71+
});
72+
73+
//Without click on YouTube button, because of YouTube Cookies page, but it checks that the button contains the right link.
74+
test('YouTube button should navigate to Kotlin on YouTube', async ({ page }) => {
75+
const youTubeButton = page.getByRole('link', { name: ' Kotlin on YouTube' });
76+
await expect(youTubeButton).toBeVisible();
77+
const href = await youTubeButton.getAttribute('href');
78+
expect(href).toBe('https://www.youtube.com/channel/UCP7uiEZIqci43m22KDl0sNw')
79+
80+
});
81+
});

0 commit comments

Comments
 (0)