* Add filter to change allowed blocks in Cart and Checkout blocks
* Add documentation for allowedBlockTypes
* Add test to check the filters work for the Checkout block
* Rename filter to additionalCartCheckoutInnerBlockTypes
* Update docs to reflect new name
* Add tests for additionalCartCheckoutInnerBlockTypes in Cart block
* Update Checkout test to reflect new filter name
* Update docs TOC to add example link
* Remove Single Product Block
* remove more files that belong the Single Product block
* fix php linter error
* remove Product Tag List and Product Category List blocks
* Hide shipping address from local pickup order confirmation page
* Add pickup details to confirmations
* Error handling
* Update test because columns may be hidden
* use address selector
* Custom selector for local pickup
* try forcing flat rate during test
* Fix local pick-up e2e tests
- Change location_country select input to location_country_state select input in e2e tests.
- Remove location_state select input in e2e tests.
* Fix country/state value
- Change country/state value from 'US' to 'United States (US) — California'
* Add inline comment about same field for Country and State fields
- We merged the Country and State fields into the same field in the local pickup modal. Add inline comment in e2e test to avoid confusion.
* Add CartCheckoutUtils class
This class will store reusable methods relating to Cart/Checkout Blocks, i.e. whether they are used on the Cart/Checkout page.
* Update ShippingController to use the new CartCheckoutUtils function
This will reduce code duplication when checking if the Cart/Checkout blocks are in use on the Cart/Checkout page.
* Add filter to remove shipping settings when Cart/Checkout are default
* Ensure setting displays correctly if cart is default but not checkout
* Add tests to ensure core shipping settings update correctly
* Add setCartCheckoutPages function to update set the cart/checkout page
* Force shipping to be enabled if the Checkout block is in use.
* Add filter to override cost requires address option
* Add shippingCostRequiresAddress option
* Check if the address is required before showing rates
* Show shipping rates in editor
* Add shippingCostRequiresAddress attribute to shipping methods block
* Update frontend type to show shippingCostRequiresAddress is a prop
* Add control to toggle shippingCostRequiresAddress option
* Show address notice in the correct scenario
* Send shippingCostRequiresAddress to Block in front end context
* Add e2e test for editor control
* Add e2e tests for shipping options on the front end
* Add updateAttributeInSiblingBlock function
* Add shippingCostRequiresAddress to shipping method block
* Ensure attribute is updated in both blocks when editing
* In Shipping Methods Block, show correct component based on block setting
* Show correct block in editor
* Remove broken test from PR
* Clean up updateAttributeInSiblingBlock
* Add setCartCheckoutPages function to update set the cart/checkout page
* Add tests to ensure core shipping settings update correctly
* Add isAddressComplete function
Borrowed from woocommerce/woocommerce-blocks#8141
* Check if the address is required before showing rates
* Show shipping rates in editor
* Show address notice in the correct scenario
* Add e2e tests for shipping options on the front end
* Ensure errorId is passed to StateInput
* Add fullShippingAddressPushed action to wc/store/cart
* Add fullShippingAddressPushed case to reducer
* Ensure fullShippingAddressPushed is set when initialising cart store
* Add fullShippingAddressPushed selector and default state entry
* Add shippingAddressHasValidationErrors util function
* Do not overwrite addresses when selecting a rate
* Set whether full address has been pushed when saving address changes
* In Shipping Methods Block, show correct component based on block setting
* Don't show from price if rates should be hidden until address entered
* Check city validation errors to assert if shipping address is valid
* Rename merchant.js to merchant.ts
* Move local pickup functions to common merchant util
* Update local pickup tests to use common merchant utils
* Add test to ensure setting toggles in both blocks
* Add navigating to settings and saving in merchant util
* Create addPickupLocation merchant util
* Add test for local pickup and require full address
* Make sure correct conditions are met to show shipping options
* Ensure checkbox is checked during local pickup tests
* Unset the checkbox when tests are finished running
* Update checkout block fixture
* Prevent error in unit tests
* Import validation store key from constants
Required because importing from the index causes the validation data store to register twice
* Update checkout terms test to wait for button not to be disabled
* Revert "Add isAddressComplete function"
This reverts commit 9967dc0d4f10cf638859ae085e6f4cc2901dd299.
* Add third party local pickup method to woo-test-helper plugin
* Add test to check for checkout with local pickup
* Ensure local pickup is disabled when done with tests
* Add a more reliable selector for the "use same address for billing" box
* Prevent local pickup rates showing if local pickup is not enabled
* Check billing details after placing local pickup order
* Change local pickup unit test so rates dont show if localPickup disabled
* Use existing const instead of getSetting
* Update tests to mock constant from @woocommerce/block-settings
---------
Co-authored-by: Niels Lange <info@nielslange.de>
* Add tests for pushChanges and dirty props
* Update assets/js/data/cart/test/push-changes.ts
Co-authored-by: Mike Jolley <mike.jolley@me.com>
---------
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Merge tax_query of attributes and visibility taxonomies when building Products query
* Add tests confirming the tax_query is merged correctly
* Improve syntax after code review
* Add minimum structure for Single Product Details block
* Add Product Image Gallery woocommerce/woocommerce-blocks#8233
Add Product Image Gallery
* Add tests for Single Product Details block
* Add the initial basis for the Add to Cart button
* Trigger the single product add to cart action for each product type.
* wip: create block structure and add initial styles
* Add block details to the SingleProductDetails.php file
* Rename the block from add-to-cart-button to add-to-cart-form
* Update to use the cart icon.
* Implement the skeleton for the editor preview.
* Render tabs title with empty content
* Use woocommerce_output_product_data_tabs function to retrieve tabs data
* Update styles and add Notice for the display in the Editor.
* Update CSS.
* Add base tests for the new Add to Cart Form component.
* Add Product Image Gallery block
* remove support global styles
* remove support global styles
* Update the button CSS.
* Remove customizations for the Single Product Details block
* Update styles for the cart form.
* update td style.
* Update divs and CSS.
* Use conventional input instead of the experimental InputControl
* address CSS feedback
* add support for the custom classname
* remove save function
* Remove unnecessary console.log from the Edit.tsx file
* Remove block classname from block wrapper
* Remove unnecessary WooCommerce tabs filter from the BlockTemplatesController
* Remove attributes property from the block registration
* Remove isExperimental flag for the Single Product Details block
* Remove get_classes_and_styles_by_attributes method from SingleProductDetails block
* Prevent Single Product Details block from apppearing in Pages or Posts
* add second parameter to the subscribe function
* Implement the new design and copy provided for the editor.
* Make the notice compatible with dark themes.
* Some additional CSS tweaks
* adjust the padding for the input
* wrap the Single Product Template in a div with the product class
* Fix PHP Coding Standards warnings
* improve logic and increase coverage of unit test
* improve logic and increase coverage of unit test
* fix test
* format HTML
* fix edge case
* update @types/wordpress__data package
* update placeholder, icon and description
* update tsconfig
* update block name
* fix SCSS linter error
* address feedback
* create SingleProductTemplateCompatibility class
* Add Hooks compatibility
* remove not used file
* remove not used files
* Add compatibility layer for the Single Product template
* fix check
* address feedback
* remove unused import
* double empty line
* remove logic in the constructor
* remove hook
* generate the docs
* add missing hooks
* fix docs
* address feedback
* fix linter
* fix import
* Disable compatibility layer when the WooCommerce Product Grid Block block and WooCommerce Single Product Block are used (https://github.com/woocommerce/woocommerce-blocks/pull/8538)
* disable compatibility layer via hook
* update docs
* generate the docs
* fix version
* fix import
* fix code after merge
---------
Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
Co-authored-by: Patricia Hillebrandt <patriciahillebrandt@gmail.com>
* Wait for push changes before clicking place order
* Blur last field and wait for network requests when entering addresses
* Use correct quote style
* Add address_2 to fake test address
* Use correct property names when filling test address
* Use correct comment style
* Update address values to reflect what is in the config file
* Remove unnecessary waits
* Improve batch request checking when filling shipping and billing address
* Wait for network idle before selecting shipping address
* Add checkCustomerPushCompleted function
* Override checkout data with test email
* Fill in the checkout data when testing for terms and conditions text
* Improve comments
---------
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
* Fix e2e tests which use the insertBlock function
* Move more instances of insertBlock to insertWCBlock
* Ensure block inserter is open before searching for a block
* Get rid of openWidgetsEditorBlockInserter
* Rename insertWCBlocks to insertBlockDontWaitForInsertClose
* Fix e2e tests of the Product Details block
* Migrate to insertBlockDontWaitForInsertClose instead of insertBlock
* Go to single product template
* Fix Product Details classname and slug in tests
* Replace usage of 'foo' variable name
* Fix typo in 'can not be inserted in a post' test
* Fix e2e tests which use the insertBlock function
* Move more instances of insertBlock to insertWCBlock
* Ensure block inserter is open before searching for a block
* Get rid of openWidgetsEditorBlockInserter
* Rename insertWCBlocks to insertBlockDontWaitForInsertClose
* Add the initial basis for the Add to Cart button
* Trigger the single product add to cart action for each product type.
* Rename the block from add-to-cart-button to add-to-cart-form
* Update to use the cart icon.
* Implement the skeleton for the editor preview.
* Update styles and add Notice for the display in the Editor.
* Update CSS.
* Add base tests for the new Add to Cart Form component.
* Update the button CSS.
* Update styles for the cart form.
* update td style.
* Update divs and CSS.
* Use conventional input instead of the experimental InputControl
* Implement the new design and copy provided for the editor.
* Make the notice compatible with dark themes.
* Some additional CSS tweaks
* adjust the padding for the input
* Update the icon for the block to match the core icon button
* Add minimum structure for Single Product Details block
* Add tests for Single Product Details block
* wip: create block structure and add initial styles
* Add block details to the SingleProductDetails.php file
* Render tabs title with empty content
* Use woocommerce_output_product_data_tabs function to retrieve tabs data
* Remove customizations for the Single Product Details block
* Remove unnecessary console.log from the Edit.tsx file
* Remove block classname from block wrapper
* Remove unnecessary WooCommerce tabs filter from the BlockTemplatesController
* Remove attributes property from the block registration
* Remove isExperimental flag for the Single Product Details block
* Remove get_classes_and_styles_by_attributes method from SingleProductDetails block
* Prevent Single Product Details block from apppearing in Pages or Posts
* Fix PHP Coding Standards warnings
* update block name
* fix SCSS linter error
* move blocks into product-elements folder and rename to product-details
* avoid 404 error
* disable js asset enqueue
---------
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
* wrap the Single Product Template in a div with the product class
* improve logic and increase coverage of unit test
* improve logic and increase coverage of unit test
* fix test
* format HTML
* fix edge case
* address feedback
* fix name block and fix check
* wrap single product template only on the frontend
* Set inherit default to true when products is inserted on archive products templates
* Create new query attributes object
Co-authored-by: kmanijak <karol.manijak@automattic.com>
* Extract the products registration to a separate function
* Bring back variation name
* Move variation name
* Unregister the block before registering it again
* Use subscribe only on the site editor
* Undo change
* Try fixing tests
* Fix test
* Revert test only
---------
Co-authored-by: kmanijak <karol.manijak@automattic.com>
* Prevent coupon error disappearing on blur if value unchanged
* Check for inline selector on coupon error
* Prevent coupon error disappearing on blur if value unchanged
* Check for inline selector on coupon error
* Update selector for coupon E2E test
- Revert the label change to "Add a coupon" so that it will be merged to WC Core and translation for the new string will be available.
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
* Initial structure for the breadcrumbs block
* ditch inline comment
* Fine-tune the store breadcrumbs
* Disable the breadcrumbs block for regular posts & pages
* Update the breadcrumbs block details.
* Add tests
* rely on sprintf to render the breadcrumb
* Ditch usesContext.
* Add a link to the breadcrumb editor preview
* Disable all pointer-events for the breadcrumb link in the editor preview
* Add the align attribute
* Use the Disabled component to prevent interactions and update the copy for the block description.
* Fixes a bug where cart response only reflects variation data submitted and not full variation data with default values.
* Sort variation data by attribute alphabetically
* PHP unit test for checking variation data.
The "Coupon code" text was changed to "Add a coupon" and it resulted in the failing of an e2e test as it couldn't find the translated text for "Coupon code". The translation for "Add a coupon" is not available so changing the text to "Apply a coupon code" until the next WC Core release since the translation for the text "Apply a coupon code" is already available.
* Block scaffolding
* Rename to store notices
* Register only in the site editor
* Update description
* Add woocommerce class
* Add tests
* Delete old test file
* Update notices message in the editor
* Remove customization
* Disable the block server side
* Fix TS error
* Add custom classes
* Reprashed test description
* Escape notices
* Remove unnecessary disabled component
* Only allow to insert the block once
* Improve class name
* Merge edit and block files
* Fix copy
* Simplify test case
* Remove align support
* Remove attributes
* Change editor markup
* Use the Notice component to display the notice placeholder on the editor
* Use sprintf to improve readability
* Inline component
* Remove styles and unregister scripts
* Use ordered placeholders
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Use info as the notices status
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Fix php lint error
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* WIP
* Render in editor and add styles
* Simplify select
* Undo change
* Update titles and description
* Wrapped text for translation
* Remove from products inner blocks
* Allow the block in the inserter
* Rename test file and add new tests for catalog-sorting block
* Register on the site editor only
* Fix tests
* Disable block server side
* Override the `enqueue_assets`
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Fix TS error
* Simplify edit
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Disable background color
* Add custom classes
* Remove alignment
* Inherit color and font properties
* Merge edit and block files
* Use sprintf to improve code readability
* Make fontsize small by default
* Add order placeholders and woocommerce class
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Fix floating issue
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Add woocommerce class
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Init setup to add a new block Results Count
* Render template part as a content of ResultsCount block
* Switch to template part rendering
* Rename the block to ProductResultsCount
* Fix typo in BlockTypesController
* Change the ProductResultsCount class name
* Remove Product Results Count block from Product Query template
* Improve the way Product Results Count is rendered in the editor
* Add prefix to places that missed renaming from ResultsCount to ProductResultsCount
* Remove unnecessary frontend.tsx file for ProductResultsCount
* Make sure global styles are applied and respected by Product Results Count block
* Make sure the Product Results Count is available inly in Product Catalog template
* Add basic tests to Product Results Count
* Remove empty line in style file
* Fix TS issue in Product Results Count
* Fix typo
* Override the enqueue_assets method to prevent unnecessary enqueue and 404 error on the frontend
* Add necessary property to block's metadata
* Address code review feedback
* Update description
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* Remove disabled component
* Improve test description
* Merge edit and block files
* Remove align support
* Remove background support
* Simplify edit component
* Improve readability with sprintf and add custom class
* Simplify test case
* Add styles and order placeholders
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Fix markup to match with the frontend
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
Co-authored-by: Alba Rincón <albarin@users.noreply.github.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Alba Rincón <alba.rincon@automattic.com>
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Add coupon link instead of dropdown in Cart and Checkout blocks
* Fix state names used for displaying the link and coupon form
* Fix storybook for coupon block
* Fix unit test for coupon block
* Fix css and accessibility
* Fix coupon block position on Checkout
* Update e2e test cases for coupon block (https://github.com/woocommerce/woocommerce-blocks/pull/8022)
* Update e2e test cases for coupon block
* Fix perfomance test for coupon block
* Fix double await typo
* Fix perfomance test for coupon block
* Remove CSS
* Use classnames to add and remove classes
Improved the code to use classnames to add and remove classes. Also, moved the logic to handle click and submit to separate functions.
* Custom validation strings using a new function named getValidityMessageForInput
* getValidityMessageForInput tests
* Added integration test for error message
* Clear value
* update test strings
* Move payment methods
* Setup entrypoints
* Sortable implementation
* Sortable
* Basic UI in place for settings
* Hydrate real settings
* Form updates values
* Styling and save button placement
* useSettings hook
* Prepare for save
* delete
* Add location button
* Remove className
* Conditional display of taxes
* Save via API
* Update general settings to designs
* Modal styles
* Style table
* Border colors and radius
* Added e2e tests
* use node 16
* Enqueue states in admin
* Use render from wordpress/element
* Missing handle style
* Enable translations
* Remove curried function
* Todo for inline settings
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
* Use Woo Blocks instead Woo core translation
* Activale previously skipped e2e tests
* Adjust loading order of $shared_chunks, $vendor_chunks and $chunks
* Revert chunk order of MiniCart.php
* Add empty 'Customer Account' block
* Add edit to render the block on the editor
* Add Customer Account icon to @woocommerce/icons library
This icon is used in the Customer Account block.
* Use customerAccount icon in the Customer Account block
* Add Block Settings to Customer Account block
Add Typography and Color settings to the Customer Account block that can be used during Edit mode.
* Add Customer Account style icons
This adds the customer account style icons to be used by the customer account block.
* Render the block in the frontend
* Add Display setting to the Customer Account block
This setting allow users to choose if they want to include an icon with the customer account link.
* Add icon style selector to Display settings
This adds an icon style selector in which users can choose the customer account link icon.
* Display on the frontend depending on the icon style
* Rename attributes
* Refactor block rendering
* Improve styling
* Make the account link dynamic
* Add alignment menu
* Get dashboardUrl with getSettings and add fallback
* Add link to account settings
* Add tests
* Fix test
* Change display title
* Split css file
* Switch to SSR
* Add styles to the front end
* Address latest feedback
* Remove experimental flag
Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
* Rename configurateFilterProductsByAttributeBlock() to configurateFilterByAttributeBlock()
* Rename configurateFilterProductsByAttributeBlock() to configureAttributeFilterBlock()
* Add receiveCart thunk
* Add mapCartResponseToCart helper
* Add getItemsPendingQuantityUpdate selector
* Update cart resolvers to be thunks
* Remove RECEIVE_CART action and replace with SET_CART_DATA
receiveCart will turn into a thunk.
* Add notifyQuantityChanges functions
* Remove receiveCart from action type definition, replace with setCartData
* Move apiFetchWithHeaders out of controls
This will just be a normal function since we'll be updating actions to thunks which will use this instead of a control.
* Include thunks in actions file
* Update receiveCart action to setCartData
* Update applyCoupon action to a thunk
* Update useStoreCartCoupons to get action from correct place
* Update StoreCartCoupon types
* Add types for Thunk and ThunkReturnType in mapped-types
* Change applyCoupon to a thunk
* Get applyCoupon, removeCoupon, receiveApplyingCoupon from useDispatch
This is to separate the concerns of actions vs. selectors. Previously the actions were fetched during useSelect which is not a pattern we use anywhere else in the codebase. Since we updated the MapToDispatch type, we can now get correctly typed thunks from the data store.
* Improve apiFetchWithHeaders typings
* Convert removeCoupon from generator to thunk
* Add applyCoupon and removeCoupon to CartAction type
* Remove unused old-style type-def
* Add receiveApplyingCoupon & receiveRemovingCoupon to StoreCartCoupon
* Correct issues with StoreCartCoupon type
These were not intended to reflect the actions in data store, rather the functions offered by the useStoreCartCoupons hook.
* Update applyExtensionCartUpdate to a thunk
* Update addItemToCart to thunk
* Add ResolveSelectFromMap type that works with thunks
* Add CartDispatchFromMap and CartResolveSelectFromMap types
We can add this to all data stores to get them working with thunks properly.
* Add docs and update generic name in ResolveSelectFromMap
* Add correct types for thunk resolvers in cart data store
* Update removeItemFromCart to thunk
* Update apiFetchWithHeaders to use generic
* Update selectShippingRate to thunk
* Update resolver tests to test correct thunk functionality
* Update updateCustomerData to thunk
* Update reducer test to reflect new action name
* Update comments on CartDispatchFromMap and CartResolveSelectFromMap
* Add quantity_limits to preview cart
* Make notices speak when shown
* Remove copilot comment
* Add isWithinQuantityLimits function
This is because we shouldn't show a notice if the quantity limits change, but the item's quantity is still OK.
* Add tests for notifyQuantityChanges
* Show notice when multiple_of is updated
* Update test to test for multiple_of changes
* Remove empty export
* Remove controls from cart data store
Not needed anymore since the exported value from the shared-controls file was empty.
* Export a control and async function for apiFetchWithHeaders
This is required because async functions cannot be called from sync generators.
* Use control version of apiFetchWithHeaders in the collections store
* Improve comments and remove incorrect TypeScript
* Update assets/js/data/cart/actions.ts
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Update ResolveSelectFromMap to include selectors too
* Update TS in actions
* Use finally to remove duplicate code
* remove item pending delete/qty update after action runs in all cases
This will also reset the state when the request to remove it/change quantity errors
* Remove unnecessary type from param.
Not needed because we have TS now. The description can stay though, it is useful.
* Update snackbar wording to use active voice
* Remove old WP version check
* Set max quantity to high number instead of null
This would only happen in a niche case, and would require several TS changes to fix, so it's better to set it as a number here. 9999 should be high enough, and is the default quantity limit set below in get_product_quantity_limit
* Set code on woocommerce_rest_cart_invalid_key to 409
This is so the cart is returned in the response, so the client can update.
* Fix typo in comment and add CartSelectFromMap
* Remove unnecessary docblock
* Add getItemsPendingDelete selector
This is needed so we can show a notice for items that are unexpectedly removed from the cart. We need to know which ones are pending delete so we can skip showing the notice for them.
* Add type for notifyQuantityChanges args and change args to object
* Add notifyIfRemoved function
This will check items that have been removed and show a notice for them.
* Fix TS in receiveCart & pass itemsPendingDelete to notifyQuantiyChanges
* Update wording on removal notice
* Update types for notifyQuantityChanges args
* Update tests to reflect new wording and args being an object
* Check item is truth before running comparison of keys
* Update tests for unexpectedly and expectedly removed items
* Ignore print_r to satisfy phpcs
* Update PHP tests to reflect correct response code when deleting items
* Remove unnecessary controls and dispatch events directly from thunk
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Extend Filter by Stock Editor options with dropdown and single/multiple choice
* Add dropdown implementation for Filter by Stock Status
* Adjust font-sizes to the rest of the filters
* Add tests to Filter by Stock: dropdown and list variants
* Change test file extension from .js to .tsx, so it handles types as well
* Add E2E test to Filter by Stock checking if display style can be toggled
* When typing in Filter by Stock dropdown, handle the space so it highlights the suggestions
* Change the name of the filter blocks in the test files
* Remove unnecessary waiting step in E2E test for Filter by Stock
toMatchElement waits for an element for 30s by itself, hence waitForSelector usage was removed
* Improve the STOCK_STATUS_OPTIONS type handling
* Extract onDropdownChange function instead of inline arrow function
* Fix overlaping dropdown content with the wrapper when Filter by Stock was set to single
* Rename the setting section to match Filter by Attribute
* Add Display Style toggle to the block settings
* Set list as a default value of displayStyle for Filter by Rating
* Add dropdown variant of Filter by Rating
* Extend the Editor settings with selectType: single or multiple
* Adjust the styles of a FormTokenField to other dropdown
* Align Editor settings order and wording between Filter by Attribute and Rating
* Fix the issue with cut off corners of dropdown borders
* Provide translated screen reader messages and placeholder
* Revert the label property, which is necessary to display checkbox list
* Make classname for Rating component optional and remove styling in Filter by Rating
* Cover the case when filter with zero products needs string methods for comparison
* Handle Typescript errors and add ts-ignore annotations when necessary
* Remove explicit key prop assignment in Rating component
* Remove leftover property in type definition
* Refactor JSX element extension with custom properties to more robust way with object copy
* Filter by rating tests (https://github.com/woocommerce/woocommerce-blocks/pull/7845)
* Filter by Rating tests:
- List single
- List multiple
- Dropdown single
- Dropdown multiple
* Adjust the font-size of Filter by Rating dropdown to the rest of the filters
* Fix E2E tests after the Editor settings label has been changed
* Improve sorting in Filter by Rating dropdown
With this change the order of options is always descending: in the chips, suggestions, active filters and URL
* Change the name of the filter blocks in the test files
* Prevent single dropdown input to overflow the wrapper
The issue is fixed in three filters, hence a new shared styles file is created at the path assets/js/blocks/shared/styles/style.css
* Remove the unused styles of active options in Filter by Rating
Chosen options in Filter by Rating list have been bolded. That was the only filter that was doing it. Class was removed, but not the styles themselves which became obsolete. Removing the leftover styles then
* Change the approach of shared styles to fix the dropdown issue in filters
Instead of using direct classes, rewrite it to mixin and include in the filters
* Fix the Filter by Rating with Products block
The problem was with the Products block, that there was incorrect initial value of product ratings query
* Align the logic of getting the filters from URL for Filter by Rating with Filter by Stock
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
* Product Query: add Feedback Prompt in inspector
The prompt doesn't appear at the very bottom as there isn't
currently any straightforward way to do this in the block variation.
More investigation is required.
* Product Query: Change icon, description and name
* Product Query: switch to Feature plugin flag
* Add all currently available atomic blocks to the default Product Query template
* Update feature flags doc
* Change SKU and Stock Indicator feature flags
* Change feature flags docs
* Add title prop to the `FeedbackPrompt` and add a title to the Product Query one
* Hacky solution to display the feedback block at the bottom
The order of the inspector controls is set in Gutenberg.
We can hack our way down by hooking to the “color” group and
display our feedback there.
Other panels would be displayed below that if added, such as borders
and margin.
* Reduce Product Query default template
* Fix e2e tests after Product Query block name change (https://github.com/woocommerce/woocommerce-blocks/pull/7840)
* Product Query: Add a better default pattern (https://github.com/woocommerce/woocommerce-blocks/pull/7833)
* Product Query: Add a better default pattern
* Product Price: Add bottom margin
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Daniel Dudzic <daniel.dudzic@automattic.com>
* Rename Active Product Filters block to Active Filters
* Rename wc-block-active-product-filters__placeholder to wc-block-active-filters__placeholder
* Rename active filters fixture
* Add archive-product to the hierarchy
* Fallback to archive-product and get titles from blocks if the templates from theme don't have one
* Rename function
* Fix comment
* Add fallbacks to the db and blocks versions
* Add missing product attribute blockified template
* Update docs
* Add comment and fix comment type on wp_template
* Replate template name if we know the template in blocks
* Add comment and fix linting error
* Fix archive-product template
* Clone the fallback template from db to show them in the template lsit
* Return the fallback template when querying for a single template
* Remove unneeded condition
* Use wp function instead of gutenberg one
* Fix tests
* Fix tests on Product Catalog templates
It was checking a single product for the customization, but it should check the /shop page
* Disable tests related with deleteAllTemplates function
* Product Query: Fix pagination issue
* Product Query - Add support for the Filter By Price Block woocommerce/woocommerce-blocks#6790
Product Query - Add support for the Filter By Price Block
* fix query relation
* fix on sale query
* Product Query - Add support for the Filter By Attributes block woocommerce/woocommerce-blocks#6790
Product Query - Add support for the Filter By Attributes block
* fix bugged pagination and on-sale filter after refactor
* address feedback
* Product Query - Add e2e tests for the Filter By Price block
* Product Query - Add e2e tests for the Filter By Attribute block
* fix comment
* fix comment
* remove not used import
* remove not used import
* address feedback
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* fixed method sig
* Updated to @wordpress/env@5.5.0 and set default PHP 7.4 for wp-env.
* updated Coding Standards flow to use PHP 8.0
* Added comment to E2E flows explaining what PHP version is used
* Revert "Updated to @wordpress/env@5.5.0 and set default PHP 7.4 for wp-env."
This reverts commit 696cd7f42edc9d9726b777cf4f83a501a6d63936.
* Added comment to Unit test flows explaining what PHP version is used.
Specified PHP version on .wp-env.json
* Fixed composer-lock.json version.
* Updated tests to run on PHP Unit 9.2.6
* Updated tests to run on PHP 8
* Reverted test, mismatched results between local and pipeline
* Removed Todo
* Updated platform overrides
* Update Migrationb tests with Mockery for PHP8 compat
* try at PHP unit flow matrix
* Fix blocks.ini invalid config
* Temp disable E2E
* Downgraded woocommerce/woocommerce-sniffs as it introduced new sniffs we should be handling on a different PR
* re-enable E2E tests
* blocks.ini fix
* revert blocks.ini fix
* Update @wordpress/env
* remove .htaccess mapping
* Fix permissions for tests
* Debug permissions
* Attempt at perm fix
* Attempt at perm fix
* Downgraded @wordpress/env
* Another attempt at upgrade @wordpress/env
* Attempt at cleaning wp-env before run
* Attempt at destroying wp-env before run. Disabled E2E.
* Attempt at destroying wp-env before run.
* debug wp-env data
* attempt at deleting wp-env data (destroy won't work due to prompt)
* re-enable E2E
* Fix deprecation warnings
* Cleaned wp-env data for E2E
* Fix perms for E2E
* Updated RateLimitsTests
* debug
* Force 7.4 for wp-env
* Run sh outside of npm
* Reverted E2E flow
* reverted wp-env-config.sh debug test
* reverted .wp-env.json phpVersion force
* Update tests/php/StoreApi/Utilities/ProductQueryFilters.php
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Update tests/php/StoreApi/Routes/CartExtensions.php
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Update tests/php/StoreApi/Routes/CartItems.php
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Update tests/php/StoreApi/Routes/Products.php
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Update tests/php/StoreApi/Routes/ProductCollectionData.php
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Update tests/php/StoreApi/Routes/Batch.php
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Update tests/php/StoreApi/Routes/Checkout.php
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Update tests/php/StoreApi/Routes/CartCoupons.php
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Update tests/php/StoreApi/Routes/ProductAttributes.php
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Update tests/php/StoreApi/Routes/Cart.php
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* downgraded @wordpress/env to v4
* Reverted back to reflection class for pivate attribs manipulation on tests
* reverted JS unit testing job name
* Update tests/php/StoreApi/Formatters/TestMoneyFormatter.php
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Typo fix
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Add rate limiting to cart endpoints based on session
* Handle nonce and rate checks in permission_callback
* Rate limit checkout only
* Debug
* Unused AbstractRoute
* Code standards
* Modify core rate limit table
* Add rate limit at rest api level, not route level
* Rate limit helper
* Remove rate limit from routes
* Usused dep
* Remove custom error logic no longer needed
* Remove dependency
* Remove custom permission_callback
* Hash IP and handle null
* Remove error response handler
* revert error_to_response changes
* Remove add_response_headers
* Remove IDENTIFIER
* Remove white space
* Increase limit
* Missing class comment
* Move rate limiting code within store api codebase
* white space
* Fix return type
* Check rate limit expiry greater than now
* Remove x- prefix
* reorder functions
* remove table
* pass request to add_nonce_headers
* return early and avoid elseif on AbstractCartRoute:get_response()
* Refactor get_ip_address() before implementing options for functionality
* Change rate limit to 5 requests
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* Change rate limit window to 60 seconds
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* Disable rate limiting by default
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* Updated limits comment
* Example for Forwarded header
* Updated "woocommerce_store_api_enable_rate_limit_check" filter doc
* Added filter for the Store API rate limit check proxy support
* Add an action here that carries over the IP address being blocked.
* Added logic around setting the action_id, and returns an error when ip cannot be determined for users not logged in.
* Renamed action for limit exceeded.
* Common rate limiting header naming prefix, and fixed comment typos.
* Doc for Rate Limiting (wip)
* Example for Rate Limiting docs
* Remove private IP range block for rate limiting
* Refactored get_response() to add nonce headers to response instead of request
* Disable batching for Checkout calls to prevent bypassing Rate Limiting.
* Removed redundant arg.
* package-lock.json update
* Removed repeated func calls.
* Fix failing tests.
* Tests wip.
* Request limit and timeframe are now constants for RateLimits utility class.
* Tests for Rate Limit headers.
* Reverted PHPUnit config to enable all tests again.
* Update src/StoreApi/Authentication.php comment wording
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Removed possibly unnecessary get_ip_address() call.
* Changed wording on comment for get_ip_address() method.
* Simplified validate_ip() method.
* Fixed wrong header entry for "Forwarded" check.
* Unit testing for Authentication::get_ip_address()
* Comment explaining the reason to use ReflectionClass for testing get_ip_address().
* Support for error output outside batch request.
* MD linting.
* Refactor to implement options through a single filter.
* fixed md lint error and config file
* reverted accidental default func arg value removal
* re-enabled batch support for checkout
* action for limit exceed now also triggered in case we can't resolve the IP.
* Doc tweak.
* Return unresolved IP address when REMOTE_ADDR isn't set with proxy support disabled.
* Group unresolved ips for rate limiting
* Fixed bug where current limit wasn't properly initialized.
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Update installed to setup crosssells for all matching products in case of duplicates
* Improve shopper utils to wait for page elements to render
* Taxes should wait for totals wrapper
* Use shopper.block.goToShop()
* Inline docs
* Wait for errors
* partial match please fill error
* Disable apply button when there is no change to selected options
More info: https://github.com/woocommerce/woocommerce-blocks/issues/7116
* Add tests to the Filter Attribute block
Since we are making changes to the Filter Attributes block to fix issue woocommerce/woocommerce-blocks#7373, we are also adding tests to make sure the changes are providing the expected behavior
The setup-globals file was changed to add 'attributes' and 'has_filterable_products' properties to it, so it can be used in the tests.
* Merge test utils methods with attribute filter block
Removing test utils file and merging the methods with the Attribute Filter block to prevent tests from failing due to Jest configuration that only allow test files to exists inside a 'test' folder
* Remove checked.length === 0 condition
**Why was this condition needed before?**
Because when the user initially load the page, no filter is selected therefore we needed this condition to keep the Apply disabled in this case.
**Why we don't need it anymore?**
Because now in this PR we add following code:
```jsx
const activeFilters = getActiveFilters( attributeObject );
if ( activeFilters.length === checked.length ) {
return checked.every( ( value ) =>
activeFilters.includes( value )
);
}
```
This will return `true` when the user initially loads the page & Apply button will become disabled. Therefore, I believe it's safe to remove `checked.length === 0` condition.
More info: https://github.com/woocommerce/woocommerce-blocks/pull/7373#discussion_r994737313
* Add filterSize param to test setup
With this configuration, it is now possible to modify the current filter size in order to improve tests
Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
* register filter wrapper block
* register block variation
* rename the active filters wrapper
* prevent 404 error
* Revert "prevent 404 error"
This reverts commit 8b6cb7c6658b2a5a99b890b67f1dce8c1c51cdbf.
* render parent wrapper block
* support price filter block
* hide the active filter block from inserter
* swap the title of wrapper and inner filter block for active filters
* hide the legacy heading for the price filter
* update block title and description for active filters and price filter
* remove heading control for price filter
* remove heading control for active filters
* update pattern
* try: upgrade button
* limit the number of inner block to 2
* prevent removing the inner filter block
* Revert "prevent removing the inner filter block"
This reverts commit 83b7feed78a7a7f50fd5799d1706faa9f2fc9050.
* convert stock filter to inner block
* refactor block upgrade button to share between filter blocks
* update default heading
* update pattern
* update icon and title
* Fix stock filter error by importing translations package
* Upgrade Active Filters name to Active Filter Controls
* Add upgrade support to price filter
* Convert attribute filter to inner block (https://github.com/woocommerce/woocommerce-blocks/pull/7101)
* wip: convert attribute filter to inner block
* fix: render inner attribute filter block on the front end
* refactor: inner block wrapper, extract the attribute parsing logic into a utility
Co-authored-by: Tom Cafferkey <tjcafferkey@gmail.com>
* Set correct attribute on the new filter blocks when they are upgraded
* Use the Warning component to display the upgrade message so it is consistent with Gutenberg
* address code review
* better detect legacy block to show the upgrade notice
* rename UpgradeToolbarButton to UpgradeNotice
* add upgrade notice to the stock filter block
* rename InnerBlockWrapper to BlockWrapper
* attribute-filter: control wrapper visibility
* passing block attributes down to inner active filters control block
* fix styling of inner attribute filter control block
* passing attribute to inner price filter control block
* passing down the attribute to inner stock filter control block
* remove unneccessary parsing
* use default scope for variations
* fix default attribute values
* use default block appender
* fix: lock control blocks
* remove dynamic title code from attribute filter block
* register active filters as variation and set it to the default that overrides the base block
* fix isActive for default variation
* fix: isActive logic for the active filters block
* register side effect
* fix ts error
* e2e: fix active filters block backend test
* e2e: fix frontend active filters test
* e2e: fix attribute filter test
* e2e: fix price filter test
* e2e: fix stock filter test
* e2e: update fixture
* e2e: fix attribute filter test
* remove invalid test
* e2e: update heading selector for price filter in backend test
* e2e: fixe backend price filter heading test
* fix: patterns i18n
* fix: heading level when upgrading the block
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Re-apply token support
* Updated nonce headers
* Updated package-lock.json
* test commit to debug failing git hooks
* Revert "test commit to debug failing git hooks"
This reverts commit e64086b0a7aede154705be09c7b3433b08bc1e34.
* JsonWebToken utility class for generating and validating HS256 JWT tokens. Removed third-party JWT library.
* Add ext-hash to composer (required by hash_hmac())
* Removed unnecessary method param.
* Tests for retrieving cart contents via Cart-Token
* Removed token tests ( we can't properly test cart token functionality until we refactor the way it intercepts calls to replace the session object )
* Abstracted payload from JsonWebToken class. We can now use it to encode custom payloads and reuse them wherever we want.
* Fixed missing check for token expiration in the payload.
* MD lint error and config fix
* Update composer.lock
* Fixed bug using the wrong nonce header.
* Refactor to properly save session data based on cart token.
* Refactored DB queries to properly use prepared statement
* Removed underscore prefix for class attributes
* Fixed spaces instead of tabs indenting composer.json. Cleaned up .editorconfig
* Cleaned up borked .md comments.
* Comment for WP_SETUP_CONFIG check.
* Reverted SQL prepared statement for including table names.
* Used hash_equals() for signature comparison. Renamed some wrongly named properties.
* Updated composer.lock
* Reverted some accidentally removed lines on some documentation files.
* Reverted accidentally removed line on docs/internal-developers/testing/releases/404.md
* Changed param type from mixed to
Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* Mock getCartTotals
* Change test to use data store instead of context
* Move payment method context test to data store selectors
* Change description of test suite
* Bump commit to trigger tests
* Fix path in test
* update package lock
* Set correct state payment method reducer tests/use correct actions
* Get saved payment methods from store not context
* Mock stores and update tests to allow switching payment methods
* Update tests to get onSubmit from checkoutEventsContext
* Remove cartTotalsLoaded check from payment method initialize check
* Make PaymentMethods test wait until payments initialized
* initialize payment method data store when cart is loaded
* Remove unneeded actions and add initializePaymentMethodDataStore
* Remove check for cart totals loaded in checkPaymentMethods
* Remove updateAvilablePaymentMethods from registry
* Remove unneeded mock
* Remove unused import
* Rename imports to fix eslint errors
* Remove unused imports
* Remove return false from checkPaymentMethods
* Remove unnecessary setPaymentMethodsInitialized call
* Add todo comment to track refactoring opportunity
* Remove savedpayment methods from payment method context and rename it
* Rename payment method data context to payment method events context
* Add tests for setDefaultPaymentMethods
* Optimize the availablePaymentMethods state data
Store only the "name" attribute for now.
* Get list of payment methods from the registry instead of the store
We are using this hook to get some React elements in the payment method
object. So, we are getting the raw data directly from the registry instead
of the store.
* Fix payment state not loading on the Checkout edit page
* Handle checkout edit page case
* Fix infinite loop error on C&C Blocks
* Include @wordpress/redux-routine in transformIgnorePatterns jest config
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
* Create Cross-Sells product list
* Show “Read more” button for out-of-stock cross-sells products
* Update assets/js/blocks/cart/inner-blocks/cart-cross-sells-products/block.tsx
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Update assets/js/blocks/cart/cart-cross-sells-product-list/index.tsx
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Remove obsolete isLoading and placeholderRows
* Fix TS errors
* Rename crossSellsProduct to product
* Fix critical error
* Create 2e2 tests for Cross-Sells block
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Enabled __unstableHTML hidden option for HTML rendering within notices.
* Fixed margin-bottom for HTML notice content
* Fixed margin-top for HTML notice content
* Attempt to fix a broken e2e test
* Reverse ordter of filter item name and close btn.
* Update layout & typography styles for block items
* Update chip ui view styles.
Additionally, add editor styles to have the editor match the rendered
frontend.
* Update additional remove button styles.
- Add hover state to remove button on chip layout.
- Update disabled styles to remove button in both layouts (mainly relevant
to the editor view).
* Adjust remove button colors.
Set hover states to shades of grey. Also set chip color and text to
match selected text color of the block.
* Update e2e test to account for new element order.
Since we're moving the remove button in the list view from the last
child node to the first child node, we need to adjust the expected order
of the active filter item text.
* Design and copy updates on the block settings
Co-authored-by: Alba Rincón <albarin@users.noreply.github.com>
Co-authored-by: Alba Rincón <alba.rincon@automattic.com>
* Update Filter by Stock controls and UI to include custom checkbox and settings.
* Include and style Filter by Stock reset button
* Make checkbox accessible via keyboard
* Update snapshot tests for Filter Products by Stock component
* Update E2E tests with new label value
* Update label test for Apply Filters in E2E tests
* Specify checkbox type so styles are not overridden in the editor
* Update E2E test label for filter button
* Update label selector to search for containing text rather than exact match
* Escape quotation marks for label query in E2E shopper tests for Filter by Stock
* Correct typo on Filter by Stock controls
* Replace custom checkbox with CheckboxControl component from the checkout package.
* Remove opacity on product count for checkbox label so its the same color as the label.
* Update snapshot tests with new component usage for filter by stock
* Update block title from Filter Products by Stock to Filter by Stock
* Update reset button behaviour to clear selections immediately regardless of whether the Apply Filters button is active or not.
* Pass option value as ID to satisfy E2E tests
* Update snapshot tests for stock filter
* Reset checked state on reset for when they have filters checked but not applied.
* make toggle control full width
* add inlineInput attribute
* add inlineInput sidebar setting
* add inlineInput help text
* style the filter button
* style price input
* wip: reset button
* clicking on reset button will reset the price query
* support inline input fields
* price text styling update
* fix reset button font size
* add loading placeholder to all elements
* fix filter button style
* update range slider thumb and track style
* fix loading placeholder for non empty query
* move reset button into FilterSubmitButton component
* try: render placeholder serverside
* update filter button label
* Revert "try: render placeholder serverside"
This reverts commit 98f08efdb8048b8f78c7476b774d1128c1d31295.
* remove LoadingPlaceholder component
* remove Price: prefix from the current displayed price range
* update labels
* extract reset button as a dedicated component
* update price text section
* update reset button behavior
* avoid breaking filter submit button style for other filter blocks
* rename block to Filter by Price
* fix e2e test
* remove border support
* adjust padding for elments
* rename panel title
* Make the inline option enabled by default and fix frontend rendering
* Make the `Price Range Selector` uppercase
* Show `Reset` button only when a selection has been made
* Revert the `save` change to avoid the 'Block Recovery Prompt'
Co-authored-by: Alba Rincón <alba.rincon@automattic.com>
* Add default page notice
* show notice all inner blocks
* support flow when page isnt saved
* switch from where we get the current post id
* update lock
* fix types
* Remove old compatibility notices from Cart and Checkout
* Move useCompatibilityNotice to sidebar-compatibility-notice directory
* Remove old CartCheckoutCompatibilityNotice
* Create sidebar compatibility notice hoc
* Add isCartOrCheckoutOrInnerBlock function
* Refactor defaultNotice to use new isCartOrCheckoutOrInnerBlock func
* Remove BlockSettings from checkout edit and export from checkout-shared
* Change so component still renders, it is just hidden with display: none
This is required because when it returns null the component gets skipped from being added to the Slot, then when it does return a component, then it gets rendered at the bottom of the Slot. By ensuring it always renders we can have it at the top all the time.
* Set the priorities of the hoc filters so compat notice renders first
* Make isCartOrCheckoutInnerBlock a hook
* Remove old compatibility notice related tests
* Remove BlockSettings from Cart
* Remove withDefaultNotice hoc
* Include DefaultNotice in compatibility notice
* Remove DefaultNotice from Checkout
* Rename withSidebarCompatibilityNotice to withSidebarNotices
This is because it includes the sidebar compatibility notice and the default notices
* Remove useIsCartOrCheckoutOrInnerBlock hook
* Remove compatibility notice code from tests
* Revert DefaultNotice back to the old one
* Remove unused components
* Remove withBlockSettings HOC and fix TS types
This is an abstraction that is no longer required, we can just include BlockSettings in the Cart and Checkout blocks
* Remove CartCheckoutFeedbackPrompt from BlockSettings
It will be included in sidebar-notices instead
* Fix TS Types in DefaultNotice
* Add BlockSettings to cart and checkout edit
* Editor: Add feedback box to the Cart & Checkout Inner Blocks (https://github.com/woocommerce/woocommerce-blocks/pull/6881)
* Show "Feedback prompt" for all inner blocks
* Fix the "feedback" notice position for these blocks
The "checkout fields", "checkout billing address" and
"checkout shipping address" have the addressFields option which
gets rerendered and placed at the bottom of the inspector controls.
* Tidy up the address-fields hoc
* Use correct block name to check for billing or shipping address
* Revert "Editor: Add feedback box to the Cart & Checkout Inner Blocks (https://github.com/woocommerce/woocommerce-blocks/pull/6881)"
This reverts commit 5f3d6cf15ce08d9c303e62ec3e0d0315ead1281f.
* Add hack to get feedback prompt to render last
* Fix TS errors for context and attributes
* Include CartCheckoutFeedbackPrompt in accountcontrols & addresscontrols
* Do not include feedback prompt if on an address block or contact info
* Remove unused hoc for address fields
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
* Added Cross-sells object and schema for the API Cart response.
* Cross-sells are now WC_Product objects that pass through the visibility filter.
* Removed redundant check.
* Updated function doc comment.
* Cleaned up imports.
* Cross-sells item schema (extension of ProductSchema) was removed, and replaced by ProductSchema itself. Cross-sells are direct product representation, and extending this goes out of scope for the task at hand.
* Unit testing for cart response containing cross-sell products.
* Increase `schema_version` to add the new `wc_blocks_use_blockified_templates` flag
If the schema version stored on the db is <= 260 means the plugin is being updated
to the new version and we should keep using the old templates, not the blockified ones.
* After the theme is switched we check if we need to update the flag to
start loading the blockified templates or not.
* Get the templates from the blockified folder if the flag is set to true on the db
* Add temporary blockified template for testing purposes
* Inline variable
* Improve comment
* Use blockified templates on new installs with block themes only
* Don't use blockified templates when switching to a non FSE theme
* Fix condition
* Add tests for the option value
* Move the check to use blockified templates
* WIP
* WIP
* Add migration strategy
* Move the blockified templates to the templates folder and filter them depending on the option
* Fix tests and start using the Options constants
* Fix migration, the `should_use_blockified_product_grid_templates` and tests
* Rename tests and move to Utils folder
* add Migration class test
* try
* remove PHP
* add composer
* Replace the blockified templates with a temporary version
* Fix tests
* add comment
* Add feature gating for experimental builds
* Inject the package to the controller
* test
* Change blocks.ini
* debug
* Remove debug info
* fix test
* fix tests
* try now
* using composer cache
* install deps
* test
* Remove unnecessary extra key
* Add cache actions
* Undo tests change
* Fix readme format
Co-authored-by: Luigi <gigitux@gmail.com>
* wip
* set editor using env var instead
* fix attribute missing issue when watching the test
* wip php templates test
* Add E2E tests for the Filter Products By Price Block woocommerce/woocommerce-blocks#6363
add E2E tests for the Filter Products By Price Block
* Add E2E tests for the Filter Products By Price Block woocommerce/woocommerce-blocks#6363
add E2E tests for the Filter Products By Price Block
* create clickLink util
* Add E2E tests for the Active Filters Block woocommerce/woocommerce-blocks#6377
add E2E tests for the Active Filters Block
* Add E2E tests for the Filter Products By Attribute Block woocommerce/woocommerce-blocks#6322
add E2E tests for the Filter Products By Attribute Block
* Add E2E tests for the Filter Products By Stock Block woocommerce/woocommerce-blocks#6323
add E2E tests for the Filter Products By Stock Block
* improve checks
* improve checks
* improve checks
* remove globals.d.ts file
* replace waitForTimeout
* create clickLint utils
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Add E2E tests for the Filter Products By Price Block woocommerce/woocommerce-blocks#6363
add E2E tests for the Filter Products By Price Block
* Add E2E tests for the Filter Products By Attribute Block woocommerce/woocommerce-blocks#6322
add E2E tests for the Filter Products By Attribute Block
* Add E2E tests for the Filter Products By Stock Block woocommerce/woocommerce-blocks#6323
add E2E tests for the Filter Products By Stock Block
* improve checks
* improve checks
* remove globals.d.ts file
* replace waitForTimeout
* Add E2E tests for the Filter Products By Attribute Block woocommerce/woocommerce-blocks#6322
add E2E tests for the Filter Products By Attribute Block
* Add E2E tests for the Filter Products By Stock Block woocommerce/woocommerce-blocks#6323
add E2E tests for the Filter Products By Stock Block
* improve checks
* improve checks
* remove globals.d.ts file
* Add E2E tests for the Filter Products By Attribute Block woocommerce/woocommerce-blocks#6322
add E2E tests for the Filter Products By Attribute Block
* improve checks
* Try to fix account.test.js
* Remove language installations for woo core and wp core and take screenshots
* Upload screenshots to artifacts
* npm install instead of npm ci
* Upload artifacts not matter what
* fsdf
* fsdfsf
* remove screenshoting from account.test.js and only run checkout-terms.test.js
* Print NODE_ENV
* Better handling of overriding wp-env.json
* Run all tests
* Re-enable translations for WP and Woo
* Wait for Cart & Checkout blocks to load before moving on
* Uncomment github actions
* Try to fix shipping test
* fill checkout before placing order, duuuh
* Wait until networkidel0 instead of domcontentloaded for page navigations
* Fix account.test.js
* change visitBlockPage() to use Promise.all()
* Remove screenshot taking
* I think Promise.all() is being funny and not throwing properly, testing
* wait for checkbox to be visible before clicking
* Remove try catch around Promise.all()
* Fix linting issues
* Remove screenshot dir
* Raluca feedback:
* Timeout back to 30000
* Login to merhcant before changing settings
* merchant.logout()
* 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>
* Add test to check if T&C and Privacy links are visible
* Fix filling wrong type of form error
With a virtual product we shouldn't need to fill the shipping details
We need to fill the billing instead
* Fix undefined 'termsCheckbox' bug
* Fix terms checkbox name
* Activate test case
* Replace static URL with dynamic one
* Convert external plugin into mock
* Fix JS linting issue
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
* Enable Attribute Filter block to work with the PHP rendered Classic Template block
* Check for presence of option before rendering it
* improve filter product by attribute
* fix pagination problem
* fix check when two filter block with same attribute are used
* fix filter by stock for PHP templates
* fix naming and comment
* Update filter key in ClassicTemplate
* Update stock filter block for PHP templates when the filter button is enabled
* Remove unused useEffect and fix ESLint error
* Set active stock filter and track using local state
* ESLint fix
* Remove unncessary dependencies from useEffect
Co-authored-by: tjcafferkey <tjcafferkey@gmail.com>
* Cart & Checkout translations test use the already installed language nl_NL
* Extra timeout when checking for shipping and billing addresses
* wait for selector instead of increase timeout
* Change waitForSelector selector:
* Clean up
* Increase idleTime for waitForNetworkRequest
* Fix random timeouts and increase timeout of verifying shipping option
* feedack
* Register missing C & C inner blocks and update fallback template for older C & C versions
This will fix the issues with missing order summary inner blocks: Coupons (both in C & C blocks) and the Cart header. The issue was happening because, for example, for Cart the coupons were registred on the on frontend, but it just wasn't forced in the attributes. Because it also wasn't added to the PHP fallback layout, the render function didn't include it. For the Checkout block the coupons inner block wasn't registered at all.
* Revert changes to Checkout.php, we don't need to test for inner blocks
* Revert "Revert changes to Checkout.php, we don't need to test for inner blocks"
This reverts commit fc39535f8476d02e35353374d9434a8723458cfa.
* Fix the returned template for older Checkout block iterations
* Fix Cart and Checkout templates to accommodate the Summary order inner blocks
* Hide coupon form div from inner blocks if coubons are not enabled
* Fix checkout coupon tests in checkout
They have been written for logged in user
* Fix Order Summary Heading inner block's default text
* Update comments with better wording
* Revert "Hide coupon form div from inner blocks if coubons are not enabled"
This reverts commit ab09021b923fad4218b3016e47760ad07f6bc960.
* rename some things
* Refactor e2e tests
* remove only from checkout test
* Typo in test
* Add --testPathIgnorePatterns performance back into package.json
* Niels feedback and fix a test
* Update import from utils
* Increase timeout of translations test to 30000
* Wait for network idle in goToCart and goToCheckout
* Increase timeout to 30000
* fix E2E tests
* try fix
* test
* test
* test
* another test
* fix test
* 60s timeout
* test
* Update product constants
* Simplify orderSummary check
* Go back to page.$
Co-authored-by: Luigi <gigitux@gmail.com>
* Check for performance file existence before running
* check reports/performance-report.json file exists on setup
Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
* Add performance script to measure load times of cart and checkout blocks
* Temp commit
* Temp commit
* Temp commit
* Remove specific test from performance e2e command
* Add performance reporter
* Add step to clean performance file before running tests
* Add test report constant & average and logPerformanceResult test utils
* Update uses of product name constant
* Add cart coupon performance test
* Check if report file is empty before parsing
* Limit performance tests to only ones in performance directory
* Round the averages and add a linebreak after each entry in the log
* Fix formatting of report and only output after all tests
* Log each loading metric as an individual data point
* Improve formatting
* Get load times in ms from profiler
* Revert changes to fixtures
* Remove trace.json from git
* Remove checkout test file (tests not implemented)
* Check performance log file exists before truncating it
* Fix checkout coupon test
* Remove console logs
* Revert to use virtual products after rename of constant
* Ignore performance tests when running regular e2e tests
* Feedback changes
* Tidy up
* Fix packag-log.json:
Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
* Add "single-use" coupon to the fixture data
* Create a first draft of the coupon e2e test
* Create single use coupon code constant
* Create "applyCouponFromCheckout" function
* Remove the "single-use" coupon from the fixture data
* Setup coupon creation using Woo's Rest API
* Add single-use coupon E2E test
* Move discount XPath definition to the expressions file
* Clean comments
* Remove unnecessary delay function
* Refactor to a more human friendly check
* Clear the setup in the afterAll branch (delete coupon)
Co-authored-by: Saad Tarhi <saad.tarhi@automattic.com>
* 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>
* 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
* Cleanup e2e jest config from moduleFileExtensions
moduleFileExtensions by default support js, ts, tsx etc.
* convert legacy-template-blocks e2e test to TS
* clean up jest.config.json moduleFileExtensions
unnecessary defaults override
* Shopper can have different shipping and billing addresses
* Shopper can have different shipping and billing addresses
* Shopper can have different shipping and billing addresses
* Correct billing field IDs
* Remove unused variable
* Remove unused timeout
* Remove unused commands
* Activate company field using setCheckbox
* Deactivate company field using unsetCheckbox
* Remove obsolete command
* Empty cart before and after each test
* Remove obsolete import
* Check billing and shipping company
* Remove manual code with unsetCheckbox
* Fill company if field exist
* Get checkbox ID from label
* Remove duplicate company field toFill method
Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
Co-authored-by: Saad Tarhi <saad.tarhi@automattic.com>
* upgrade wordpress/scripts to 22.3
* update jest config/setup
* add explicit-exports-references plugin
to handle payment-method-config.tsx spying on external methods
the way code is output now changed and tests like this would not
work anymore as transpilet files were no longer using exports but
local references to methods.
* missing snapshot
* make cart-products E2E test more stable
* surppress eslint error in test file
* fix css stylelint issues
* update eslint-plugin-woocommerce eslint package
* remove temp test:e2e:start script
* re-run
* add stylelint as recommended extension
* remove redundant types (provided by packages now)
* patch update @testing-library/jest-dom
* 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 ⚡️
* Create "isLoggedIn" shopper function
This function checks if a shopper is logged in
* Add "Can see warnings when form is incomplete" test
* Optimize login check and logout process for the test
Co-authored-by: Saad Tarhi <saad.tarhi@automattic.com>
* Add handling of editor context via GUTENBERG_EDITOR_CONTEXT env var
* Fix flaky tests around editing templates
* Wait for save template response to complete
* Add XPath expressions
* Add "setCartQuantity" utility function
* Add "productIsInCart" utility function
* Add "update product qty" e2e test
* Clean up test file
* Fix test on headless mode
* Add Increase/Decrease qty test cases
* Decrease the query chain for better maintainability
* Rename expression functions/file for more clarity
* Resolve conflict with trunk
Co-authored-by: Saad Tarhi <saad.tarhi@automattic.com>
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>
* Remove X- Prefixes from custom headers
* Fix docs
* Handle deprecated X-WC-Store-API-Nonce header if received
* Send old nonce until future version removes this
* Add todo and cut off date
* wc_deprecated_argument
* Update todo name
* typo
* Back compat in batch
* Flip Nonce logic to make it easier to support both in client bw compat logic
* 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>
* Refactor e2e tests slightly for better efficiency
* Add "proceedToCheckout" shopper method & refactor code
* Use "beforeEach" in case we add more test cases
I've kept the "afterAll" function to reset any side effects at the end
of this file's tests
* Use "beforeEach" in "checkout-place-order-as-guest" file
* Use BASE_URL in shopper.block.goToBlockPage
Co-authored-by: Saad Tarhi <saad.tarhi@automattic.com>
* 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>
* Add "goToCheckout" method in "shopper.block"
Instead of using "shopper.goToCheckoutBlock" method, it will much easier
to maintain the following structure "shopper.block.goToCheckout"
* Create a constant for billing details
* Create "fillBillingDetails" shopper method
* Add "placeOrder" method to "shopper"
* Enable "Cash on delivery" payment method for our test
* Update "@woocommerce/e2e-utils" package
Some new useful e2e utility functions weren't avaiable in the previous version
* Add E2E test for "Can place an order as guest"
* Fix mini-cart failing E2E tests
In case this fixwoocommerce/woocommerce-blocks#6006 isn't merged yet, this commit can be used to pass all
E2E tests
Co-authored-by: Saad Tarhi <saad.tarhi@automattic.com>
* Shopper → Cart → Can proceed to checkout
* Refactor the code for E2E testing
Introduce some discussed solution to structure and optimize the code
* Resolve some conflicts with the trunk branch
* Remove method overriding and refactor code
We are trying to avoid overriding exiting E2E Woo's utility functions
Instead we can use our own "shopper.block"
* Use a consistent constant naming convention
Co-authored-by: Saad Tarhi <saad.tarhi@automattic.com>
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).
Closeswoocommerce/woocommerce-blocks#5660
* Introduce 'wooocommerce_store_api_validate_cart' action
This action can be used by third party developers to add extra 'errors' in cart route responses. This is meant to function as a replacement of the legacy 'woocommerce_check_cart_items' hook.
* Introduce a new 'wooocommerce_blocks_draft_order_updated' action
The new action can be used to modify the finalized draft order object.
Additionally, developers can use it to throw a RouteException in order to prevent access to the checkout block.
The PR also shuffles some existing code that checks the order instance and sets the draft order ID before the 'woocommerce_blocks_checkout_update_order_meta' gets fired.
* Fix PHPCS
* Revert changes to Checkout route
* Add some extra content to the 'woocommerce_blocks_checkout_update_order_meta' docblock on the effect of exceptions thrown from callbacks
* Add __experimental prefix to 'wooocommerce_store_api_validate_cart' action
* Remove long ooo
* Add example
* Refactor cart error getters as wrappers to the validate functions
* Refactor stock_exceptions_to_wp_errors to return a single wp error.
* Add type hint in custom exception
* Fix namespace versioning and some minor improvements
* Move InvalidCartException catcher from AbstractCartRoute to AbstractRoute
* Introduce the __experimental_woocommerce_store_api_cart_errors filter
* Handle all notices and group them into a single WP_Error instance
* Cleanup doc and update example
* Cleanup NoticeHandler
* Fix doc
* Fix WP_Error namespace
* Update NoticeHandler unit tests
* Fix Unit tests typo
* Add docs to tests to bypass precommit scripts
* Refactor wp error grouping with merge_from
* Remove previous cart getters and refactor the get_cart_errors
* Fix CartSchema error getter and minor fixes
* Revert NoticeHandler exception namespace
* Unit test fix for get_cart_errors
* Switch back to do_action
* Update the example doc
* Duplicate use statement
* Update docblock in validate_cart() method for validation hooks
* Update action docs
* Remove __experimental prefix
Co-authored-by: Manos Psychogyiopoulos <psyx@somewherewarm.com>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Add constants for C & C pages in our E2E tests
Inspired by WC E2E this will avoid going to admin to find out the links for these pages.
* Select C & C pages by using the main navigation links
* Fix function calls
* Revert back to using constants for C & C block pages' URLs
reverts 9587a0bd5efa5d97b484cd8d1bf927ff50f8e014 and bd7e2f996792d887756c0a0f4a10e6886574e77b
* Ensure screenshots can be attached in jest html report
* Force tests to fail in ci
* Console log for testing
* Console log for testing
* Check on hook failure as well as test failure
* Revert "Force tests to fail in ci"
This reverts commit 6efebd63bba4792214f5b24824fb405cf38b1367.
* Take full page screenshot only when error type is not hook_failure
* Remove console log
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
* 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>
* 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
* Add fake items fixture
* Add test for rendering items in sidebar
* Add test for items with addons
* Add textContentMatcherAccrossSiblings helper
This is needed to match text when it's spread over a few elements
* Add test to ensure subtotal renders correctly
* Add test to ensure discounts are rendered correctly
* Add test to ensure fees are shown correctly
* Add test to check coupon entry form isn't present when coupons disabled
* Add more mock data to useStoreCart
* Mock useShippingDataContext
* Rename useStoreCartValue to useStoreCartReturnValue
* Remove unnecessary coupon button test
This should be tested within the TotalsCoupon component
* Add tests for shipping presence
* Add test for coupons
* Remove cart items fixtures
These are no longer needed
* Move the findByText utils to the utils folder
* Move inner blocks test to correct directory
* 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>
* Link order controller to cart routes
* Remove order controller from checkout route
* Fix PHP warnings in abstract schema
* Fix PHP warnings in abstract route
* Update shipping phone handling
* Includes are handled in core now
* Remove maybe_update_order_from_customer
* Add cart_updated routine to all cart routes
* Remove abstract method
* Remove test for woocommerce_blocks_cart_update_order_from_customer_request
* Remove do_order_callback
* add view switcher for mini cart contents block
* editor view switcher
* update mini cart template file
* render the empty state template parts for the Mini Cart Block woocommerce/woocommerce-blocks#4674
render the empty state template parts for the Mini Cart Block woocommerce/woocommerce-blocks#4674
* update selector
* allow empty mini cart block to add all blocks
* fix tests; improve code style
* install @wordpress/block-editor package
* fix warning on frontend side
* block-editor package is not necessary
* merge attributes object
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* 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