Skip to content

Commit 0c193e1

Browse files
authored
Merge branch 'master' into tests-for-api-button
2 parents 201790c + 9756df0 commit 0c193e1

File tree

3 files changed

+24
-22
lines changed

3 files changed

+24
-22
lines changed

pages/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,9 @@ function Index() {
252252
</ThemeProvider>
253253

254254
<ThemeProvider theme={'dark'}>
255-
<GlobalFooter />
255+
<div data-testid={'footer'}>
256+
<GlobalFooter />
257+
</div>
256258
</ThemeProvider>
257259

258260
<Script src={'https://cdn.optimizely.com/js/26633200186.js'} strategy={"beforeInteractive"}/>

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,36 +11,36 @@ test.describe('Footer kotlin ecosystem buttons', () => {
1111
});
1212

1313
test('Contributing to Kotlin button should navigate to Contributing page', async ({ page }) => {
14-
const contributingButton = page.getByRole('link', { name: 'Contributing to Kotlin' });
14+
const contributingButton = page.getByTestId('footer').getByRole('link', { name: 'Contributing to Kotlin' });
1515
await expect(contributingButton).toBeVisible();
1616
await contributingButton.click();
1717
await expect(page.url()).toContain('/docs/contribute.html');
1818
});
1919

2020
test('Releases button should navigate to Releases page', async ({ page }) => {
21-
const releasesButton = page.getByRole('link', { name: 'Releases' });
21+
const releasesButton = page.getByTestId('footer').getByRole('link', { name: 'Releases' });
2222
await expect(releasesButton).toBeVisible();
2323
await releasesButton.click();
2424
await expect(page.url()).toContain('/releases.html');
2525
});
2626

2727
// Without click on the button, but it checks that the button contains the right link. Playwright can't check the PDF.
2828
test('Press Kit button should navigate to Press Kit page', async ({ page }) => {
29-
const pressKitButton = page.getByRole('link', { name: 'Press Kit' });
29+
const pressKitButton = page.getByTestId('footer').getByRole('link', { name: 'Press Kit' });
3030
await expect(pressKitButton).toBeVisible();
3131
const href = await pressKitButton.getAttribute('href');
3232
expect(href).toBe('https://kotlinlang.org/assets/kotlin-media-kit.pdf');
3333
});
3434

3535
test('Security button should navigate to Security page', async ({ page }) => {
36-
const securityButton = page.getByRole('link', { name: 'Security' });
36+
const securityButton = page.getByTestId('footer').getByRole('link', { name: 'Security' });
3737
await expect(securityButton).toBeVisible();
3838
await securityButton.click();
3939
await expect(page.url()).toContain('/security.html');
4040
});
4141

4242
test('Blog button should navigate to Kotlin Blog page', async ({ page, context }) => {
43-
const blogButton = page.getByRole('link', { name: 'Blog' }).last();
43+
const blogButton = page.getByTestId('footer').getByRole('link', { name: 'Blog' });
4444
await expect(blogButton).toBeVisible();
4545
const pagePromise = context.waitForEvent('page');
4646
await blogButton.click();
@@ -50,7 +50,7 @@ test.describe('Footer kotlin ecosystem buttons', () => {
5050
});
5151

5252
test('Issue Tracker button should navigate to the YouTrack page', async ({ page, context }) => {
53-
const issueTrackerButton = page.getByRole('link', { name: 'Issue Tracker' });
53+
const issueTrackerButton = page.getByTestId('footer').getByRole('link', { name: 'Issue Tracker' });
5454
await expect(issueTrackerButton).toBeVisible();
5555
const newPagePromise = context.waitForEvent('page');
5656
await issueTrackerButton.click();
@@ -60,7 +60,7 @@ test.describe('Footer kotlin ecosystem buttons', () => {
6060
});
6161

6262
test('Brand Assets button should navigate to Brand Assets page', async ({ page, context }) => {
63-
const brandAssetsButton = page.getByRole('link', { name: 'Brand Assets' });
63+
const brandAssetsButton = page.getByTestId('footer').getByRole('link', { name: 'Brand Assets' });
6464
await expect(brandAssetsButton).toBeVisible();
6565
const newPagePromise = context.waitForEvent('page');
6666
await brandAssetsButton.click();
@@ -70,7 +70,7 @@ test.describe('Footer kotlin ecosystem buttons', () => {
7070
});
7171

7272
test('Careers button should navigate to Careers page', async ({ page, context }) => {
73-
const careersButton = page.getByRole('link', { name: 'Careers' });
73+
const careersButton = page.getByTestId('footer').getByRole('link', { name: 'Careers' });
7474
await expect(careersButton).toBeVisible();
7575
const newPagePromise = context.waitForEvent('page');
7676
await careersButton.click();
@@ -80,7 +80,7 @@ test.describe('Footer kotlin ecosystem buttons', () => {
8080
});
8181

8282
test('Kotlin Merch button should navigate to Kotlin Merch page', async ({ page, context }) => {
83-
const kotlinMerchButton = page.getByRole('link', { name: 'Kotlin Merch' });
83+
const kotlinMerchButton = page.getByTestId('footer').getByRole('link', { name: 'Kotlin Merch' });
8484
await expect(kotlinMerchButton).toBeVisible();
8585
const newPagePromise = context.waitForEvent('page');
8686
await kotlinMerchButton.click();
@@ -90,7 +90,7 @@ test.describe('Footer kotlin ecosystem buttons', () => {
9090
});
9191

9292
test('Opt-Out button should navigate to Opt-Out page', async ({ page }) => {
93-
const optOutButton = page.getByRole('link', { name: 'Opt-Out' });
93+
const optOutButton = page.getByTestId('footer').getByRole('link', { name: 'Opt-Out' });
9494
await expect(optOutButton).toBeVisible();
9595
await optOutButton.click();
9696
const cookieSettingsPopup = page.locator('#ch2-settings-dialog');
@@ -100,7 +100,7 @@ test.describe('Footer kotlin ecosystem buttons', () => {
100100

101101
// Click on the JetBrains logo button in footer.
102102
test('JetBrains logo button should navigate to JetBrains homepage', async ({ page, context }) => {
103-
const jetBrainsLink = page.getByRole('link', { name: 'JetBrains' }).nth(3);
103+
const jetBrainsLink = page.getByTestId('footer').getByRole('link', { name: 'jetbrains.com link' });
104104
await expect(jetBrainsLink).toBeVisible();
105105
const newPagePromise = context.waitForEvent('page');
106106
await jetBrainsLink.click();
@@ -111,7 +111,7 @@ test.describe('Footer kotlin ecosystem buttons', () => {
111111

112112
// Click on the last JetBrains link on the page. It's here: "Supported and developed by JetBrains."
113113
test('JetBrains link should navigate to JetBrains homepage', async ({ page, context }) => {
114-
const jetBrainsLink = page.getByRole('link', { name: 'JetBrains' }).last();
114+
const jetBrainsLink = page.getByTestId('footer').getByRole('link', { name: 'JetBrains' }).last();
115115
await expect(jetBrainsLink).toBeVisible();
116116
const newPagePromise = context.waitForEvent('page');
117117
await jetBrainsLink.click();
@@ -121,15 +121,15 @@ test.describe('Footer kotlin ecosystem buttons', () => {
121121
});
122122

123123
test('Kotlin Foundation link should navigate to Kotlin Foundation homepage', async ({ page }) => {
124-
const kotlinFoundationLink = page.getByRole('link', { name: 'Kotlin Foundation' }).last();
124+
const kotlinFoundationLink = page.getByTestId('footer').getByRole('link', { name: 'Kotlin Foundation' });
125125
await expect(kotlinFoundationLink).toBeVisible();
126126
await kotlinFoundationLink.click();
127127
await page.waitForLoadState();
128128
await expect(page.url()).toContain('https://kotlinfoundation.org/');
129129
});
130130

131131
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' });
132+
const apacheLicenseLink = page.getByTestId('footer').getByRole('link', { name: 'Apache 2 license' });
133133
await expect(apacheLicenseLink).toBeVisible();
134134
const newPagePromise = context.waitForEvent('page');
135135
await apacheLicenseLink.click();

test/production/footer-social-media-buttons.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ test.describe('Footer social media buttons', () => {
1111
});
1212

1313
test('GitHub button should navigate to Kotlin GitHub page', async ({ page, context }) => {
14-
const githubButton = page.getByRole('link', { name: 'Kotlin on GitHub' });
14+
const githubButton = page.getByTestId('footer').getByRole('link', { name: 'Kotlin on GitHub' });
1515
await expect(githubButton).toBeVisible();
1616
const newPagePromise = context.waitForEvent('page');
1717
await githubButton.click();
@@ -21,7 +21,7 @@ test.describe('Footer social media buttons', () => {
2121
});
2222

2323
test('Twitter/X button should navigate to Kotlin Twitter page', async ({ page, context }) => {
24-
const twitterButton = page.getByRole('link', { name: 'Kotlin on Twitter' });
24+
const twitterButton = page.getByTestId('footer').getByRole('link', { name: 'Kotlin on Twitter' });
2525
await expect(twitterButton).toBeVisible();
2626
const newPagePromise = context.waitForEvent('page');
2727
await twitterButton.click();
@@ -31,7 +31,7 @@ test.describe('Footer social media buttons', () => {
3131
});
3232

3333
test('Bluesky button should navigate to Bluesky page', async ({ page, context }) => {
34-
const blueskyButton = page.getByRole('link', { name: 'Kotlin on Bluesky' });
34+
const blueskyButton = page.getByTestId('footer').getByRole('link', { name: 'Kotlin on Bluesky' });
3535
await expect(blueskyButton).toBeVisible();
3636
const newPagePromise = context.waitForEvent('page');
3737
await blueskyButton.click();
@@ -41,7 +41,7 @@ test.describe('Footer social media buttons', () => {
4141
});
4242

4343
test('Slack button should navigate to Kotlin Slack Sign-up page', async ({ page, context }) => {
44-
const slackButton = page.getByRole('link', { name: 'Kotlin Slack' });
44+
const slackButton = page.getByTestId('footer').getByRole('link', { name: 'Kotlin Slack' });
4545
await expect(slackButton).toBeVisible();
4646
const newPagePromise = context.waitForEvent('page');
4747
await slackButton.click();
@@ -51,7 +51,7 @@ test.describe('Footer social media buttons', () => {
5151
});
5252

5353
test('Reddit button should navigate to Kotlin on Reddit', async ({ page, context }) => {
54-
const redditButton = page.getByRole('link', { name: 'Kotlin on Reddit' });
54+
const redditButton = page.getByTestId('footer').getByRole('link', { name: 'Kotlin on Reddit' });
5555
await expect(redditButton).toBeVisible();
5656
const newPagePromise = context.waitForEvent('page');
5757
await redditButton.click();
@@ -61,7 +61,7 @@ test.describe('Footer social media buttons', () => {
6161
});
6262

6363
test('Stackoverflow button should navigate to Kotlin on Stackoverflow', async ({ page, context }) => {
64-
const stackoverflowButton = page.getByRole('link', { name: 'Kotlin on Stack Overflow' });
64+
const stackoverflowButton = page.getByTestId('footer').getByRole('link', { name: 'Kotlin on Stack Overflow' });
6565
await expect(stackoverflowButton).toBeVisible();
6666
const newPagePromise = context.waitForEvent('page');
6767
await stackoverflowButton.click();
@@ -72,7 +72,7 @@ test.describe('Footer social media buttons', () => {
7272

7373
//Without click on YouTube button, because of YouTube Cookies page, but it checks that the button contains the right link.
7474
test('YouTube button should navigate to Kotlin on YouTube', async ({ page }) => {
75-
const youTubeButton = page.getByRole('link', { name: ' Kotlin on YouTube' });
75+
const youTubeButton = page.getByTestId('footer').getByRole('link', { name: ' Kotlin on YouTube' });
7676
await expect(youTubeButton).toBeVisible();
7777
const href = await youTubeButton.getAttribute('href');
7878
expect(href).toBe('https://www.youtube.com/channel/UCP7uiEZIqci43m22KDl0sNw')

0 commit comments

Comments
 (0)