Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): fetch inspect mode from backend (#5938)
- Loading branch information
1 parent
ffdc66a
commit edea1f6
Showing
3 changed files
with
39 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import {expect} from '@playwright/test' | ||
import {test} from '@sanity/test' | ||
|
||
const INSPECT_KEY = 'studio.structure-tool.inspect-view-mode' | ||
|
||
test('clicking inspect mode sets value in storage', async ({ | ||
page, | ||
sanityClient, | ||
createDraftDocument, | ||
}) => { | ||
await createDraftDocument('/test/content/book') | ||
await page.getByTestId('document-pane').getByTestId('pane-context-menu-button').click() | ||
await page.getByRole('menuitem', {name: 'Inspect Ctrl Alt I'}).click() | ||
|
||
await page.getByRole('tab', {name: 'Raw JSON'}).click() | ||
const rawResult = await sanityClient.request({ | ||
uri: `/users/me/keyvalue/${INSPECT_KEY}`, | ||
withCredentials: true, | ||
}) | ||
expect(rawResult[0]).toMatchObject({ | ||
key: INSPECT_KEY, | ||
value: 'raw', | ||
}) | ||
|
||
await page.getByRole('tab', {name: 'Parsed'}).click() | ||
const parsedResult = await sanityClient.request({ | ||
uri: `/users/me/keyvalue/${INSPECT_KEY}`, | ||
withCredentials: true, | ||
}) | ||
|
||
expect(parsedResult[0]).toMatchObject({ | ||
key: INSPECT_KEY, | ||
value: 'parsed', | ||
}) | ||
}) |