-
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
Add e2e tests for filtering and searching patterns #54906
Conversation
@@ -13,7 +13,7 @@ export interface SiteEditorQueryParams { | |||
postType: string; | |||
} | |||
|
|||
const CANVAS_SELECTOR = 'iframe[title="Editor canvas"i]'; | |||
const CANVAS_SELECTOR = 'iframe[title="Editor canvas"i] >> visible=true'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is because the patterns page doesn't have the regular editor canvas but has many disabled preview canvas.
await expect | ||
.poll( editor.getBlocks ) | ||
.toMatchObject( [ ...before, ...before ] ); | ||
.toEqual( [ ...before, ...before ] ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a nice cleanup after #54901 is merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 nice!
/** @type {ReturnType<typeof base.extend<{patterns: Patterns}>>} */ | ||
const test = base.extend( { | ||
patterns: async ( { page }, use ) => { | ||
await use( new Patterns( { page } ) ); | ||
}, | ||
} ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Mamaduka You might be interested to know how we can assign types and auto-complete to file-level fixtures in JS files. This is the simplest way I found. Unfortunately we were using .use
which isn't possible AFAIK. We might want to recommend .extend
from now on.
That said, this is totally optional though. It's for power users who like types and auto-complete in their code editors 😅 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, this is a nice one. Bookmarking it. Thanks, @kevin940726!
Maybe we can mention this in advance or a similar section. As you said, probably not every test needs it.
Size Change: +482 B (0%) Total Size: 1.62 MB
ℹ️ View Unchanged
|
Do you think we should add in the addition of a category into the I would be interested in your thoughts on this as I was thinking about this for the post editor pattern test, eg. is it better to isolate basic pattern add and the test for categories in separate tests, or is there enough of a performance advantage with including it in a single test to warrant a larger, slight more complex single test? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
@glendaviesnz do you think this is worth merging as is and we either add the proposed category test here or separately in a follow-up?
packages/e2e-test-utils-playwright/src/admin/visit-site-editor.ts
Outdated
Show resolved
Hide resolved
for sure, that question doesn't need to be a blocker, can easily be a follow-up. |
Co-authored-by: Aaron Robertshaw <[email protected]>
What?
Add e2e tests for filtering and searching patterns.
Why?
This is a critical path of the patterns page.
How?
Write tests 💪 .
I also smuggled some quick fixes here that I'll explain in inline comments later 🙈 .
Testing Instructions
CI should pass.
Testing Instructions for Keyboard
N/A
Screenshots or screencast
N/A