Skip to content

Commit

Permalink
test(e2e): add e2e test to check banner exists
Browse files Browse the repository at this point in the history
  • Loading branch information
RitaDias committed Sep 19, 2024
1 parent dacbac9 commit cf5d7be
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/e2e/tests/desk/liveEditDraft.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* eslint-disable max-nested-callbacks */
import {expect, test} from '@playwright/test'

import {createUniqueDocument, withDefaultClient} from '../../helpers'

withDefaultClient((context) => {
test.describe('sanity/structure: document pane', () => {
test('on live edit document with a draft, a banner should appear', async ({page}) => {
// create published document
const uniqueDoc = await createUniqueDocument(context.client, {_type: 'playlist'})
const id = uniqueDoc._id!

// create draft document
await createUniqueDocument(context.client, {
_type: 'playlist',
_id: `drafts.${id}`,
name: 'Edited by e2e test runner',
})

await page.goto(`/test/content/playlist;${id}`)

await expect(page.getByTestId('document-panel-scroller')).toBeAttached()
await expect(page.getByTestId('string-input')).toBeAttached()

// checks that inputs are set to read only
await expect(await page.getByTestId('string-input')).toHaveAttribute('readonly', '')
// checks that the banner is visible
await expect(page.getByTestId('live-edit-type-banner')).toBeVisible()
})
})
})

0 comments on commit cf5d7be

Please sign in to comment.