Skip to content

Commit

Permalink
Try a more stable smoketest
Browse files Browse the repository at this point in the history
  • Loading branch information
timomeh committed Apr 3, 2024
1 parent 7341973 commit 63a3697
Showing 1 changed file with 66 additions and 21 deletions.
87 changes: 66 additions & 21 deletions tests/smoke.spec.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
import { expect, test } from '@playwright/test'

test.use({ userAgent: 'timomeh.de-wakeup/1.0' })

test('load all posts', async ({ page }) => {
test.setTimeout(0)
await page.goto('/')
const count = await page.getByRole('article').count()

for (let i = 0; i < count; i++) {
await page.goto('/')

await page.getByRole('article').nth(i).getByRole('link').click()
await page.waitForLoadState('networkidle', { timeout: 30_000 })
expect(page.url()).toContain('/posts/')
await page.waitForURL('**/posts/**', {
waitUntil: 'domcontentloaded',
timeout: 30_000,
})

await page.reload({ timeout: 30_000 })
await page.waitForLoadState('networkidle', { timeout: 30_000 })
expect(page.url()).toContain('/posts/')
await page.waitForURL('**/posts/**', {
waitUntil: 'domcontentloaded',
timeout: 30_000,
})
}
})

Expand All @@ -27,24 +35,34 @@ test('load all tags', async ({ page }) => {

for (let i = 1; i < count; i++) {
await page.goto('/')

await page
.getByRole('main')
.getByRole('navigation')
.getByRole('link')
.nth(i)
.click()
await page.waitForLoadState('networkidle', { timeout: 30_000 })
expect(page.url()).toContain('/tag/')
await page.waitForURL('**/tag/**', {
waitUntil: 'domcontentloaded',
timeout: 30_000,
})

await page.reload({ timeout: 30_000 })
await page.waitForLoadState('networkidle', { timeout: 30_000 })
expect(page.url()).toContain('/tag/')
await page.waitForURL('**/tag/**', {
waitUntil: 'domcontentloaded',
timeout: 30_000,
})

await page
.getByRole('main')
.getByRole('navigation')
.getByRole('link')
.first()
.click()
expect(page.url()).toBe('https://timomeh.de/')
await page.waitForURL('https://timomeh.de/', {
waitUntil: 'domcontentloaded',
timeout: 30_000,
})
}
})

Expand All @@ -69,33 +87,60 @@ test('load all feeds', async ({ request }) => {
test('load all pages', async ({ page }) => {
test.setTimeout(0)

await page.goto('/')
await page
.getByRole('link', { name: /timo mämecke/i })
.first()
.click()
await page.waitForURL('**/about', {
waitUntil: 'domcontentloaded',
timeout: 30_000,
})
await page.reload({ timeout: 30_000 })
await page.waitForURL('**/about', {
waitUntil: 'domcontentloaded',
timeout: 30_000,
})

await page.goto('/')
await page.getByRole('link', { name: /feeds/i }).first().click()
await page.waitForLoadState('networkidle', { timeout: 30_000 })
expect(page.url()).toContain('/feeds')
await page.waitForURL('**/feeds', {
waitUntil: 'domcontentloaded',
timeout: 30_000,
})
await page.reload({ timeout: 30_000 })
await page.waitForLoadState('networkidle', { timeout: 30_000 })
expect(page.url()).toContain('/feeds')
await page.waitForURL('**/feeds', {
waitUntil: 'domcontentloaded',
timeout: 30_000,
})

await page.goto('/')
await page
.getByRole('link', { name: /imprint/i })
.first()
.click()
await page.waitForLoadState('networkidle', { timeout: 30_000 })
expect(page.url()).toContain('/impressum')
await page.waitForURL('**/impressum', {
waitUntil: 'domcontentloaded',
timeout: 30_000,
})
await page.reload({ timeout: 30_000 })
await page.waitForLoadState('networkidle', { timeout: 30_000 })
expect(page.url()).toContain('/impressum')
await page.waitForURL('**/impressum', {
waitUntil: 'domcontentloaded',
timeout: 30_000,
})

await page.goto('/')
await page
.getByRole('link', { name: /privacy policy/i })
.first()
.click()
await page.waitForLoadState('networkidle', { timeout: 30_000 })
expect(page.url()).toContain('/datenschutz')
await page.waitForURL('**/datenschutz', {
waitUntil: 'domcontentloaded',
timeout: 30_000,
})
await page.reload({ timeout: 30_000 })
await page.waitForLoadState('networkidle', { timeout: 30_000 })
expect(page.url()).toContain('/datenschutz')
await page.waitForURL('**/datenschutz', {
waitUntil: 'domcontentloaded',
timeout: 30_000,
})
})

0 comments on commit 63a3697

Please sign in to comment.