Skip to content

Commit f9e358b

Browse files
authored
Merge pull request #4884 from JetBrains/autotests_for_main_page
Autotests for main page
2 parents c5a57ee + ffdc9b9 commit f9e358b

File tree

1 file changed

+98
-0
lines changed

1 file changed

+98
-0
lines changed
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
import { test, expect } from '@playwright/test';
2+
3+
test.describe('Main page 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+
});
9+
10+
test('Hero section Get started button', async ({ page }) => {
11+
const getStartedButton = page.getByTestId('hero-block').getByRole('link', { name: 'Get started' });
12+
await expect(getStartedButton).toBeVisible();
13+
await getStartedButton.click();
14+
await expect(page.url()).toContain('/docs/getting-started.html');
15+
const pageTitle = page.locator('h1').first();
16+
await expect(pageTitle).toContainText('Get started with Kotlin');
17+
});
18+
19+
test('Kotlin blog button', async ({ page }) => {
20+
const blogButton = page.getByRole('link', { name: 'Kotlin blog' });
21+
await expect(blogButton).toBeVisible();
22+
await blogButton.click();
23+
await expect(page.url()).toContain('https://blog.jetbrains.com/kotlin/');
24+
const pageTitle = page.locator('h1').first();
25+
await expect(pageTitle).toContainText('Kotlin')
26+
});
27+
28+
test('Why Kotlin Get started button', async ({ page }) => {
29+
const whyKotlinButton = page.getByTestId('why-kotlin-block').getByRole('link', { name: 'Get started' });
30+
await expect(whyKotlinButton).toBeVisible();
31+
await whyKotlinButton.click();
32+
await expect(page.url()).toContain('/docs/getting-started.html');
33+
const pageTitle = page.locator('h1').first();
34+
await expect(pageTitle).toContainText('Get started with Kotlin');
35+
});
36+
37+
test('Learn about Kotlin Multiplatform button', async ({ page }) => {
38+
const multiplatformButton = page.getByRole('link', { name: 'Learn about Kotlin Multiplatform' });
39+
await expect(multiplatformButton).toBeVisible();
40+
await multiplatformButton.click();
41+
await expect(page.url()).toContain('https://www.jetbrains.com/kotlin-multiplatform/');
42+
const pageTitle = page.locator('h1').first();
43+
await expect(pageTitle).toContainText('Kotlin Multiplatform');
44+
});
45+
46+
test('Learn about JetBrains AI button', async ({ page }) => {
47+
const jetbrainsAIButton = page.getByRole('link', { name: 'Learn about JetBrains AI' })
48+
await expect(jetbrainsAIButton).toBeVisible();
49+
await jetbrainsAIButton.click();
50+
await expect(page.url()).toContain('https://www.jetbrains.com/ai/');
51+
const pageTitle = page.locator('h1').first()
52+
await expect(pageTitle).toContainText('JetBrains AI');
53+
});
54+
55+
test('Build AI apps with Kotlin button', async ({ page }) => {
56+
const buildAIAppsButton = page.getByRole('link', { name: 'Build AI apps with Kotlin' })
57+
await expect(buildAIAppsButton).toBeVisible();
58+
await buildAIAppsButton.click();
59+
await expect(page.url()).toContain('/docs/kotlin-ai-apps-development-overview.html');
60+
const pageTitle = page.locator('h1').first()
61+
await expect(pageTitle).toContainText('Kotlin for AI-powered app development');
62+
});
63+
64+
test('Get started in AI section', async ({ page }) => {
65+
const getStartedKoogButton = page.getByTestId('kotlin-plus-ai-block').getByRole('link', { name: 'Get started' });
66+
await expect(getStartedKoogButton).toBeVisible();
67+
await getStartedKoogButton.click();
68+
await expect(page.url()).toContain('/docs.koog.ai/')
69+
await expect(page.getByText('Koog is a Kotlin-based framework')).toBeVisible();
70+
});
71+
72+
test('Join the community button', async ({ page }) => {
73+
const joinCommunityButton = page.getByRole('link', { name: 'Join the community' });
74+
await expect(joinCommunityButton).toBeVisible();
75+
await joinCommunityButton.click();
76+
await page.waitForTimeout(2000);
77+
await expect(page.url()).toContain('/community/');
78+
await expect(page.getByText('Get involved in the community')).toBeVisible();
79+
});
80+
81+
test('Learn more button in Kotlin Foundation section', async ({ page }) => {
82+
const learnMoreButton = page.getByRole('link', { name: 'Learn more' });
83+
await expect(learnMoreButton).toBeVisible();
84+
await learnMoreButton.click();
85+
await expect(page.url()).toContain('https://kotlinfoundation.org/');
86+
const pageTitle = page.locator('h1').first();
87+
await expect(pageTitle).toContainText('Protect, promote and advance the development of the Kotlin programming language');
88+
});
89+
90+
test('Last Get started button', async ({ page }) => {
91+
const getStartedButton = page.getByRole('link', { name: 'Get started' }).last();
92+
await expect(getStartedButton).toBeVisible();
93+
await getStartedButton.click();
94+
await expect(page.url()).toContain('/docs/getting-started.html');
95+
const pageTitle = page.locator('h1').first();
96+
await expect(pageTitle).toContainText('Get started with Kotlin');
97+
});
98+
});

0 commit comments

Comments
 (0)