This repository has been archived by the owner on Jun 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Improve first playwright tests
- Loading branch information
Showing
6 changed files
with
54 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test.describe('Header', ()=> { | ||
test.describe('Header section', ()=> { | ||
test.beforeEach(async ({ page }, testInfo) => { | ||
console.log(`Running ${testInfo.title}`); | ||
await page.goto('http://localhost:4200/'); | ||
await page.goto('/'); | ||
}); | ||
|
||
test('github url is shown', async ({ page }) => { | ||
test('github url is shown as link', async ({ page }) => { | ||
// then | ||
await expect(page.locator("mat-toolbar a")).toHaveAttribute('href', 'https://github.com/stavshamir/springwolf') | ||
}); | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,27 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import asyncApiJson from '../src/app/shared/mock/mock.springwolf-kafka-example.json' | ||
|
||
test.describe('Info', ()=> { | ||
test.describe('Info section', ()=> { | ||
test.beforeEach(async ({ page }, testInfo) => { | ||
console.log(`Running ${testInfo.title}`); | ||
await page.goto('http://localhost:4200/'); | ||
await page.goto('/'); | ||
}); | ||
|
||
test('section is shown', async ({ page }) => { | ||
test('info is shown', async ({ page }) => { | ||
// then | ||
await expect(page.locator('app-info h1')).toHaveText('Springwolf example project - Kafka' ); | ||
await expect(page.locator('app-info h5')).toHaveText('API VERSION 1.0.0 - AsyncAPI JSON file' ); | ||
await expect(page.locator('app-info p')).toHaveText('Springwolf example project to demonstrate springwolfs abilities' ); | ||
}); | ||
|
||
test('download of AsyncApi json', async ({ page }) => { | ||
test('download of AsyncApi json matches original file', async ({ page }) => { | ||
// when | ||
const [popup] = await Promise.all([ | ||
page.waitForEvent('popup'), | ||
page.getByRole('link', { name: 'AsyncAPI JSON file' }).click() | ||
]); | ||
const popupContent = await popup.evaluate('document.body.textContent') as string | ||
|
||
// then | ||
await expect(JSON.parse(popupContent)).toStrictEqual(asyncApiJson) | ||
}); | ||
}) |