Skip to content

Commit 9a2b544

Browse files
authored
Merge pull request #4973 from JetBrains/tests-for-api-button
ktl-1690 Add tests for API button
2 parents 9756df0 + 0c193e1 commit 9a2b544

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import { test, expect } from '@playwright/test';
2+
test.describe('Api navigation', () => {
3+
test.beforeEach(async ({ page }) => {
4+
await page.goto('/');
5+
await page.waitForSelector('button.ch2-btn.ch2-btn-primary');
6+
await page.click('button.ch2-btn.ch2-btn-primary');
7+
const navbar = page.locator('[data-test="header"]');
8+
const apiButton = navbar.getByText('API').first();
9+
await expect(apiButton).toBeVisible();
10+
await apiButton.click();
11+
});
12+
13+
test('Click on "APIs overview" button should open the related page', async ({ page }) => {
14+
const apiOverviewButton = page.getByText('APIs overview').first();
15+
await expect(apiOverviewButton).toBeVisible();
16+
await apiOverviewButton.click();
17+
await expect(page.url()).toContain('/docs/api-references.html');
18+
});
19+
20+
test('Click on "Standard library" button should open the related page', async ({ page }) => {
21+
const standardLibraryButton = page.getByText('Standard library').first();
22+
await expect(standardLibraryButton).toBeVisible();
23+
await standardLibraryButton.click();
24+
await expect(page.url()).toContain('/api/core/kotlin-stdlib/');
25+
});
26+
27+
test('Click on "Test library" button should open the related page', async ({ page }) => {
28+
const testLibraryButton = page.getByText('Test library').first();
29+
await expect(testLibraryButton).toBeVisible();
30+
await testLibraryButton.click();
31+
await expect(page.url()).toContain('/api/core/kotlin-test/');
32+
});
33+
34+
test('Click on "Coroutines" button should open the related page', async ({ page }) => {
35+
const coroutinesButton = page.getByText('Coroutines').first();
36+
await expect(coroutinesButton).toBeVisible();
37+
await coroutinesButton.click();
38+
await expect(page.url()).toContain('/api/kotlinx.coroutines/');
39+
});
40+
41+
test('Click on "Serialization" button should open the related page', async ({ page }) => {
42+
const serializationButton = page.getByText('Serialization').first();
43+
await expect(serializationButton).toBeVisible();
44+
await serializationButton.click();
45+
await expect(page.url()).toContain('/api/kotlinx.serialization/');
46+
});
47+
48+
test('Click on "Kotlin I/O library" button should open the related page', async ({ page }) => {
49+
const ioButton = page.getByText('Kotlin I/O library').first();
50+
await expect(ioButton).toBeVisible();
51+
await ioButton.click();
52+
await expect(page.url()).toContain('/api/kotlinx-io/');
53+
});
54+
55+
test('Click on "Date and time" button should open the related page', async ({ page }) => {
56+
const datetimeButton = page.getByText('Date and time').first();
57+
await expect(datetimeButton).toBeVisible();
58+
await datetimeButton.click();
59+
await expect(page.url()).toContain('/api/kotlinx-datetime/');
60+
});
61+
62+
63+
test('Click on "JVM Metadata" button should open the related page', async ({ page }) => {
64+
const metadataButton = page.getByText('JVM Metadata').first();
65+
await expect(metadataButton).toBeVisible();
66+
await metadataButton.click();
67+
await expect(page.url()).toContain('/api/kotlinx-metadata-jvm/');
68+
});
69+
70+
test('Click on "Kotlin Gradle plugins" button should open the related page', async ({ page }) => {
71+
const kgpButton = page.getByText('Kotlin Gradle plugins').first();
72+
await expect(kgpButton).toBeVisible();
73+
await kgpButton.click();
74+
await expect(page.url()).toContain('/api/kotlin-gradle-plugin/');
75+
});
76+
77+
test('Click on "Ktor" button should open the related page', async ({ page }) => {
78+
const ktorButton = page.getByText('Ktor').first();
79+
await expect(ktorButton).toBeVisible();
80+
await ktorButton.click();
81+
await expect(page.url()).toContain('api.ktor.io');
82+
});
83+
});

0 commit comments

Comments
 (0)