Repository navigation
Tests: Cover Import screen importer listing in admin E2E #15726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
shail-mehta
wants to merge
7
commits into
WordPress:trunk
from
shail-mehta:tests/52895-import-importers-e2e
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
df128c7
Tests: Cover Import screen importer listing and plugin install in adm…
shail-mehta cd8ce35
Merge branch 'trunk' into tests/52895-import-importers-e2e
shail-mehta 349fe19
Refactor visibility check for 'Run Importer' link
shail-mehta 4564c55
Tests:
shail-mehta d2adb7f
Tests: Retrigger CI after Composer network flake.
shail-mehta 46749be
Merge branch 'trunk' into tests/52895-import-importers-e2e
shail-mehta ccdcd2a
Tests: Drop live WordPress.org importer install from Import E2E.
shail-mehta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,56 @@ | ||
| /** | ||
| * WordPress dependencies | ||
| */ | ||
| import { test, expect } from '@wordpress/e2e-test-utils-playwright'; | ||
|
|
||
| const IMPORTER_SLUG = 'wordpress-importer'; | ||
| const IMPORTER_NAME = 'WordPress'; | ||
|
|
||
| /** | ||
| * Deletes the WordPress importer plugin if it is installed. | ||
| * | ||
| * @param {import('@wordpress/e2e-test-utils-playwright').RequestUtils} requestUtils REST helpers. | ||
| */ | ||
| async function deleteWordPressImporter( requestUtils ) { | ||
| const plugins = await requestUtils.rest( { path: '/wp/v2/plugins' } ); | ||
| const installed = plugins.find( ( item ) => | ||
| item.plugin.startsWith( `${ IMPORTER_SLUG }/` ) | ||
| ); | ||
| if ( ! installed ) { | ||
| return; | ||
| } | ||
| if ( installed.status !== 'inactive' ) { | ||
| await requestUtils.rest( { | ||
| method: 'PUT', | ||
| path: `/wp/v2/plugins/${ installed.plugin }`, | ||
| data: { status: 'inactive' }, | ||
| } ); | ||
| } | ||
| await requestUtils.rest( { | ||
| method: 'DELETE', | ||
| path: `/wp/v2/plugins/${ installed.plugin }`, | ||
| } ); | ||
| } | ||
|
|
||
| test.describe( 'Import', () => { | ||
| test.beforeEach( async ( { requestUtils } ) => { | ||
| await deleteWordPressImporter( requestUtils ); | ||
| } ); | ||
|
|
||
| test( 'lists popular importers with Install Now actions', async ( { | ||
| admin, | ||
| page, | ||
| } ) => { | ||
| await admin.visitAdminPage( 'import.php' ); | ||
|
|
||
| await expect( | ||
| page.getByRole( 'heading', { name: 'Import', exact: true } ) | ||
| ).toBeVisible(); | ||
| await expect( | ||
| page.getByRole( 'link', { | ||
| name: `Install ${ IMPORTER_NAME } now`, | ||
| exact: true, | ||
| } ) | ||
| ).toBeVisible(); | ||
| } ); | ||
| } ); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.