Skip to content

Commit 3aae0e4

Browse files
committed
Add tests for Kotlin User Groups on the Community page.
1 parent c5426ed commit 3aae0e4

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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, context }) => {
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+
// The test fails in case we click on the link (it has some additional parameters). To investigate the link after click.
25+
test('Start a New KUG button opens the related page', async ({ page, context }) => {
26+
const startKugButton = page.getByRole('link', { name: 'Start a New KUG' });
27+
await expect(startKugButton).toBeVisible();
28+
// const newPagePromise = context.waitForEvent('page');
29+
// await startKugButton.click();
30+
// const newPage = await newPagePromise;
31+
// await newPage.waitForLoadState();
32+
// await expect(newPage.url()).toContain('https://surveys.jetbrains.com/s3/submit-a-local-kotlin-user-group');
33+
34+
// The test passes in case we don't click on this link.
35+
const href = await startKugButton.getAttribute('href');
36+
expect(href).toBe('https://surveys.jetbrains.com/s3/submit-a-local-kotlin-user-group');
37+
});
38+
39+
test('Write to us button on the KUGs page contains the related e-mail', async ({ page }) => {
40+
const writeToUsButton = page.getByRole('link', { name: 'Write to us' });
41+
await expect(writeToUsButton).toBeVisible();
42+
const href = await writeToUsButton.getAttribute('href');
43+
expect(href).toBe('mailto:[email protected]');
44+
});
45+
});

0 commit comments

Comments
 (0)