-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Fix Post Template Editor e2e test - Templates tab missing #32887
Conversation
Avoid relying on developer APIs such as classnames to select things.
Size Change: 0 B Total Size: 1.04 MB ℹ️ View Unchanged
|
Ironically this PR is now failing at the exact same point. Wasn't happening locally so need to dive deeper... |
The CI test runner artifacts show that the page doesn't contain the |
Seems likely that it's gutenberg/packages/edit-post/src/components/sidebar/template/index.js Lines 47 to 48 in 77bc9ca
This is determined by a response from the network. Possibly https://developer.wordpress.org/rest-api/reference/post-types/ (see wp.apiFetch({path: '/wp/v2/types/post?context=view'}).then((res) => console.log(res)); Note that when context is wp.apiFetch({path: '/wp/v2/types/post?context=edit'}).then((res) => console.log(res)); However, when context is |
This reverts commit eb9d2e4.
Closing in favour of #32904 |
Avoid relying on developer APIs such as classnames to select things.
Description
The PR attempts to resolve the current failures on
End-to-End Tests / Admin - 4 (pull_request)
around the Post Editor Template mode.Post Editor Template mode › Allow creating custom block templates in classic themes
Post Editor Template mode › Allow to switch to template mode, edit the template and check the result
Currently, tests are failing because the e2e test tries to select an element using two classnames...
gutenberg/packages/e2e-tests/specs/experiments/post-editor-template-mode.test.js
Lines 15 to 17 in aefdcfe
...one of which
components-panel__body-toggle
no longer exists:This PR utilises user-perceivable means of selecting the correct button without relying on developer focused APIs such as classnames. Over reliance on such developer focused APIs makes test extremely brittle because classnames might be an API of a lower level component which might change at any point.
How has this been tested?
Run
npm run test-e2e:watch packages/e2e-tests/specs/experiments/post-editor-template-mode.test.js
or
npm run test-e2e:watch -- --puppeteer-interactive packages/e2e-tests/specs/experiments/post-editor-template-mode.test.js
Check they pass correctly.
Screenshots
Here's a broken test from #32761
Types of changes
Checklist:
*.native.js
files for terms that need renaming or removal).