-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
…antly from trash
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); | ||
|
||
test.describe( 'Undo trashed & delete posts permanantly from Trash', () => { | ||
const POST_TITLE = 'Test Title'; | ||
|
||
test.beforeEach( async ( { requestUtils, editor, admin } ) => { | ||
await requestUtils.deleteAllPosts(); | ||
await admin.createNewPost( { postType: 'post', title: POST_TITLE } ); | ||
Check failure on line 11 in tests/e2e/specs/posts/restore-from-trash-empty-trash.test.js GitHub Actions / Test with SCRIPT_DEBUG disabled / Run E2E tests[chromium] › posts/restore-from-trash-empty-trash.test.js:15:2 › Undo trashed & delete posts permanantly from Trash › Restore trash post
Check failure on line 11 in tests/e2e/specs/posts/restore-from-trash-empty-trash.test.js GitHub Actions / Test with SCRIPT_DEBUG disabled / Run E2E tests[chromium] › posts/restore-from-trash-empty-trash.test.js:15:2 › Undo trashed & delete posts permanantly from Trash › Restore trash post
Check failure on line 11 in tests/e2e/specs/posts/restore-from-trash-empty-trash.test.js GitHub Actions / Test with SCRIPT_DEBUG enabled / Run E2E tests[chromium] › posts/restore-from-trash-empty-trash.test.js:15:2 › Undo trashed & delete posts permanantly from Trash › Restore trash post
Check failure on line 11 in tests/e2e/specs/posts/restore-from-trash-empty-trash.test.js GitHub Actions / Test with SCRIPT_DEBUG enabled / Run E2E tests[chromium] › posts/restore-from-trash-empty-trash.test.js:15:2 › Undo trashed & delete posts permanantly from Trash › Restore trash post
|
||
await editor.publishPost(); | ||
Check failure on line 12 in tests/e2e/specs/posts/restore-from-trash-empty-trash.test.js GitHub Actions / Test with SCRIPT_DEBUG disabled / Run E2E tests[chromium] › posts/restore-from-trash-empty-trash.test.js:15:2 › Undo trashed & delete posts permanantly from Trash › Restore trash post
|
||
} ); | ||
|
||
test( 'Restore trash post', async ( { page, admin, editor } ) => { | ||
await admin.visitAdminPage( '/edit.php' ); | ||
|
||
// Move one post to trash. | ||
await page.hover( `[aria-label^="“${ POST_TITLE }”"]` ); | ||
await page | ||
.getByRole( `link`, { | ||
name: `Move “${ POST_TITLE }” to the Trash`, | ||
} ) | ||
.first() | ||
.click(); | ||
|
||
await expect( page.locator( '.no-items' ) ).toHaveText( | ||
'No posts found.' | ||
); | ||
// Remove post from trash. | ||
await page.getByRole( 'link', { name: 'Undo' } ).click(); | ||
|
||
await expect( page.locator( '#message p' ) ).toHaveText( | ||
'1 post restored from the Trash.' | ||
); | ||
} ); | ||
|
||
test( 'Empty Trash', async ( { page, admin, editor } ) => { | ||
await admin.visitAdminPage( '/edit.php' ); | ||
|
||
// Move post to trash | ||
await page.hover( `[aria-label^="“${ POST_TITLE }”"]` ); | ||
await page | ||
.getByRole( `link`, { | ||
name: `Move “${ POST_TITLE }” to the Trash`, | ||
} ) | ||
.first() | ||
.click(); | ||
|
||
await page.getByRole( 'link', { name: 'Trash' } ).click(); | ||
|
||
// Delete all post. | ||
await page | ||
.getByRole( 'button', { name: 'Empty Trash' } ) | ||
.first() | ||
.click(); | ||
|
||
await expect( page.locator( '#message' ) ).toHaveText( | ||
/\d+ posts? permanently deleted\./ | ||
); | ||
} ); | ||
} ); |