Skip to content

Commit

Permalink
Align playwright e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
tujoworker committed Sep 29, 2023
1 parent da08f32 commit 2c6fd04
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ completions.json
.history
*not_in_use*
/packages/dnb-ui-lib
**/test-results

# pkm
npm-debug.log*
Expand Down
15 changes: 7 additions & 8 deletions packages/dnb-design-system-portal/src/e2e/fullscreen.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { test, expect } from '@playwright/test'

test.describe('Fullscreen', () => {
test.describe.only('Fullscreen', () => {
test.beforeEach(async ({ page }) => {
await page.goto('/uilib/components/button/demos')
})
Expand All @@ -10,15 +10,14 @@ test.describe('Fullscreen', () => {
}) => {
await page.waitForSelector('nav#portal-sidebar-menu')

await page.click('button[title="Fullscreen"]')
await page.click('a.fullscreen')

await page.waitForSelector('nav#portal-sidebar-menu', {
state: 'hidden',
})

const currentURL = page.url()
expect(currentURL).toContain(
expect(page.url()).toContain(
'/uilib/components/button/demos/?fullscreen',
)

await page.click('a.fullscreen')

expect(page.url()).toContain('/uilib/components/button/demos/')
})
})
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { test, expect } from '@playwright/test'

test.describe('Responsiveness', () => {
test.describe.only('Responsiveness', () => {
test.beforeEach(async ({ page }) => {
await page.goto('/uilib/')

Expand All @@ -12,7 +12,6 @@ test.describe('Responsiveness', () => {

test('change viewport size should add sidebar menu', async ({
page,
baseURL,
}) => {
await expect(page.locator('nav#portal-sidebar-menu')).toHaveCSS(
'display',
Expand All @@ -35,7 +34,7 @@ test.describe('Responsiveness', () => {
state: 'attached',
})

expect(page.url()).toBe(`${baseURL}/uilib/about-the-lib/`)
expect(page.url()).toContain('/uilib/about-the-lib/')
await expect(page.locator('h1')).toContainText('#About the library')
})
})

0 comments on commit 2c6fd04

Please sign in to comment.