Commit Graph

57 Commits

Author SHA1 Message Date
Thomas Roberts 1a0b432669 Ensure cart changes remain after using back button to get back to the cart (https://github.com/woocommerce/woocommerce-blocks/pull/3960)
* Add cartUpdate middleware

* Include timestamp for when cart data was generated

* Add getCartFromApi action

* Check whether cart can be hydrated or needs to be fetched from API

* Add cartDataIsStale action and remove getCartFromApi action

* Add isCartDataStale selector

* Don't load cart until staleness check is complete

* Add comment to ease worry about locaStorage execution

* Correct doc block and fix typographical error

* Cater for lastCartUpdate or the timestamp being undefined

* Include @woocommerce/api and @woocommerce/e2e-utils

* Add getNormalPagePermalink test utility

This will allow us to get the permalink of a "normal" page, i.e. one that is not using the block editor.

* Add getBlockPagePermalink test utility

This will get the permalink for a page using the Block editor.

* Emit action to update cart staleness in all execution paths

* Add visitPostOfType function

This will allow us to visit the editor page for a post based on its name and post type.

* Add functions to get permalinks from editor pages

* Add front-end tests for cart

* Update package-lock.json

* Create local function to ensure the page permalink is visible

* Change functions for getting permalinks
They were often failing for unknown reasons, these _somehow_ make them more stable.

* Add logging for GitHub actions

* Add more logging for tests

* Add more logging for tests

* Add more logging for tests

* Wait for networkidle on back

* Remove logging except timestamp

* Wait for timestamp to be added to localStorage

* Split tests to make runs slightly shorter

* Wait for add to cart request before continuing test

* Fix formatting in cart.test.js

* Rename cartDataStale to setIsCartDataStale

* Create constant for localStorage timestamp name

* Rename cartDataIsStale to isCartDataStale

This is for consistency, the action to change this is called setIsCartDataStale - I think this reads better.

* Use cleaner logic when determining if the cart should render or fetch

* Change docblock for isCartDataStale selector

* Remove boolean cast from SET_IS_CART_DATA_STALE reducer

* Set longer timeouts for frontend cart tests

* Enclose cart staleness checks in condition/prevent unnecessary execution

* Remove unnecessary boolean cast from selector

* Use constant for local storage key in tests

* Use new localstorage key in tests. cant access constants in page context
2021-03-24 13:28:11 +00:00
Darren Ethier 9115160c2f Enable and fix all jsdoc rule violations (https://github.com/woocommerce/woocommerce-blocks/pull/3168)
* add param jsdocs to satisfy jsdoc require-param rule

* Fix jsdoc-checktypes rule violations

* fix jsdoc/require-param-type rule violations

* fix jsdoc/check-param-names violations

* fix jsdoc/require-property-description rule violations

* fix rule violations for jsdoc/valid-types rule

* fix rule violations for jsdoc/require-property rule

* fix jsdoc/no-undefined-types rule violations

* fix jsdoc/check-types rule violations

* fix jsdoc/require-returns-description rule violation

* enable jsdoc/require-returns-type rule

* fix jsdoc/newline-after-description rule violations
2020-09-20 19:54:08 -04:00
Albert Juhé Lluveras 727935f04c Add several tests to Checkout block in the editor (https://github.com/woocommerce/woocommerce-blocks/pull/3058)
* Add several tests to Checkout block in the editor

* Avoid 'visibility' word for toToggleElement rule

* Refactor matchers so they receives the label instead of the text

* Make initial 'isRequired' optional

* Refactor code that produces two clicks to DRY

* Unify error messages
2020-09-14 09:46:58 +02:00
Albert Juhé Lluveras 8ace5dbcf8 Add attributes and view toggle tests to the Cart block (https://github.com/woocommerce/woocommerce-blocks/pull/2883)
* Add more tests to the Cart block

* Add page settings

* Cleanup
2020-07-29 14:39:15 +01:00
Darren Ethier 19ab667672 implement `page.waitForNavigation` for handling the page load after clicking the search submit (https://github.com/woocommerce/woocommerce-blocks/pull/2769) 2020-06-23 10:38:48 -04:00
Darren Ethier 1953d4f96a remove unnecessary await (https://github.com/woocommerce/woocommerce-blocks/pull/2764) 2020-06-23 09:22:18 -04:00
Seghir Nadir dbd3c7ef16 Generate block pages for tests. (https://github.com/woocommerce/woocommerce-blocks/pull/2707)
* add util folder and add util to generate pages

* add loader to insert and remove pages

* update tests to use the new page creator

* refactor tests to not create pages

* remove fullscreen check

* update single product test.

The test kept failing for me locally (it wasn’t deleting the block), when I manually tested following the same manual steps would not delete the block.

* add `quiet-pull` flag to docker command to hopefully reduce noice on builds

* adjust page loader to simplfy the loop

* remove extra comment

* add docs

* move promise inside map

Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
2020-06-15 15:59:18 +01:00