From 1905534fb8bfd4b179ad2ab20e68d4d830ab5ea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Juh=C3=A9=20Lluveras?= Date: Fri, 9 Feb 2024 10:53:27 +0100 Subject: [PATCH] Improve password-protected Single Product block template to verify correct template is displayed after correct password is introduced (#44452) * Improve password-protected Single Product block template to verify correct template is displayed after correct password is introduced * Add changelog entry --- .../woocommerce-blocks/tests/e2e/bin/scripts/products.sh | 1 - .../templates/single-product-template.block_theme.spec.ts | 7 +++++++ .../44452-update-single-product-password-test-correct | 4 ++++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 plugins/woocommerce/changelog/44452-update-single-product-password-test-correct diff --git a/plugins/woocommerce-blocks/tests/e2e/bin/scripts/products.sh b/plugins/woocommerce-blocks/tests/e2e/bin/scripts/products.sh index 43b36771be9..63658d69042 100644 --- a/plugins/woocommerce-blocks/tests/e2e/bin/scripts/products.sh +++ b/plugins/woocommerce-blocks/tests/e2e/bin/scripts/products.sh @@ -38,7 +38,6 @@ wp wc product update $tshirt_with_logo_product_id --in_stock=false --user=1 sunglasses_product_id=$(wp post list --post_type=product --field=ID --name="Sunglasses" --format=ids) wp post update $sunglasses_product_id --post_password="password" --user=1 - # Enable attribute archives. attribute_ids=$(wp wc product_attribute list --fields=id --format=ids --user=1) if [ -n "$attribute_ids" ]; then diff --git a/plugins/woocommerce-blocks/tests/e2e/tests/templates/single-product-template.block_theme.spec.ts b/plugins/woocommerce-blocks/tests/e2e/tests/templates/single-product-template.block_theme.spec.ts index f101e96cd44..22c9e59e55b 100644 --- a/plugins/woocommerce-blocks/tests/e2e/tests/templates/single-product-template.block_theme.spec.ts +++ b/plugins/woocommerce-blocks/tests/e2e/tests/templates/single-product-template.block_theme.spec.ts @@ -12,6 +12,13 @@ test.describe( 'Single Product template', async () => { await expect( page.getByText( 'This content is password protected.' ).first() ).toBeVisible(); + + // Verify after introducing the password, the page is visible. + await page.getByLabel( 'Password:' ).fill( 'password' ); + await page.getByRole( 'button', { name: 'Enter' } ).click(); + await expect( + page.getByRole( 'link', { name: 'Description' } ) + ).toBeVisible(); } ); test( 'loads the Single Product template for a specific product', async ( { diff --git a/plugins/woocommerce/changelog/44452-update-single-product-password-test-correct b/plugins/woocommerce/changelog/44452-update-single-product-password-test-correct new file mode 100644 index 00000000000..b7ad649a7f3 --- /dev/null +++ b/plugins/woocommerce/changelog/44452-update-single-product-password-test-correct @@ -0,0 +1,4 @@ +Significance: patch +Type: update +Comment: Improve password-protected Single Product block template to verify correct template is displayed after correct password is introduced. +