-
Notifications
You must be signed in to change notification settings - Fork 446
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(dev): add media plugin to studio e2e & test (#7236)
* test(dev): add media plugin to studio e2e * test(dev): add test * test: update test id * test(e2e): update e2e media tests
- Loading branch information
Showing
4 changed files
with
65 additions
and
20 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,31 @@ | ||
import {expect} from '@playwright/test' | ||
import {test} from '@sanity/test' | ||
|
||
test('media plugin should open from input', async ({page, createDraftDocument}) => { | ||
await createDraftDocument('/test/content/input-standard;imagesTest') | ||
|
||
// wait for input to be visible | ||
await expect(await page.getByTestId('change-bar__field-wrapper').nth(2)).toBeVisible() | ||
|
||
// wait for menu to be visible and click menu button | ||
await expect(await page.locator('#mainImage_assetImageButton')).toBeVisible() | ||
await page.locator('#mainImage_assetImageButton').click() | ||
|
||
// wait for menu to open, click the menu item for media | ||
await expect(await page.getByTestId('file-input-browse-button-media')).toBeVisible() | ||
await page.getByTestId('file-input-browse-button-media').click() | ||
|
||
// check that it didn't crash | ||
await expect(await page.getByRole('button', {name: 'Insert image imagesTest'})).toBeVisible() | ||
}) | ||
|
||
test('open media plugin from navbar', async ({page, createDraftDocument}) => { | ||
await createDraftDocument('/test/') | ||
await expect(page.getByTestId('parent-config-studio-tool-menu')).toBeVisible() | ||
|
||
// click media plugin | ||
await page.getByRole('link', {name: 'Media'}).click() | ||
|
||
// check that it didn't crash | ||
await expect(await page.getByRole('button', {name: 'Browse Assets Upload assets'})).toBeVisible() | ||
}) |