fix: global autosave and relevant e2e test

This commit is contained in:
Jessica Chowdhury
2023-11-03 16:38:43 +00:00
parent ea7ce6fd97
commit a9d96b1037
2 changed files with 24 additions and 8 deletions

View File

@@ -32,7 +32,13 @@ import { globalSlug } from '../admin/shared'
import { changeLocale, exactText, findTableCell, selectTableRow } from '../helpers'
import { AdminUrlUtil } from '../helpers/adminUrlUtil'
import { initPayloadE2E } from '../helpers/configHelpers'
import { autosaveSlug, draftGlobalSlug, draftSlug, titleToDelete } from './shared'
import {
autoSaveGlobalSlug,
autosaveSlug,
draftGlobalSlug,
draftSlug,
titleToDelete,
} from './shared'
const { beforeAll, describe } = test
@@ -228,6 +234,18 @@ describe('versions', () => {
expect(page.url()).toMatch(/\/versions$/)
})
test('global - should autosave', async () => {
const url = new AdminUrlUtil(serverURL, autoSaveGlobalSlug)
// fill out global title and wait for autosave
await page.goto(url.global(autoSaveGlobalSlug))
await page.locator('#field-title').fill('global title')
await wait(1000)
// refresh the page and ensure value autosaved
await page.goto(url.global(autoSaveGlobalSlug))
await expect(page.locator('#field-title')).toHaveValue('global title')
})
test('should retain localized data during autosave', async () => {
const locale = 'en'
const spanishLocale = 'es'