Skip to content

Commit

Permalink
chore: update pw config
Browse files Browse the repository at this point in the history
  • Loading branch information
matej21 committed Aug 2, 2023
1 parent abd55d6 commit e434e5c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
4 changes: 2 additions & 2 deletions packages/admin/playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const config = {

expect: {
toMatchSnapshot: {
threshold: process.env.CI ? 0.05 : 0,
maxDiffPixelRatio: process.env.CI ? 0.05 : 0,
threshold: process.env.CI ? 0.03 : 0,
maxDiffPixelRatio: process.env.CI ? 0.0005 : 0,
},
},

Expand Down
23 changes: 13 additions & 10 deletions packages/admin/tests/playwright/cases/blockEditor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ test('basic test', async ({ page }) => {
await page.goto(`/${projectSlug}/block-editor`)
await page.waitForLoadState('networkidle') // wait for fonts
await page.waitForSelector('p.cui-editorParagraph')
await page.waitForTimeout(500)
expect(await page.screenshot({ animations: 'disabled' })).toMatchSnapshot('initial.png')
await page.locator('p.cui-editorParagraph').click()
await page.keyboard.type('Hello world')
await page.waitForTimeout(500)
expect(await page.screenshot({ animations: 'disabled' })).toMatchSnapshot('filled.png')
await page.locator('p.cui-editorParagraph').selectText()
await page.waitForSelector('.cui-hoveringToolbar.is-active')
await page.waitForTimeout(500)
expect(await page.screenshot({ animations: 'disabled' })).toMatchSnapshot('selected.png')
})

Expand All @@ -37,18 +40,18 @@ test('inline buttons: ordered list', async ({ page }) => {
await page.keyboard.press('Shift+ArrowLeft', keyboardPressOptions)
}
await page.waitForSelector('.cui-hoveringToolbar.is-active')
await page.waitForTimeout(200)
await page.waitForTimeout(500)
expect(await page.screenshot({ animations: 'disabled' })).toMatchSnapshot('inline-buttons-ordered-list-initial.png')
await page.locator(':nth-match(button.cui-editorToolbarButton, 1)').click()
await page.waitForTimeout(200)
await page.waitForTimeout(500)
expect(await page.screenshot({ animations: 'disabled' })).toMatchSnapshot('inline-buttons-ordered-list-clicked.png')
await page.locator('text=Hello world').click()
await page.keyboard.press('End', keyboardPressOptions)
for (let i = 0; i < 'world'.length; i++) {
await page.keyboard.press('Shift+ArrowLeft', keyboardPressOptions)
}
await page.waitForSelector('.cui-hoveringToolbar.is-active')
await page.waitForTimeout(200)
await page.waitForTimeout(500)
expect(await page.screenshot({ animations: 'disabled' })).toMatchSnapshot('inline-buttons-ordered-list-first.png')
await page.locator(':nth-match(button.cui-editorToolbarButton, 2)').click()
await page.locator('text=Hello world').click()
Expand All @@ -57,7 +60,7 @@ test('inline buttons: ordered list', async ({ page }) => {
await page.keyboard.press('Shift+ArrowLeft', keyboardPressOptions)
}
await page.waitForSelector('.cui-hoveringToolbar.is-active')
await page.waitForTimeout(200)
await page.waitForTimeout(500)
expect(await page.screenshot({ animations: 'disabled' })).toMatchSnapshot('inline-buttons-ordered-list-second.png')
await page.locator(':nth-match(button.cui-editorToolbarButton, 3)').click()
await page.locator('text=Hello world').click()
Expand All @@ -66,7 +69,7 @@ test('inline buttons: ordered list', async ({ page }) => {
await page.keyboard.press('Shift+ArrowLeft', keyboardPressOptions)
}
await page.waitForSelector('.cui-hoveringToolbar.is-active')
await page.waitForTimeout(200)
await page.waitForTimeout(500)
expect(await page.screenshot({ animations: 'disabled' })).toMatchSnapshot('inline-buttons-ordered-list-third.png')
})

Expand All @@ -83,18 +86,18 @@ test('inline buttons: unordered list', async ({ page }) => {
await page.keyboard.press('Shift+ArrowLeft', keyboardPressOptions)
}
await page.waitForSelector('.cui-hoveringToolbar.is-active')
await page.waitForTimeout(200)
await page.waitForTimeout(500)
expect(await page.screenshot({ animations: 'disabled' })).toMatchSnapshot('inline-buttons-unordered-list-initial.png')
await page.locator(':nth-match(button.cui-editorToolbarButton, 1)').click()
await page.waitForTimeout(200)
await page.waitForTimeout(500)
expect(await page.screenshot({ animations: 'disabled' })).toMatchSnapshot('inline-buttons-unordered-list-clicked.png')
await page.locator('text=Hello world').click()
await page.keyboard.press('End', keyboardPressOptions)
for (let i = 0; i < 'world'.length; i++) {
await page.keyboard.press('Shift+ArrowLeft', keyboardPressOptions)
}
await page.waitForSelector('.cui-hoveringToolbar.is-active')
await page.waitForTimeout(200)
await page.waitForTimeout(500)
expect(await page.screenshot({ animations: 'disabled' })).toMatchSnapshot('inline-buttons-unordered-list-first.png')
await page.locator(':nth-match(button.cui-editorToolbarButton, 2)').click()
await page.locator('text=Hello world').click()
Expand All @@ -103,7 +106,7 @@ test('inline buttons: unordered list', async ({ page }) => {
await page.keyboard.press('Shift+ArrowLeft', keyboardPressOptions)
}
await page.waitForSelector('.cui-hoveringToolbar.is-active')
await page.waitForTimeout(200)
await page.waitForTimeout(500)
expect(await page.screenshot({ animations: 'disabled' })).toMatchSnapshot('inline-buttons-unordered-list-second.png')
await page.locator(':nth-match(button.cui-editorToolbarButton, 3)').click()
await page.locator('text=Hello world').click()
Expand All @@ -112,6 +115,6 @@ test('inline buttons: unordered list', async ({ page }) => {
await page.keyboard.press('Shift+ArrowLeft', keyboardPressOptions)
}
await page.waitForSelector('.cui-hoveringToolbar.is-active')
await page.waitForTimeout(200)
await page.waitForTimeout(500)
expect(await page.screenshot({ animations: 'disabled' })).toMatchSnapshot('inline-buttons-unordered-list-third.png')
})

0 comments on commit e434e5c

Please sign in to comment.