Add e2e tests for filtering and searching patterns#54906
Conversation
| } | ||
|
|
||
| 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.
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.
This is just a nice cleanup after #54901 is merged.
| /** @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.
@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.
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? |
aaronrobertshaw
left a comment
There was a problem hiding this comment.
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?
for sure, that question doesn't need to be a blocker, can easily be a follow-up. |
Co-authored-by: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com>
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