chore: fix issues in versions e2e test

This commit is contained in:
Alessio Gravili
2024-03-31 16:05:20 -04:00
parent 535aa56627
commit aa8edd7a47
2 changed files with 5 additions and 4 deletions

View File

@@ -90,6 +90,7 @@ export async function saveDocHotkeyAndAssert(page: Page): Promise<void> {
} }
export async function saveDocAndAssert(page: Page, selector = '#action-save'): Promise<void> { export async function saveDocAndAssert(page: Page, selector = '#action-save'): Promise<void> {
await wait(500) // TODO: Fix this
await page.click(selector, { delay: 100 }) await page.click(selector, { delay: 100 })
await expect(page.locator('.Toastify')).toContainText('successfully') await expect(page.locator('.Toastify')).toContainText('successfully')
await expect.poll(() => page.url(), { timeout: POLL_TOPASS_TIMEOUT }).not.toContain('create') await expect.poll(() => page.url(), { timeout: POLL_TOPASS_TIMEOUT }).not.toContain('create')

View File

@@ -257,7 +257,7 @@ describe('versions', () => {
await page.waitForSelector('.doc-header__title', { state: 'visible' }) await page.waitForSelector('.doc-header__title', { state: 'visible' })
await page.goto(`${page.url()}/versions`) await page.goto(`${page.url()}/versions`)
expect(page.url()).toMatch(/\/versions$/) expect(page.url()).toMatch(/\/versions/)
}) })
test('should show collection versions view level action in collection versions view', async () => { test('should show collection versions view level action in collection versions view', async () => {
@@ -409,7 +409,7 @@ describe('versions', () => {
test('collection - autosave should only update the current document', async () => { test('collection - autosave should only update the current document', async () => {
// create and save first doc // create and save first doc
await page.goto(autosaveURL.create) await page.goto(autosaveURL.create)
await page.waitForURL(`**/${autosaveURL.create}`) await page.waitForURL(`${autosaveURL.create}`)
await page.waitForURL(/\/(?!create$)[\w-]+$/) await page.waitForURL(/\/(?!create$)[\w-]+$/)
await page.locator('#field-title').fill('first post title') await page.locator('#field-title').fill('first post title')
@@ -418,7 +418,7 @@ describe('versions', () => {
// create and save second doc // create and save second doc
await page.goto(autosaveURL.create) await page.goto(autosaveURL.create)
await page.waitForURL(`**/${autosaveURL.create}`) await page.waitForURL(`${autosaveURL.create}`)
await page.waitForURL(/\/(?!create$)[\w-]+$/) await page.waitForURL(/\/(?!create$)[\w-]+$/)
await page.locator('#field-title').fill('second post title') await page.locator('#field-title').fill('second post title')
await page.locator('#field-description').fill('second post description') await page.locator('#field-description').fill('second post description')
@@ -442,7 +442,7 @@ describe('versions', () => {
test('should save versions with custom IDs', async () => { test('should save versions with custom IDs', async () => {
await page.goto(customIDURL.create) await page.goto(customIDURL.create)
await page.waitForURL(`**/${customIDURL.create}`) await page.waitForURL(`${customIDURL.create}`)
await page.locator('#field-id').fill('custom') await page.locator('#field-id').fill('custom')
await page.locator('#field-title').fill('title') await page.locator('#field-title').fill('title')
await saveDocAndAssert(page) await saveDocAndAssert(page)