#49507 closed enhancement (fixed)
Add end-to-end tests for edit posts page
Reported by: | talldanwp | Owned by: | hellofromTonya |
---|---|---|---|
Milestone: | 5.9 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Build/Test Tools | Keywords: | has-patch has-unit-tests commit |
Focuses: | Cc: |
Description
It'd be great to explore adding more e2e tests for WordPress, and the edit posts/all posts page seems like a good place to start.
I've written a few of these in Gutenberg and I'd like to work on adding some for core.
Change History (17)
This ticket was mentioned in Slack in #hosting-community by mike. View the logs.
5 years ago
This ticket was mentioned in PR #200 on WordPress/wordpress-develop by talldan.
5 years ago
#2
This ticket was mentioned in PR #1089 on WordPress/wordpress-develop by tellthemachines.
4 years ago
#3
- Keywords has-patch has-unit-tests added
Sequel to #200, fixes element targeting issues in some of the tests.
Trac ticket: https://core.trac.wordpress.org/ticket/49507
4 years ago
#4
Should this be closed in favour of https://github.com/WordPress/wordpress-develop/pull/1089? Thinking 1089 is ready to go in, all tests green :)
JustinyAhin commented on PR #1089:
3 years ago
#6
I've run the tests, and they work as expected.
@tellthemachines I was wondering, does it make sense to add a README to the e2e folder with information about how to run the test, how to enable headless mode for the tests for instance?
Also, what does this needs to get merged?
This ticket was mentioned in PR #1231 on WordPress/wordpress-develop by JustinyAhin.
3 years ago
#7
Trac ticket: https://core.trac.wordpress.org/ticket/49507
3 years ago
#8
There's a README over here @JustinyAhin - https://github.com/WordPress/wordpress-develop/pull/1451.
hellofromtonya commented on PR #1089:
3 years ago
#9
@tellthemachines @talldan Is this PR ready for commit
? Does it overlap any of the work that @JustinyAhin is doing?
tellthemachines commented on PR #1089:
3 years ago
#10
@hellofromtonya yup, this one's ready to go. It doesn't overlap with Justin's PRs as this is specific to the posts screen and Justin has been focusing on other screens so far.
#11
@
3 years ago
- Keywords commit added
- Milestone changed from Future Release to 5.9
- Owner changed from talldanwp to hellofromTonya
- Status changed from assigned to reviewing
As part of 5.9's e2e roadmap, moving this ticket into 5.9. As the PR is ready to go, marking it for commit
and assigning it to me to do the commit.
hellofromtonya commented on PR #1089:
3 years ago
#12
When running this test locally (via npm run test:e2e
), I get the following error:
FAIL tests/e2e/specs/edit-posts.test.js (76.359 s) ● Edit Posts › allows an existing post to be edited using the Edit button TimeoutError: waiting for selector `.components-snackbar` failed: timeout 30000ms exceeded 44 | const title = 'Test Title'; 45 | await createNewPost( { title } ); > 46 | await publishPost(); | ^ 47 | await visitAdminPage( '/edit.php' ); 48 | 49 | await page.waitForSelector( '#the-list .type-post' ); at new WaitTask (../../node_modules/puppeteer-core/src/common/DOMWorld.ts:780:28) at DOMWorld.waitForSelectorInPage (../../node_modules/puppeteer-core/src/common/DOMWorld.ts:632:22) at Object.internalHandler.waitFor (../../node_modules/puppeteer-core/src/common/QueryHandler.ts:78:19) at DOMWorld.waitForSelector (../../node_modules/puppeteer-core/src/common/DOMWorld.ts:490:25) at Frame.waitForSelector (../../node_modules/puppeteer-core/src/common/FrameManager.ts:1163:47) at Page.waitForSelector (../../node_modules/puppeteer-core/src/common/Page.ts:2100:29) at publishPost (../../node_modules/@wordpress/e2e-test-utils/build/@wordpress/e2e-test-utils/src/publish-post.js:19:14) at runMicrotasks (<anonymous>) at Object.<anonymous> (specs/edit-posts.test.js:46:3) ● Edit Posts › allows an existing post to be deleted using the Trash button TimeoutError: waiting for selector `.components-snackbar` failed: timeout 30000ms exceeded 110 | const title = 'Test Title'; 111 | await createNewPost( { title } ); > 112 | await publishPost(); | ^ 113 | await visitAdminPage( '/edit.php' ); 114 | 115 | await page.waitForSelector( '#the-list .type-post' ); at new WaitTask (../../node_modules/puppeteer-core/src/common/DOMWorld.ts:780:28) at DOMWorld.waitForSelectorInPage (../../node_modules/puppeteer-core/src/common/DOMWorld.ts:632:22) at Object.internalHandler.waitFor (../../node_modules/puppeteer-core/src/common/QueryHandler.ts:78:19) at DOMWorld.waitForSelector (../../node_modules/puppeteer-core/src/common/DOMWorld.ts:490:25) at Frame.waitForSelector (../../node_modules/puppeteer-core/src/common/FrameManager.ts:1163:47) at Page.waitForSelector (../../node_modules/puppeteer-core/src/common/Page.ts:2100:29) at publishPost (../../node_modules/@wordpress/e2e-test-utils/build/@wordpress/e2e-test-utils/src/publish-post.js:19:14) at runMicrotasks (<anonymous>) at Object.<anonymous> (specs/edit-posts.test.js:112:3) PASS tests/e2e/specs/dashboard.test.js PASS tests/e2e/specs/hello.test.js Test Suites: 1 failed, 2 passed, 3 total Tests: 2 failed, 6 passed, 8 total Snapshots: 0 total Time: 79.215 s
@tellthemachines Does it pass locally for you?
hellofromtonya commented on PR #1089:
3 years ago
#13
When running this test locally (via npm run test:e2e
), I get the following error:
FAIL tests/e2e/specs/edit-posts.test.js (76.359 s) ● Edit Posts › allows an existing post to be edited using the Edit button TimeoutError: waiting for selector `.components-snackbar` failed: timeout 30000ms exceeded 44 | const title = 'Test Title'; 45 | await createNewPost( { title } ); > 46 | await publishPost(); | ^ 47 | await visitAdminPage( '/edit.php' ); 48 | 49 | await page.waitForSelector( '#the-list .type-post' ); at new WaitTask (../../node_modules/puppeteer-core/src/common/DOMWorld.ts:780:28) at DOMWorld.waitForSelectorInPage (../../node_modules/puppeteer-core/src/common/DOMWorld.ts:632:22) at Object.internalHandler.waitFor (../../node_modules/puppeteer-core/src/common/QueryHandler.ts:78:19) at DOMWorld.waitForSelector (../../node_modules/puppeteer-core/src/common/DOMWorld.ts:490:25) at Frame.waitForSelector (../../node_modules/puppeteer-core/src/common/FrameManager.ts:1163:47) at Page.waitForSelector (../../node_modules/puppeteer-core/src/common/Page.ts:2100:29) at publishPost (../../node_modules/@wordpress/e2e-test-utils/build/@wordpress/e2e-test-utils/src/publish-post.js:19:14) at runMicrotasks (<anonymous>) at Object.<anonymous> (specs/edit-posts.test.js:46:3) ● Edit Posts › allows an existing post to be deleted using the Trash button TimeoutError: waiting for selector `.components-snackbar` failed: timeout 30000ms exceeded 110 | const title = 'Test Title'; 111 | await createNewPost( { title } ); > 112 | await publishPost(); | ^ 113 | await visitAdminPage( '/edit.php' ); 114 | 115 | await page.waitForSelector( '#the-list .type-post' ); at new WaitTask (../../node_modules/puppeteer-core/src/common/DOMWorld.ts:780:28) at DOMWorld.waitForSelectorInPage (../../node_modules/puppeteer-core/src/common/DOMWorld.ts:632:22) at Object.internalHandler.waitFor (../../node_modules/puppeteer-core/src/common/QueryHandler.ts:78:19) at DOMWorld.waitForSelector (../../node_modules/puppeteer-core/src/common/DOMWorld.ts:490:25) at Frame.waitForSelector (../../node_modules/puppeteer-core/src/common/FrameManager.ts:1163:47) at Page.waitForSelector (../../node_modules/puppeteer-core/src/common/Page.ts:2100:29) at publishPost (../../node_modules/@wordpress/e2e-test-utils/build/@wordpress/e2e-test-utils/src/publish-post.js:19:14) at runMicrotasks (<anonymous>) at Object.<anonymous> (specs/edit-posts.test.js:112:3) PASS tests/e2e/specs/dashboard.test.js PASS tests/e2e/specs/hello.test.js Test Suites: 1 failed, 2 passed, 3 total Tests: 2 failed, 6 passed, 8 total Snapshots: 0 total Time: 79.215 s
@tellthemachines Does it pass locally for you?
tellthemachines commented on PR #1089:
3 years ago
#14
@hellofromtonya it passes for me! I rebased the branch in case it helps at all.
hellofromtonya commented on PR #1089:
3 years ago
#16
Committed via changeset https://core.trac.wordpress.org/changeset/51990.
## Description
Fixes https://core.trac.wordpress.org/ticket/49507
Adds e2e tests for the edit posts page. This is currently a work in progress and not quite ready for review.