Skip to content

Commit 636ba0e

Browse files
committed
test(main-page-buttons): improve selector handling and format consistency
- Refactor test selectors to leverage `testSelector` for consistency and reusability - Fix missing semicolons and ensure uniform code formatting across test cases - Enhance readability and maintainability of tests
1 parent aa48046 commit 636ba0e

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

test/production/main-page-buttons.spec.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { test, expect } from '@playwright/test';
1+
import { expect, test } from '@playwright/test';
2+
import { testSelector } from '../utils';
23

34
test.describe('Main page buttons', () => {
45
test.beforeEach(async ({ page }) => {
@@ -27,12 +28,12 @@ test.describe('Main page buttons', () => {
2728
});
2829

2930
test('Kotlin blog button', async ({ page }) => {
30-
const blogButton = page.getByTestId('why-kotlin-block').getByRole('link', { name: 'Kotlin blog' });
31+
const blogButton = page.locator(testSelector('button')).getByRole('link', { name: 'Kotlin blog' });
3132
await expect(blogButton).toBeVisible();
3233
await blogButton.click();
3334
await expect(page.url()).toContain('https://blog.jetbrains.com/kotlin/');
3435
const pageTitle = page.locator('h1').first();
35-
await expect(pageTitle).toContainText('Kotlin')
36+
await expect(pageTitle).toContainText('Kotlin');
3637
});
3738

3839
test('Why Kotlin Get started button', async ({ page }) => {
@@ -54,28 +55,28 @@ test.describe('Main page buttons', () => {
5455
});
5556

5657
test('Learn about JetBrains AI button', async ({ page }) => {
57-
const jetbrainsAIButton = page.getByTestId('highlighted-cases-section').getByRole('link', { name: 'Learn about JetBrains AI' })
58+
const jetbrainsAIButton = page.getByTestId('highlighted-cases-section').getByRole('link', { name: 'Learn about JetBrains AI' });
5859
await expect(jetbrainsAIButton).toBeVisible();
5960
await jetbrainsAIButton.click();
6061
await expect(page.url()).toContain('https://www.jetbrains.com/ai/');
61-
const pageTitle = page.locator('h1').first()
62+
const pageTitle = page.locator('h1').first();
6263
await expect(pageTitle).toContainText('JetBrains AI');
6364
});
6465

6566
test('Build AI apps with Kotlin button', async ({ page }) => {
66-
const buildAIAppsButton = page.getByTestId('highlighted-cases-section').getByRole('link', { name: 'Build AI apps with Kotlin' })
67+
const buildAIAppsButton = page.getByTestId('highlighted-cases-section').getByRole('link', { name: 'Build AI apps with Kotlin' });
6768
await expect(buildAIAppsButton).toBeVisible();
6869
await buildAIAppsButton.click();
6970
await expect(page.url()).toContain('/docs/kotlin-ai-apps-development-overview.html');
70-
const pageTitle = page.locator('h1').first()
71+
const pageTitle = page.locator('h1').first();
7172
await expect(pageTitle).toContainText('Kotlin for AI-powered app development');
7273
});
7374

7475
test('Get started in AI section', async ({ page }) => {
7576
const getStartedKoogButton = page.getByTestId('highlighted-cases-section').getByTestId('kotlin-plus-ai-block').getByRole('link', { name: 'Get started' });
7677
await expect(getStartedKoogButton).toBeVisible();
7778
await getStartedKoogButton.click();
78-
await expect(page.url()).toContain('/docs.koog.ai/')
79+
await expect(page.url()).toContain('/docs.koog.ai/');
7980
await expect(page.getByText('Koog on GitHub').first()).toBeVisible();
8081
});
8182

0 commit comments

Comments
 (0)