test: cleanup test codes, use fixtures

This commit is contained in:
leejooy96 committed 2024-08-09 09:54:21 +09:00
1 parent ed84aeb78b
commit 38305f533b
5 files changed
+158 -74

No files matched your search

+36
View File
@@ -0,0 +1,36 @@
import { test, expect, beforeAll, afterAll } from '../fixtures.mts'
test.beforeAll(beforeAll)
test.afterAll(afterAll)
test('Document element check', async ({ page, util }) => {
try {
await expect(
page.getByTestId('main-logo').first(),
`Confirm main logo is visible`
).toBeVisible()
await expect(
page.getByTestId('select-language').first(),
`Confirm language selector is visible`
).toBeVisible()
await util.captureScreenshot(page, 'result')
} catch (error) {
throw await util.onTestError(error)
}
})
test('Counter button click check', async ({ page, util }) => {
try {
await page.getByTestId('btn-counter').click({ clickCount: 10, delay: 50 })
const counterValueElement = await page
.getByTestId('counter-badge')
.getByRole('status')
.innerHTML()
expect(counterValueElement).toBe('10')
} catch (error) {
throw await util.onTestError(error)
}
})