Skip to content

Commit d7540f8

Browse files
authored
ci: read the canonical post redirect from the server instead of leaving the admin page while it loads (#1300)
Try to fix some random fail in CI
1 parent 54710cb commit d7540f8

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎tests/posts/tree.spec.ts‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ test.describe('Pages tree', () => {
5555
})
5656
createdIds.push(childId)
5757

58-
await page.goto(`/posts/${childId}`)
59-
await expect(page).toHaveURL(new RegExp(`/pages/${parent.slug}/enfant-${uniqueId}$`))
58+
const response = await request.get(`/posts/${childId}`, { maxRedirects: 0 })
59+
expect(response.status()).toBe(301)
60+
expect(response.headers().location).toMatch(new RegExp(`/pages/${parent.slug}/enfant-${uniqueId}$`))
6061
})
6162

6263
test('the parent picker of a page proposes neither the page nor its sub-pages', async ({ page, request }) => {
@@ -95,7 +96,8 @@ test.describe('Pages tree', () => {
9596
const newsId = await saveNewPost(page)
9697
createdIds.push(newsId)
9798

98-
await page.goto(`/posts/${newsId}`)
99-
await expect(page).toHaveURL(new RegExp(`/posts/actualite-${uniqueId}$`))
99+
const response = await request.get(`/posts/${newsId}`, { maxRedirects: 0 })
100+
expect(response.status()).toBe(301)
101+
expect(response.headers().location).toMatch(new RegExp(`/posts/actualite-${uniqueId}$`))
100102
})
101103
})

0 commit comments

Comments
 (0)