Commit Graph

54 Commits

Author SHA1 Message Date
Tom Cafferkey 6fb43ed8cb Deprecate legacy filter widgets with block alternatives (https://github.com/woocommerce/woocommerce-blocks/pull/6299)
* Transform object for woocommerce_price_filter legacy widget to be replaced with block alternative

* Filter products by price transform

* Price Filter formatting

* Set set_filterable_product_data data on the widgets screen

* Prevent rendering the Price Filter block if there are no products to filter

* Prevent Classic Price Filter Widget from being available as a widget

* Transform layered nav classic widget to attribute filter block

* Allow Filter Products by Stock block to be added as a widget

* Allow Active Filters widget to be transformed to Active Filters block

* Set showFilterButton to true and showInputFields to false in the transform of Price Filter to minic widgets more

* Change displayStyle property to be display_type instead of incorrectly using title

* mock @woocommerce/settings for has_filterable_products setting

* try: add All Products block to render that filter on the front end

* Revert "try: add All Products block to render that filter on the front end"

This reverts commit 5ad09e964b77e5c6499b4134cf58d7a6c226424d.

* try: add all product block to bypass has_filterable_products check

* fix: backend e2e test for attribute filter

Co-authored-by: Tung Du <dinhtungdu@gmail.com>
2022-04-27 08:36:00 +01:00
Luigi Teschio bac2c59daa Add Product Search Results Template (https://github.com/woocommerce/woocommerce-blocks/pull/6219)
* Add Search Result Product Template woocommerce/woocommerce-blocks#6218

Add Search Result Product Template

* update title

* add E2E test for Product Search Results template

* renaming class

* update E2E tests
2022-04-14 11:45:00 +02:00
Mike Jolley eb196226d8 WIP: Add Inner blocks to order summary (https://github.com/woocommerce/woocommerce-blocks/pull/6065)
* Sub/Total/Fee inner blocks

* Row blocks within the inner block

* Update icons

* Resolve stying issues

* Remove old block

* Pin totals row

* Locking logic update

* Heading inner block

* Refactor where inner blocks are defined

* Add todos

* Todo for Consider deprecating OrderMetaSlotFill and DiscountSlotFill in favour of inner block areas.

* Improve frontend registration of components using new entrypoint

* Experiment- external block context

* Revert "Experiment- external block context"

This reverts commit 4b75668ec7eb62f065c6a488cd942a666e26204f.

* Duplicate inner blocks to avoid conflicts with context

* Remove todo

* Rename block dir

* Some test fixes

* Fix import

* fix import

* linting

* Remove unused attributes

* Optional classname

* fix coupons import

* fix shipping mocks

* Styling

* Fix selectors in e2e tests

* Add back the wc-block-components-totals-wrapper class that was used for each segment in the totals Order summary

Because, removing them was:
-  a breaking change for the old structure
- was making it harder to target the inner blocks. Before the class was used to target each segment
- it was making the wc-block-components-totals-item behave as a child or parent depending on the inner block, inconsitency

* Reuse the TotalsWrapper component for C& C blocks inner blocks

This component was removed in this PR, but  we wrap components in the Cart and Checkout sidebar in a TotalsWrapper. This will ensure consistent spacing and borders are applied to items in the sidebar.

Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
Co-authored-by: Raluca Stan <ralucastn@gmail.com>
2022-04-01 15:45:18 +02:00
Luigi Teschio 4f2f267cf8 Add tests for the Mini Cart Block when it is added on the FSE editor. (https://github.com/woocommerce/woocommerce-blocks/pull/6000)
* Add tests for the Mini Cart Block when it is added on the FSE editor woocommerce/woocommerce-blocks#5727

Add tests for the Mini Cart Block when it is added on the FSE editor

* not hardcoding selectors

* fix typo

* restore old searchForBlock function

* add export

* Revert "restore old searchForBlock function"

This reverts commit 7049ad85bc2752ad33933eec00da9682943ec35a.

* use searchForBlock from package only for FSE pages

* add fix for GB
2022-04-01 11:23:48 +02:00
Tomasz Tunik e821983447 Improve goToSiteEditor E2E utils (https://github.com/woocommerce/woocommerce-blocks/pull/6109)
* dry getAllTemplates util

* Improve goToSiteEditor e2e util

It will now properly wait for page to load
and critical parts to be available before
handing control over to the next steps

* adapt site editing tests to new goToSiteEditor API

* try to stabilize the saveTemplate

to early navigation was causing the dreaded
"Expected an Error, but "" was thrown"

* try stabilizing saveTemplate

* contextually group/sort params

* improve clarity of the goToSiteEditor E2E util

- adds goToSiteEditor private helper that hides the temporary need
for handling theme.php and site-editor.php paths
- adds two exported utils goToTemplatesList and goToTemplateEdit
that hide UX details of waiting ofr page to be ready on load including special
case for waitingFor templates list actions to be loaded

* put back page where it belongs 
2022-03-28 14:32:15 +02:00
Tung Du 7d60c8fc66 Fix: Mini Cart: Ability to choose the drawer behavior when user add products to cart (https://github.com/woocommerce/woocommerce-blocks/pull/6052) 2022-03-26 07:32:23 +07:00
Tomasz Tunik fdb8dde033 Fix site editor E2E tests for Gutenberg latest (https://github.com/woocommerce/woocommerce-blocks/pull/6080)
* Add handling of editor context via GUTENBERG_EDITOR_CONTEXT env var
* Fix flaky tests around editing templates
* Wait for save template response to complete
2022-03-23 14:18:00 +01:00
Alba Rincón 13311e7bee Rename Legacy Template block to Classic Template block (https://github.com/woocommerce/woocommerce-blocks/pull/6021)
The internal ID has been kept after a comment by @tjcafferkey. This causes a
bit of inconsistency in the internal code, but it was deemed that it would have
been better as users who have customized templates using this
blocks ID will have saved this in their database, and it would result
in a corrupt block when loaded, and we didn't want to support both IDs at the
moment.

Otherwise, most other references to the legacy template, are now using the word
“classic”.

Co-authored-by: Alba Rincón <alba@albasauatticmbp.home>
2022-03-22 23:34:43 +01:00
Tomasz Tunik f15d628610 Fix 404 and 500 errors in E2E test logs, editor and front-end. (https://github.com/woocommerce/woocommerce-blocks/pull/5989)
* Change atomic blocks to not use custom webpack build paths

we want to always load lazy loaded components from their default paths
to avoid having to handle importing components in different ways for
regular and atomic component packages

* Add footer parts to test themes

The Site Editor is expecting the footer parts to be there or it will try to
load them anyways and throw a 404. It's not breaking, but it's polluting
the console.

* Use REST API to tear down the templates

Previously, we used a util called `trashAllPosts` which navigated to the post UI
and deleted all the posts to tear down any side-effects of template editing tests.

However, with a [recent change](14e20f72b5),
WP Core removed the UI for those and that made our tests meet a 500 error.

Using the REST API should also make everything faster.

* Remove deprecated pupeteer waitFor usage

was still present in attribute-filter.test.js

* Update package-lock.json

* pin package versions

* Unify all atomic blocks to register on php side

* Remove Atomic Blcoks chunk_translation handling from AllBlocks

Before it was responsible for enabling translations for all the atomic blocks

* Add per atomic block chunk_translation registration

* update @wordpress/e2e-test-utils to 6.0.2

* add optional puppeteer

* pin workflows node version to 16.13.2

* upgrade package-lock

* upgrade package-lock

* set react and react-dom as peerDeps

* remove atomic block registration

Co-authored-by: Lucio Giannotta <lucio.giannotta@a8c.com>
Co-authored-by: Luigi <gigitux@gmail.com>
2022-03-10 11:00:23 +01:00
Alex Florisca 2e674dd6c0 Critical flow: Can see correct tax (https://github.com/woocommerce/woocommerce-blocks/pull/5900)
* Tax is displayed correctly e2e test

* Add extra utils to shopper

* add single e2e test script oin package.json

* Feedback changes from Niels

* Test tax is correct on summary page

* Check if CI test passes

* Longer timeout for tax test

* change timeout in jest config

* increate jest timeout

* Test

* Test

* Test

* setTimeout outside of tests to 120000

* Address raluca's feedback and timeout everywheregaa

* Increase timeout on  for search box

* set jest timeout to 120000

* Raluca's suggestions

* Debug

* Increase search timeout to 5000

* Only run Tax e2e tests in CI for quicker debug - REMOVE THIS

* use waitforSelector

* 30s delay for toMatchElement

* Let'shope this works

* Remove toMatchElement

* waitForSelector

* Run debug test only

* Debug tax test

* debug taxes

* shopper using toMatchElement again

* Remove the 30000 timeout delay from toMatchElement

* Run all tests but only once

* Remove tax test

* Revert "Remove tax test"

This reverts commit 7db34120e1e91f4fd26514fdb9525cac2a6066bb.

* Delete the minicart test

* Revert "Revert "Remove tax test""

This reverts commit 31dd654e52f37fcd02ccd25336958248bef495c6.

* Revert "Delete the minicart test"

This reverts commit 5595f0834a975d097a300bc0c7cbf643caa8b764.

* tax test

* block addToCart

* Put back block functions

* Refactor block.addToCart

* mini-cart e2e test uses shopper.block.emptyCart()

* only run shopper tests in CI

* Run frontend and shopper tests and change waitFor -> waitForTimeout

* Run frontend tests in CI

* Run CI e2e tests again

* Skip legacy template blocks

* Skip legacy template test but run all others

* Switch to storefront instead of twentytwentyone after legacy-template-blocks tests finish

* Tidy up

* fix typo

* Fix ESLint issue

Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
Co-authored-by: Saad Tarhi <saad.tarhi@automattic.com>
2022-03-08 14:50:16 +00:00
Lucio Giannotta 08a99165ca Add mock theme with Woo Templates for E2E tests (https://github.com/woocommerce/woocommerce-blocks/pull/5920)
This PR adds a block-enabled theme with templates for WooCommerce
which is intended to be used when testing the more complex scenarios
such as template fallbacks.

Additionally, since theme-dependent logic seems to be becoming more
and more useful (see woocommerce/woocommerce-blocks#5913), this PR also adds a utility function used to
explicitly declare theme dependencies of a test (`useTheme`).

Said function will activate the theme before running a given suite and then
reactivate the previous theme, as to make sure to not have any side-effects
(such as the ones described in woocommerce/woocommerce-blocks#5913 above).

Closes woocommerce/woocommerce-blocks#5660
2022-03-02 15:49:00 +01:00
Lucio Giannotta 8ad1dff1f4 Rename templates to more e-commerce friendly names (https://github.com/woocommerce/woocommerce-blocks/pull/5935) 2022-02-28 08:00:01 +01:00
Tung Du 47f8993a8d Shopper → Mini Cart → Can see the icon with a badge (https://github.com/woocommerce/woocommerce-blocks/pull/5877) 2022-02-22 09:50:59 +07:00
Lucio Giannotta 341a742916 E2E tests for Product Tag Template and Legacy Block (https://github.com/woocommerce/woocommerce-blocks/pull/5888)
Also: 

* Add fixtures for tags
* Teardown both categories and tags when tests are done
2022-02-21 13:26:22 +01:00
Lucio Giannotta d64ebc72dc E2E tests for Product Category Template and Legacy Block (https://github.com/woocommerce/woocommerce-blocks/pull/5820) 2022-02-21 12:38:36 +01:00
Lucio Giannotta 5de9fec527 E2E tests for Product Archive Template and Legacy Block (https://github.com/woocommerce/woocommerce-blocks/pull/5748)
Also:
* Refactors the function to add a custom paragraph
* Add front-end test for archive template
* Use WordPress data to guarantee block presence
* Use WordPress data instead of selectors to match blocks
2022-02-21 12:01:56 +01:00
Lucio Giannotta 497820dcb9 E2E tests for Single Product Template (https://github.com/woocommerce/woocommerce-blocks/pull/5722)
* Add empty block theme to mock E2E tests
* Install empty theme in the test WP instance
2022-02-21 11:01:42 +01:00
Tung Du 4dab187dbe Fix: only allow Mini Cart block in Widgets and Site Editor (https://github.com/woocommerce/woocommerce-blocks/pull/5653)
* fix: exclude Mini Cart from the blocks editor

* fix: explicitly register Mini Cart blocks for Site Editor and Widgets

* add check to loading the block on frontend

* add e2e tests for widget area

* improve test title

Co-authored-by: Luigi <gigitux@gmail.com>
2022-02-07 11:29:22 +01:00
Thomas Roberts 426eb51830 Update Checkout block E2E fixture and increase node version in GH actions (https://github.com/woocommerce/woocommerce-blocks/pull/5678)
* Remove unnecessary setup step and use node v16 in E2E action

* Ensure storefront is active

* Use new checkout fixture

* Try with only checkout test

* Update package.json

* Run all tests, not just checkout
2022-02-01 11:14:16 +00:00
Thomas Roberts 5036c69638 Add E2E tests for Filter blocks (Price, Attribute, and Active Filters) (https://github.com/woocommerce/woocommerce-blocks/pull/4562)
* Add clear and fill input test util

* Add tests for Filter Products by Price

* Add class name to filter products by price block in editor

* Update wp-env

* Fix formatting

* Update lock

* Revert "Update lock"

This reverts commit f4e809e000430eea3972c94fd2aea0a19ba6961b.

* Create product attributes during setup

* Remove product attributes during teardown

* Add attributes in fixture-data

* Add two new products, for attribute testing

* Load attributes into store and apply them to products

* Add class to Filter by Attribute when editing

This is so it can be targeted in E2E tests more easily.

* Add tests for Filter Product by Attribute

* Fix formatting in attribute-filter.test.js

* Add tests for active filters block

* Add doc block for ensuteCleanAttributes

* Update wording of title test in all filter block E2E

* Update test wording to read better

* Update snapshots

* Use pptr-testing-library selectors to click elements

This makes the tests easier to reason with, and lets us take a step back from the implementation details (classnames etc.)

* Add saveOrPublish test util

* Use pptr-testing-library selectors to click elements in attribute filter

* Use pptr-testing-library selectors to click elements in price filter

* Add `puppeteer-testing-library`

* Use puppeteer-testing-library API to look for H6 button

* Use correct argument in jest-puppeteer.dev.config

* Update package.json & package-lock.json

* remove tests for 5.3

* remove snapshots

* Remove ensureCleanAttributes

* Remove puppeteer-testing-library, install missing expect-puppeteer package and update tests

The puppeteer-testing-library, although added by gutenberg is not actively used.
I have removed it and realised that the added functionality can be easily replaced by expect-puppeteer.
This is a package that we specify in the jest configuration but it was not part of our package.json.
The selectors from puppeteer-testing-library have been replaced with .toClick and the utility clearAndFillInput with .toFill

The Filter by Attribute block has been skiped until tests are fixed.

* Add back setupPageSettings to jest setup

* Fix filter by attribute block test

* Fix linting error

Co-authored-by: Raluca Stan <ralucastn@gmail.com>
2021-12-23 17:26:10 +01:00
Mike Jolley 70f0c06bf9 Fix e2e tests welcome guide/m1 mac support (https://github.com/woocommerce/woocommerce-blocks/pull/5096)
* Bump dependencies to fix e2e on m1 macs

* Disable welcome guide more reliably - see 3da717b8d0/packages/e2e-test-utils/src/create-new-post.js

* Update selectors and fixture data for cart block

* unused dep

* Remove duplicate block wrapper

* Remove unused jest configuration files

* More robust click in view switcher test

* Revert fixture data change
2021-11-09 13:18:55 +00:00
Seghir Nadir 2408e34faa Migrate Cart i1 to Cart i2 (https://github.com/woocommerce/woocommerce-blocks/pull/4973)
* move empty cart

* remove Cart and rename Cart i2 to Cart

* graduate blocks

* setup template migration from Cart i1 to Cart i2

* back to js so we have a good diff

* add migration

* fix bug in empty cart template

* add useForceLayout hook to edit

* migrate from old block to new block

* migrate styles

* respect align

* add tests

* Include latest cart line item improvements from cart-i1

* Missing changes from cart-i1

* Line items table should be disabled

* Fix e2e tests for cart i2

* update tests to adapt for inner blocks

* update select to resolveSelect to remove warning checker

* rename test/block to test/index

* move blocks to their own file

* undo rename to keep diff clean

* remove .tsx and update jest config

* Revert "update select to resolveSelect to remove warning checker"

This reverts commit 79d55de30edcfe36bbdfe7506df7a09460824f03.

* revert resolveControl

* Fix empty cart editor E2E test by scrolling to the view switch

* parse attributes for order summary block

* migrate attributes when resaving

* Update documentation

Automatic update after running npm run build:docs

* add align options to filled cart and empty cart

* append instead of replcae

* import style.scss in frontend

Co-authored-by: Mike Jolley <mike.jolley@me.com>
Co-authored-by: Raluca Stan <ralucastn@gmail.com>
2021-10-25 15:46:34 +01:00
Tung Du 7dc9b16f4a Add basic E2E tests for products grid blocks (https://github.com/woocommerce/woocommerce-blocks/pull/4872)
* wip: add product on sale test

* test: add fixture for product on sale test

* try: permission

* Revert "try: permission"

This reverts commit f8eb09c0152a567383e93c18f61e91fdadd13c40.

* test: basic e2e test for products by category block

* test: basic e2e test for products by tag block

* add basic test for products by attribute block

* trigger build

* fix: slug
2021-10-21 10:23:15 +01:00
Tung Du bd3e7126f8 Mini Cart block: display a compatibility notice when the user first adds the block in the editor (https://github.com/woocommerce/woocommerce-blocks/pull/4945) 2021-10-21 16:07:20 +07:00
Niels Lange 40e43b5328 Add e2e tests for Hand-picked Products (https://github.com/woocommerce/woocommerce-blocks/pull/4788) 2021-10-18 15:07:24 +01:00
Niels Lange 3f530ac755 Add e2e tests for Best Selling Products (https://github.com/woocommerce/woocommerce-blocks/pull/4785) 2021-10-18 15:06:48 +01:00
Albert Juhé Lluveras c3152aec96 Add e2e tests to verify disabled blocks can't be inserted into widget areas (https://github.com/woocommerce/woocommerce-blocks/pull/4910) 2021-10-18 08:48:03 +02:00
Niels Lange 8475bc7bad Add e2e tests for Top Rated Products (https://github.com/woocommerce/woocommerce-blocks/pull/4786) 2021-10-11 17:05:50 +01:00
Niels Lange ff78f58556 Add e2e tests for Product Categories List (https://github.com/woocommerce/woocommerce-blocks/pull/4915) 2021-10-11 18:59:45 +07:00
Niels Lange 6286f7fbd6 Add e2e tests for Newest Products (https://github.com/woocommerce/woocommerce-blocks/pull/4789) 2021-10-11 18:55:38 +07:00
Niels Lange 6dc54c1268 Add e2e tests for Featured Category (https://github.com/woocommerce/woocommerce-blocks/pull/4773) 2021-09-20 18:34:06 +07:00
Niels Lange 37920b118d Add E2E tests for Featured Products (https://github.com/woocommerce/woocommerce-blocks/pull/4771) 2021-09-17 14:07:26 +02:00
Mike Jolley 5c08c75612 Update Checkout to Checkout i2 (https://github.com/woocommerce/woocommerce-blocks/pull/4745)
* Remove i2 from build

* Remove i2 php registration

* Rename old checkout dir

* Rename i2 dir

* Migrate i1 to i2 code

* Register block metadata to fix frontend rendering when migrating to i2

* Register in correct order

* Missing styles

* add register-components to side effectful list

* wrong block class in e2e test

* wp prefix missing on selector

* Fix top level block test

* Reselect labels to work around rerendering

* missing empty cart styles

* Consolodate duplicate styles

* remove init code

* update selectBlockByName

Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
2021-09-16 13:16:21 +01:00
Thomas Roberts a2772a1cad Add E2E and Unit (PHP and JS) tests for Filter by Stock block. (https://github.com/woocommerce/woocommerce-blocks/pull/4682)
* Add back end E2E tests for Filter by Stock

* Add unit/snapshot tests for Filter by stock block

* Refactor Filter by Stock block to load stock statuses in the block body

This is required to make the code easier to test, since the mocked settings were being applied immediately after the block was imported, which didn't give time to let the `allSettings` override take place in the unit tests.

* Add PHP Unit tests for test_custom_stock_counts of ProductQueryFilters

* Remove useMemo from stock filter block

This felt like an overoptimisation, it's very inexpensive to run this every render. The result is less complex code, so it's better this way imo.

* Move initial stock options and the values they are derived from into useState

* Add class name to block in editor
2021-09-15 09:20:31 +01:00
Albert Juhé Lluveras ebdacd62d7 Add initial e2e tests to Mini Cart block (https://github.com/woocommerce/woocommerce-blocks/pull/4677) 2021-09-08 10:14:53 +02:00
Mike Jolley a7d7ea32bb Fix unfiltered html usage of blocks (https://github.com/woocommerce/woocommerce-blocks/pull/4551)
* SSR search

* deprecation handling for search

* Update snaps

* Fix duplicate class and align class property
2021-08-12 17:39:38 +01:00
Mike Jolley 7ff3dac568 Fix e2e tests: Remove paypal from fixture data (https://github.com/woocommerce/woocommerce-blocks/pull/4507)
* Remove paypal from fixture data

* Fix scroll hoc tests

* Missing return type in cart causing TS error

* update e2e utils

* Replace searchForBlock method in e2e utils

* Single block update insert block

* Use insertBlockDontWaitForInsertClose
2021-07-26 15:05:09 +01:00
Raluca Stan 092a28848c Fix e2e checkout tests and adjust jest setup (https://github.com/woocommerce/woocommerce-blocks/pull/4216)
* Fix checkout test
- make tests independent & test also for empty cart case
- make sure the Order summary is expanded with a better selector
* Remove unnecessary localStorage operations from tests
* Go to cart page before removing an item from cart
* Remove logging observing before tests
This removes unnecessary console.log interception. A big part of the logic was done for Puppeteer 1.6.1, but since 3.0.0 message.text() returns string. We allow console.error messages to surface in our tests. Although they don't cause the test to fail it might be a good addition for debugging purposes.
2021-05-18 15:09:30 +02:00
Raluca Stan b9db5d4c51 Fix/cart backend test (https://github.com/woocommerce/woocommerce-blocks/pull/4153)
* Fix backend cart e2e test

* Adjust test structure

* Fix e2e checkout backend test.

Make sure the confirmation window is closed
2021-05-05 12:52:27 +01:00
Thomas Roberts e6c7f2b6c0 Check for element before trying to click it in cart backend test (https://github.com/woocommerce/woocommerce-blocks/pull/4087) 2021-04-27 09:39:31 +01:00
Thomas Roberts 583113e373 Remove woocommerce as a dependency and install @woocommerce/e2e-utils (https://github.com/woocommerce/woocommerce-blocks/pull/4078)
* Remove woocommerce as a dependency and install @woocommerce/e2e-utils

* Remove reference to woocommerce package from tsconfig and jest config
2021-04-26 16:31:30 +01:00
Mike Jolley dbbb99d55e Move Block Type Settings into Block Type Classes (https://github.com/woocommerce/woocommerce-blocks/pull/4059)
* BLOCK SETTINGS: Remove unused constants/settings

* AssetDataRegistry: Helpers to check for settings that exist, and registering page ID/permalinks

* Move checkout and cart block settings to checkout and cart blocktypes

* Move isShippingCalculatorEnabled to cart block

* Remove HAS_DARK_EDITOR_STYLE_SUPPORT and IS_SHIPPING_CALCULATOR_ENABLED in favour of getSetting

* Move displayCartPricesIncludingTax to blocktypes, and implement getSetting

* Move block settings to core settings and blocktypes

* Fix namespace usage

* Move review settings

* move tag settings

* Keep productCount in core data

* Move min and default height

* Improve storePages code

* Move attributes to attribute filter block type

* Move $word_count_type outside of settings array

* Remove unneeded setting in preview data (shippingCostRequiresAddress)

* Move min/max settings dependency from GridLayoutControl to Blocks themselves and use getSettings

* DEFAULT_COLUMNS and ROWS to settings

* Move product columns/rows to block types

* Add grid settings to AllProducts block

* Correct default rows

* correct min rows default

* Move hasDarkEditorStyleSupport

* Move hideOutOfStockItems to block type settings

* Move build settings to inline script dependency

* Pass data through asset api and move restApiRoutes

* Export all core settings as constants

* Remove WORD_COUNT_TYPE from core settings

* Move some other core settings to assets

* Update constants

* Make settings use TypeScript

* Update CURRENT_USER_IS_ADMIN usage

* WORD_COUNT_TYPE

* REST_API_ROUTES

* REVIEW_RATINGS_ENABLED and SHOW_AVATARS

* Remove REVIEW_RATINGS_ENABLED and SHOW_AVATARS constants

* Remove MIN_HEIGHT

* Remove DEFAULT_HEIGHT

* PLACEHOLDER_IMG_SRC

* LIMIT_TAGS

* HAS_PRODUCTS

* HOME_URL

* HAS_TAGS

* COUPONS_ENABLED

* SHIPPING_ENABLED

* TAXES_ENABLED

* DISPLAY_ITEMIZED_TAXES

* SHIPPING_COST_REQUIRES_ADDRESS

* SHIPPING_STATES and SHIPPING_COUNTRIES

* STORE_PAGES

* ALLOWED_COUNTRIES

* ALLOWED_STATES

* SHIPPING_METHODS_EXIST

* PAYMENT_GATEWAY_SORT_ORDER

* CHECKOUT_SHOW_LOGIN_REMINDER

* CHECKOUT_ALLOWS_GUEST and CHECKOUT_ALLOWS_SIGNUP

* ATTRIBUTES

* DISPLAY_CART_PRICES_INCLUDING_TAX

* DISPLAY_CART_PRICES_INCLUDING_TAX

* update build for TS files

* fix build dir

* Move blocks build config params

* Move placeholderImgSrc to core settings

* Move rest api hydration hoc to shared hocs and provide it restApiRoutes directly to avoid asset data registration

* Move wordCountType to abstract block

* Remove WORD_COUNT_TYPE in favour of getSetting

* Move IS_LARGE_CATALOG and PRODUCT_COUNT to abstract block type and use getSetting inline

* Add wcBlocksConfig

* fix tests

* Remove unused $asset_data_registry

* remove console.log

* Move build settings to abstract block

* Trigger build again

* Move hydration back to regular hocs for compatibility with trunk (merge conflict)

* Removed wcSharedHocsConfig

* esc home url

* Update search fixture

* Update search snap

* 40000 timeout

* hasProducts -> productCount

* Product Count is part of blocks config

* update mocks

* Use version comparison to determine if batching is enabled

* Change isWpVersion

* scrollTo button
2021-04-22 12:37:27 +01:00
Thomas Roberts d057618b24 Fix failing e2e tests (https://github.com/woocommerce/woocommerce-blocks/pull/4068)
* Remove unused fixtures

* Update package-lock.json

* Update product-search fixture and snapshot

* Ensure the product is selected before continuing with the test.

This clicks the test at least once, or at most thrice to ensure it is checked before trying to evaluate the rest of the test.

* Revert "Remove unused fixtures"

This reverts commit e4a4e11b72c6723341d60391bd9cb9cc4197efaf.

* Look for button with aria-label: 'Toggle block inserter'

* Revert "Look for button with aria-label: 'Toggle block inserter'"

This reverts commit a25ea8d9abafead372ef24b2feb92ff58bd95cea.

* Update @wordpress/e2e-test-utils to 5.1.2

* Check for existence of add block button
2021-04-16 11:48:27 +01:00
Albert Juhé Lluveras 5e0c4cf0ce Add initial e2e tests to Checkout block frontend (https://github.com/woocommerce/woocommerce-blocks/pull/4004)
* Add initial e2e tests to Checkout block frontend

* Fix comment format

* Scroll to payment methods before checking if they are clickable

* Typos

* Implement caching in getBlockPagePermalink to improve e2e test performance

* Revert "Typos"

This reverts commit 1b544276056084f73d5bcdfa391d5438590e4782.

* Simplify product price definitions

* Move scrollTo function to utils
2021-04-14 15:50:27 +01:00
Albert Juhé Lluveras c7bec5bcd2 Remove checks for WP 5.4 from e2e tests (https://github.com/woocommerce/woocommerce-blocks/pull/3993)
* Remove checks for WP 5.4 from e2e tests

* Update e2e local environment set up docs
2021-03-23 15:09:04 +01:00
Albert Juhé Lluveras b6403bd66c Show compatibility notice when adding the Cart and Checkouts blocks in the editor (https://github.com/woocommerce/woocommerce-blocks/pull/3937)
* add guide

* Add missing translation strings

* Use localStorageState so dismissing the compatibility notice is persisted

* Add types

* Split notice text in two paragraphs

* Update notice texts

* Remove unnecessary empty line

* Cleanup

* Prevent Gutenberg stealing focus (and closing) guide modal

* Add tests

* Don't show compatibility notice in WP <= 5.4

* Don't have tests inside if clauses

* Fix test breaking in latest Gutenberg version

* Remove unnecessary openDocumentSettingsSidebar

* Rename CompatibilityNotice to CartCheckoutCompatibilityNotice

* Add try/catch blocks around JSON operations in useLocalStorageState

* Create useCompatibilityNotice hook

Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
2021-03-19 11:05:42 +01:00
Mike Jolley f856756ace Update Single Product Test (https://github.com/woocommerce/woocommerce-blocks/pull/3924)
* Update Single Product Test

* duplicate test

* Try adding npm install @wordpress/e2e-tests@1.9.1

* @wordpress/e2e-test-utils@4.5.0
2021-03-05 13:33:58 +00:00
Thomas Roberts 9a537fdab5 Create GitHub actions for automated tests (https://github.com/woocommerce/woocommerce-blocks/pull/3544)
* Create end-to-end-tests.yml for E2E testing action

* Change actions to run on push instead of PR

* Install libstdc++-4.9-dev on E2E tests action

* Add correct apt repository for libstc++

* Reconfigure apt-get commands for installing libstdc++

* Remove accidental inclusion of Travis config from E2E tests action

* Install libkrb5-dev as part of e2e test action

* Run apt commands as sudo

* Install gutenberg plugin and e2e testutils

* Add environment variables to E2E tests

* Rename action and add further config for composer and wp-env

* Rename workflow

* Add jobs for WP 5.6, 5.5, and 5.4

* Fix YML indentation

* Apply 767 permissions to wp-env directory

* Run chmod as sudo

* Comment 5.6 and 5.6 with GB out to test 5.4 more easily

* Remove WP install job, since it should run on each step

* Change order of wp-env start and chmod

* Reorder commands for 5.4 job

* Try running 5.4 tests in isolation

* Reenable tests for all WP versions

* Move commands out of bash script into a series of commands

* Fix indentation on 5.5 job

* Re-enable libkrb5-dev install

* Clean wp-env before each run & upgrade wp-env to 3.0.0

* Update lock file for wp-env@3.0.0

* Reorder wp-env start and clean commands

* Reorder wp-env permissions commands

* Reorder wp-env permissions setup for all jobs

* Reorder wp-env permissions setup for 5.5 and 5.4

* Ensure correct order for env setup and flush permalinks twice

* Update jest snapshots

* Remove rewrite flush command from yml

* Remove npm build from every step and try it just at the start

* Set correct e2e build script

* Add jobs for PHP 8

* Specify PHP 8 minor version

* Run PHP 8 jobs first

* Remove PHP 8 jobs

* Add JS Unit tests job

* Remove js-unit-tests.js workflow

* Remove composer install from every step, add it to its own step

* Cache composer files

* Bust npm cache to test nodegit

* Rename npm cache

* Renove npm cache entirely

* Revert "Renove npm cache entirely"

This reverts commit d6fac6a6ebd9162e48f64daaa8c971320756579e.

* Rename npm cache back to how it was

* Fix yml indentation

* Remove echo from composer cache step

* Revert back to composer example

* Add PHP Unit tests to workflow

* Add PHP Unit tests to workflow

* Rename E2E tests workflow and file

* deliberately break e2e and unit tests to test workflow 👺

* fix php test, should see e2e fail

* revert broken e2e test

* Change steps into jobs, rename workflow

* Remove Travis workflow file

* Add all necessary setup steps to each job

* Rename Setup job and remove dependency

* Add individual jobs for each E2E test environment

* Add npm install and build to setup job

* YML syntax fix

* Remove error-causing chmod

* Rename blocks.ini setup step

Fixes a typographical error.

* Get the latest stable version of WooCommerce for PHPUnit testing

* Add PHP8.0 and PHP5.6 Unit tests

* Run composer update for PHP 5.6 and PHP 8.0

* Revert "Run composer update for PHP 5.6 and PHP 8.0"

This reverts commit 4f90522d0b52b7a8b9e896e9c783795be9dc5399.

* Revert "Add PHP8.0 and PHP5.6 Unit tests"

This reverts commit 66e317dec4af6e3a2ac6f78b6efd050e7fc5aa8e.

Co-authored-by: Rua Haszard <rua.haszard@automattic.com>
2021-01-05 09:27:22 +00:00
Albert Juhé Lluveras 01c1ce8ffb Update WP versions used in Travis e2e tests (https://github.com/woocommerce/woocommerce-blocks/pull/3535)
* Update WP versions used in Travis e2e tests

* Remove WP 5.3 tests

* Remove legacy WP version checks in e2e tests
2020-12-09 17:09:45 +01:00
Mike Jolley ec22a5c6c4 Cart and checkout should respect the global "Hide shipping costs until an address is entered" setting (https://github.com/woocommerce/woocommerce-blocks/pull/3383)
* Remove custom fieldconfig for shipping calculator so required fields for shipping are collected

* If the store config requires an address before shipping, do not return rates or totals

Totals, calculated by the cart, would be set to 0 in this scenario which could lead to customer confusion (why is the rate $10 but shipping shown as $0?)

* The shipping total row is missing a border

* Revert "If the store config requires an address before shipping, do not return rates or totals"

This reverts commit f3a4f24f5785392eb43bfc69a5548d398c47d8bb.

* Add hasCalculatedShipping to schema and hooks

* Show shipping notices with updated wording based on if shipping has calculated yet or not

* Refactor shipping row display to use new API props

* Remove block level isShippingCostHidden

* fix test

* Correct the math in the shipping preview in cart

* Document null

* Remove test—this option no longer exists

* Remove unused settings/constants
2020-11-17 11:58:38 +00:00