* Status WIP * feat: Status * fix: Status tests * feat: status redirect * chore: Status tests * chore: Status tests * feat: Status tests * chore: Status playwright tests * fix: PR feedback, mostly Vue and copyright dates * fix: Status model migration tidy up * chore: Status - one migration * feat: status on doc/html pages * chore: Resetting Status migration * chore: removing unused FieldError * fix: Update Status test to remove 'by' * chore: fixing API test to exclude 'status' * chore: fixing status_page test * feat: Site Status PR feedback. URL coverage debugging * Adding ietf.status to Tastypie omitted apps * feat: Site Status PR feedback * chore: correct copyright year on newly created files * chore: repair merge damage * chore: repair more merge damage * fix: reconcile the api init refactor with ignoring apps --------- Co-authored-by: Matthew Holloway <Matthew Holloway> Co-authored-by: Robert Sparks <rjsparks@nostrum.com>
62 lines
1.8 KiB
JavaScript
62 lines
1.8 KiB
JavaScript
const {
|
|
test,
|
|
expect
|
|
} = require('@playwright/test')
|
|
const { STATUS_STORAGE_KEY, generateStatusTestId } = require('../../../client/shared/status-common.js')
|
|
|
|
test.describe('site status', () => {
|
|
const noStatus = {
|
|
hasMessage: false
|
|
}
|
|
|
|
const status1 = {
|
|
hasMessage: true,
|
|
id: 1,
|
|
slug: '2024-7-9fdfdf-sdfsdf',
|
|
title: 'My status title',
|
|
body: 'My status body',
|
|
url: '/status/2024-7-9fdfdf-sdfsdf',
|
|
date: '2024-07-09T07:05:13+00:00',
|
|
by: 'Exile is a cool Amiga game'
|
|
}
|
|
|
|
test('Renders server status as Notification', async ({ page }) => {
|
|
await page.route('/status/latest.json', route => {
|
|
route.fulfill({
|
|
status: 200,
|
|
contentType: 'application/json',
|
|
body: JSON.stringify(status1)
|
|
})
|
|
})
|
|
await page.goto('/')
|
|
await expect(page.getByTestId(generateStatusTestId(status1.id)), 'should have status').toHaveCount(1)
|
|
})
|
|
|
|
test("Doesn't render dismissed server statuses", async ({ page }) => {
|
|
await page.route('/status/latest.json', route => {
|
|
route.fulfill({
|
|
status: 200,
|
|
contentType: 'application/json',
|
|
body: JSON.stringify(status1)
|
|
})
|
|
})
|
|
await page.goto('/')
|
|
await page.evaluate(({ key, value }) => localStorage.setItem(key, value), { key: STATUS_STORAGE_KEY, value: JSON.stringify([status1.id]) })
|
|
await expect(page.getByTestId(generateStatusTestId(status1.id)), 'should have status').toHaveCount(0)
|
|
})
|
|
|
|
test('Handles no server status', async ({ page }) => {
|
|
await page.route('/status/latest.json', route => {
|
|
route.fulfill({
|
|
status: 200,
|
|
contentType: 'application/json',
|
|
body: JSON.stringify(noStatus)
|
|
})
|
|
})
|
|
|
|
await page.goto('/')
|
|
|
|
await expect(page.getByTestId(generateStatusTestId(status1.id)), 'should have status').toHaveCount(0)
|
|
})
|
|
})
|