-
Notifications
You must be signed in to change notification settings - Fork 219
E2E: Refactor Mini Cart to be ready for fully parallel #10704
Conversation
The release ZIP for this PR is accessible via:
Script Dependencies ReportThere is no changed script dependency between this branch and trunk. This comment was automatically generated by the TypeScript Errors Report
🎉 🎉 This PR does not introduce new TS errors. |
Size Change: 0 B Total Size: 1.43 MB
ℹ️ View Unchanged
|
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.
Thanks for working on this, @dinhtungdu! I've successfully tested this change and noticed that the tests are superfast when being executed in parallel. Well done! 👏 I hope we can soon activate the parallel execution of all our E2E tests (except the side-effect-related ones). 😀
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.
The changes to the mini cart test look great, but not super sure about the added utils. We're just re-running tests on #10561 so when they pass, I'll merge it, maybe you can rebase once that's merged and make use of the auth states?
tests/e2e/utils/use-incognito.ts
Outdated
const getFreshSession = () => { | ||
return { | ||
cookies: [], | ||
origins: [], | ||
}; | ||
}; | ||
|
||
export const useIncognito = ( test: typeof Test ) => { | ||
test.use( { | ||
storageState: getFreshSession(), | ||
} ); | ||
}; |
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.
I don't think this abstraction is really necessary. We're adding functions for something that can be done in a single line anyway.
test. use( storageState: { cookies: [], origins: [] } );
Also, the naming implies it's opening an incognito window which may confuse folks in the future, and also since it's using test.use
it can only be executed at the describe
level, not within a test itself, so it may cause further confusion.
I think we should drop this.
Moreover, in #10561 we are adding auth states, so we can instead do: test.use( { storageState: guestFile } );
to get a guest session.
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.
Hmm, @dinhtungdu looks like we're not going to get #10561 merged today it seems there's some more work to do on it, so I'd be fine with you skipping waiting for that and just getting it working.
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.
You're right. I removed the utility and added comment explaining the reason.
About the using the guest file, I think it will prevent tests run in isolation because we're reusing the context. That's why I use an empty object for the state (and was over optimized by using a function to ensure the new object every time). I will verify this again when the @tarhi-saad PR is merged.
As mentioned in the code comment, I think tests should run in isolation by default, so we shouldn't use the storageState
file in the main config. We can revisit this topic later when tests can be run in isolation are ready for isolation.
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.
Code changes look good! Thanks for taking my feedback into account.
The markdown link checking is due to rate limiting I think, so happy to merge even with that failing.
I think tests should run in isolation by default, so we shouldn't use the storageState file in the main config
You mean in playwright.config.js
the STORAGE_STATE
there? Yea I agree on that.
* Add initial look of Full Grid Product Collection pattern * Refactor textAlign property of Product Button so it uses flex rather than text-align * Update Product Button text align after the fix * Remove debug log (#10719) * Add Product Collection Grid pattern (#10660) * Dispatch the `wc-blocks_render_blocks_frontend` event when rendering the empty cart block (#10619) * E2E: Refactor Mini Cart to be ready for fully parallel (#10704) * Revert dequeue add-to-cart-variation script which is needed to properly handle variable products in single product page (#10723) * Update alignment options to new setting --------- Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com> Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Add initial look of Full Grid Product Collection pattern * Refactor textAlign property of Product Button so it uses flex rather than text-align * Update Product Button text align after the fix * Remove debug log (#10719) * Add Product Collection Grid pattern (#10660) * Dispatch the `wc-blocks_render_blocks_frontend` event when rendering the empty cart block (#10619) * E2E: Refactor Mini Cart to be ready for fully parallel (#10704) * Revert dequeue add-to-cart-variation script which is needed to properly handle variable products in single product page (#10723) * Update alignment options to new setting --------- Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com> Co-authored-by: Tung Du <dinhtungdu@gmail.com>
What
This PR:
useIncognito()
util for running tests in isolation.Why
Testing Instructions
Please consider any edge cases this change may have, and also other areas of the product this may impact.
tests/e2e/playwright.config.ts
:npm run test:e2e tests/e2e/tests/mini-cart/mini-cart.block_theme.spec.ts
.WooCommerce Visibility
Required:
Checklist
Required:
[type]
label or a[skip-changelog]
label.Conditional:
[skip-changelog]
label is not present).Changelog