Skip to content

Commit 37c79f2

Browse files
authored
Merge pull request #4971 from JetBrains/autotests_for_kotlin_user_groups
Autotests for kotlin user groups
2 parents 3b41910 + 090e7c5 commit 37c79f2

File tree

4 files changed

+176
-1
lines changed

4 files changed

+176
-1
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { test, expect } from '@playwright/test';
2+
3+
test.describe('Community Kotlin User Groups page', () => {
4+
test.beforeEach(async ({ page }) => {
5+
await page.goto('/community/user-groups/');
6+
await page.waitForSelector('button.ch2-btn.ch2-btn-primary');
7+
await page.click('button.ch2-btn.ch2-btn-primary');
8+
});
9+
10+
test('Overview in navbar opens the related page', async ({ page }) => {
11+
const kotlinUserGroupsButton = page.getByRole('link', { name: 'Overview' });
12+
await expect(kotlinUserGroupsButton).toBeVisible();
13+
await kotlinUserGroupsButton.click();
14+
await expect(page.url()).toContain('/community/');
15+
});
16+
17+
test('KUG Guidelines button opens the related page', async ({ page }) => {
18+
const kugGuidelinesButton = page.getByRole('link', { name: 'KUG Guidelines' });
19+
await expect(kugGuidelinesButton).toBeVisible();
20+
await kugGuidelinesButton.click();
21+
await expect(page.url()).toContain('/docs/kug-guidelines.html');
22+
});
23+
24+
test('Start a New KUG button opens the related page', async ({ page }) => {
25+
const startKugButton = page.getByRole('link', { name: 'Start a New KUG' });
26+
await expect(startKugButton).toBeVisible();
27+
await startKugButton.click();
28+
await expect(page.url()).toContain('https://surveys.jetbrains.com/s3/submit-a-local-kotlin-user-group');
29+
});
30+
31+
test('Write to us button on the KUGs page contains the related e-mail', async ({ page }) => {
32+
const writeToUsButton = page.getByRole('link', { name: 'Write to us' });
33+
await expect(writeToUsButton).toBeVisible();
34+
const href = await writeToUsButton.getAttribute('href');
35+
expect(href).toBe('mailto:[email protected]');
36+
});
37+
});
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
import { expect, test } from '@playwright/test';
2+
3+
test.describe('Community page, overview tab, keep in touch section', () => {
4+
test.beforeEach(async ({ page }) => {
5+
await page.goto('/community/');
6+
await page.waitForSelector('button.ch2-btn.ch2-btn-primary');
7+
await page.click('button.ch2-btn.ch2-btn-primary');
8+
});
9+
10+
test('Slack button opens the related page', async ({ page, context }) => {
11+
const slackButton = page.getByRole('link', { name: 'Slack' }).first();
12+
await expect(slackButton).toBeVisible();
13+
const newPagePromise = context.waitForEvent('page');
14+
await slackButton.click();
15+
const newPage = await newPagePromise;
16+
await newPage.waitForLoadState();
17+
await expect(newPage.url()).toContain('https://slack-chats.kotlinlang.org/');
18+
});
19+
20+
test('X (Twitter) button opens the related page', async ({ page, context }) => {
21+
const twitterButton = page.getByRole('link', { name: 'X' }).first();
22+
await expect(twitterButton).toBeVisible();
23+
const newPagePromise = context.waitForEvent('page');
24+
await twitterButton.click();
25+
const newPage = await newPagePromise;
26+
await newPage.waitForLoadState();
27+
await expect(newPage.url()).toContain('https://x.com/kotlin');
28+
});
29+
30+
test('Kotlin Blog button opens the related page', async ({ page, context }) => {
31+
const blogButton = page.getByRole('link', { name: 'Kotlin Blog' }).first();
32+
await expect(blogButton).toBeVisible();
33+
const newPagePromise = context.waitForEvent('page');
34+
await blogButton.click();
35+
const newPage = await newPagePromise;
36+
await newPage.waitForLoadState();
37+
await expect(newPage.url()).toContain('https://blog.jetbrains.com/kotlin/');
38+
});
39+
40+
test('Reddit button opens the related page', async ({ page, context }) => {
41+
const redditButton = page.getByRole('link', { name: 'Reddit' }).first();
42+
await expect(redditButton).toBeVisible();
43+
const newPagePromise = context.waitForEvent('page');
44+
await redditButton.click();
45+
const newPage = await newPagePromise;
46+
await newPage.waitForLoadState();
47+
await expect(newPage.url()).toContain('https://www.reddit.com/r/Kotlin/');
48+
});
49+
50+
test('StackOverflow button opens the related page', async ({ page, context }) => {
51+
const stackOverflowButton = page.getByRole('link', { name: 'StackOverflow' });
52+
await expect(stackOverflowButton).toBeVisible();
53+
const newPagePromise = context.waitForEvent('page');
54+
await stackOverflowButton.click();
55+
const newPage = await newPagePromise;
56+
await newPage.waitForLoadState();
57+
await expect(newPage.url()).toContain('https://stackoverflow.com/questions/tagged/kotlin');
58+
});
59+
60+
// Without click on YouTube button, because of YouTube Cookies page, but it checks that the button contains the right link.
61+
test('YouTube button opens the related page', async ({ page }) => {
62+
const youtubeButton = page.getByRole('link', { name: 'YouTube' }).first();
63+
await expect(youtubeButton).toBeVisible();
64+
const href = await youtubeButton.getAttribute('href');
65+
expect(href).toBe('https://www.youtube.com/channel/UCP7uiEZIqci43m22KDl0sNw')
66+
});
67+
68+
test('Talking Kotlin button opens the related page', async ({ page, context }) => {
69+
const talkingKotlinButton = page.getByRole('link', { name: 'Talking Kotlin' });
70+
await expect(talkingKotlinButton).toBeVisible();
71+
const newPagePromise = context.waitForEvent('page');
72+
await talkingKotlinButton.click();
73+
const newPage = await newPagePromise;
74+
await newPage.waitForLoadState();
75+
await expect(newPage.url()).toContain('talkingkotlin.com/');
76+
});
77+
78+
// Without click on LinkedIn button, since LinkedIn requires authorization, but it checks that the button contains the right link.
79+
test('LinkedIn button opens the related page', async ({ page }) => {
80+
const linkedInButton = page.getByRole('link', { name: 'LinkedIn' });
81+
await expect(linkedInButton).toBeVisible();
82+
const href = await linkedInButton.getAttribute('href');
83+
expect(href).toBe('https://www.linkedin.com/groups/7417237/profile');
84+
});
85+
86+
test('Issue Tracker button opens the related page', async ({ page, context }) => {
87+
const issueTrackerButton = page.getByRole('link', { name: 'Issue Tracker' }).first();
88+
await expect(issueTrackerButton).toBeVisible();
89+
const newPagePromise = context.waitForEvent('page');
90+
await issueTrackerButton.click();
91+
const newPage = await newPagePromise;
92+
await newPage.waitForLoadState();
93+
await expect(newPage.url()).toContain('https://youtrack.jetbrains.com/issues/kt');
94+
});
95+
});
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { test, expect } from '@playwright/test';
2+
3+
test.describe('Community page, overview tab, rest buttons', () => {
4+
test.beforeEach(async ({ page }) => {
5+
await page.goto('/community/');
6+
await page.waitForSelector('button.ch2-btn.ch2-btn-primary');
7+
await page.click('button.ch2-btn.ch2-btn-primary');
8+
});
9+
10+
test('Kotlin User Groups in navbar opens the user-groups page', async ({ page }) => {
11+
const kotlinUserGroupsButton = page.getByRole('link', { name: 'Kotlin User Groups' });
12+
await expect(kotlinUserGroupsButton).toBeVisible();
13+
await kotlinUserGroupsButton.click();
14+
// We need a timeout here, because this page needs more time for loading https://kotlinlang.org/community/user-groups/
15+
await page.waitForTimeout(2000);
16+
await expect(page.url()).toContain('/community/user-groups/');
17+
});
18+
19+
test('Click on Awesome Kotlin button opens the related page', async ({ page, context }) => {
20+
const awesomeKotlinButton = page.getByRole('link', { name: 'Awesome Kotlin' });
21+
await expect(awesomeKotlinButton).toBeVisible();
22+
const newPagePromise = context.waitForEvent('page');
23+
await awesomeKotlinButton.click();
24+
const newPage = await newPagePromise;
25+
await newPage.waitForLoadState();
26+
await expect(newPage.url()).toContain('https://kotlin.link/');
27+
});
28+
29+
test('All KUGs button at the join section opens the KUGs page', async ({ page }) => {
30+
const allKugsButton = page.getByRole('link', { name: 'All KUGs' }).first();
31+
await expect(allKugsButton).toBeVisible();
32+
await allKugsButton.click();
33+
// We need a timeout here, because this page needs more time for loading https://kotlinlang.org/community/user-groups/
34+
await page.waitForTimeout(2000);
35+
await expect(page.url()).toContain('/community/user-groups/');
36+
});
37+
38+
test('Write to us button contains the related e-mail', async ({ page }) => {
39+
const writeToUsButton = page.getByRole('link', { name: 'Write to us' });
40+
await expect(writeToUsButton).toBeVisible();
41+
const href = await writeToUsButton.getAttribute('href');
42+
expect(href).toBe('mailto:[email protected]');
43+
});
44+
});

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,5 @@ test.describe('Footer social media buttons', () => {
7676
await expect(youTubeButton).toBeVisible();
7777
const href = await youTubeButton.getAttribute('href');
7878
expect(href).toBe('https://www.youtube.com/channel/UCP7uiEZIqci43m22KDl0sNw')
79-
8079
});
8180
});

0 commit comments

Comments
 (0)