|
1 | 1 | import { test, expect } from '@playwright/test'; |
2 | 2 | import asyncApiJson from '../src/app/shared/mock/mock.springwolf-kafka-example.json' |
3 | 3 |
|
4 | | -test.describe('Channel', ()=> { |
| 4 | +test.describe('Channel section', ()=> { |
5 | 5 | test.beforeEach(async ({ page }, testInfo) => { |
6 | | - console.log(`Running ${testInfo.title}`); |
7 | | - await page.goto('http://localhost:4200/'); |
| 6 | + await page.goto('/'); |
8 | 7 | }); |
9 | 8 |
|
10 | | - test('first collapsible is rendered', async ({ page }) => { |
| 9 | + test('clicking on channel updates the url', async ({ page }) => { |
| 10 | + // when |
11 | 11 | await page.locator("#channel-kafka-another-topic-publish-AnotherPayloadDto").click() |
| 12 | + |
| 13 | + // then |
12 | 14 | await expect(page).toHaveURL('http://localhost:4200/#channel-kafka-another-topic-publish-AnotherPayloadDto'); |
| 15 | + }) |
| 16 | + |
| 17 | + test('(first) channel example tab is rendered', async ({ page }) => { |
| 18 | + // when |
| 19 | + await page.locator("#channel-kafka-another-topic-publish-AnotherPayloadDto").click() |
13 | 20 |
|
| 21 | + // then |
| 22 | + await page.getByRole('tab', { name: 'Example' }).getByText('Example').click(); |
14 | 23 | await expect(page.getByRole('tabpanel', { name: 'Example' }).locator('textarea')) |
15 | 24 | .toHaveValue(JSON.stringify(asyncApiJson.components.schemas.AnotherPayloadDto.example, null, 2)) |
| 25 | + }); |
| 26 | + |
| 27 | + test('(first) channel schema tab is rendered', async ({ page }) => { |
| 28 | + // when |
| 29 | + await page.locator("#channel-kafka-another-topic-publish-AnotherPayloadDto").click() |
16 | 30 |
|
| 31 | + // then |
17 | 32 | await page.getByRole('tab', { name: 'Schema' }).getByText('Schema').click(); |
18 | 33 | await page.getByRole('heading', { name: 'AnotherPayloadDto #/components/schemas/AnotherPayloadDto' }).click(); |
19 | 34 | await page.getByRole('cell', { name: 'string Foo field example: "bar"' }).getByText('string').click(); |
20 | 35 | await page.getByRole('cell', { name: 'string Foo field example: "bar"' }).getByText('Foo field').click(); |
21 | 36 | await page.getByRole('cell', { name: 'string Foo field example: "bar"' }).getByText('example: "bar"').click(); |
| 37 | + }); |
| 38 | + |
| 39 | + test('(first) channel headers tab is rendered', async ({ page }) => { |
| 40 | + // when |
| 41 | + await page.locator("#channel-kafka-another-topic-publish-AnotherPayloadDto").click() |
22 | 42 |
|
| 43 | + // then |
23 | 44 | await page.getByRole('tab', { name: 'Headers' }).getByText('Headers').click(); |
24 | 45 | await page.getByRole('heading', { name: 'HeadersNotDocumented #/components/schemas/HeadersNotDocumented' }).click(); |
25 | 46 | await expect(page.getByRole('tabpanel', { name: 'Headers' }).locator('textarea')) |
26 | 47 | .toHaveValue(JSON.stringify(asyncApiJson.components.schemas.HeadersNotDocumented.example, null, 2)) |
| 48 | + }); |
| 49 | + |
| 50 | + test('(first) channel bindings tab is rendered', async ({ page }) => { |
| 51 | + // when |
| 52 | + await page.locator("#channel-kafka-another-topic-publish-AnotherPayloadDto").click() |
27 | 53 |
|
| 54 | + // then |
28 | 55 | await page.getByRole('tab', { name: 'Bindings' }).getByText('Bindings').click(); |
29 | 56 | await page.getByText(/\{\s+"groupId":\s+\{\s+"type":\s+"string",\s+"enum":\s+\[\s+"example-group-id"\s+\]\s+\}\s+\}/).click(); |
30 | 57 | }); |
|
0 commit comments