Skip to content

Commit

Permalink
run product-configurator e2e tests on Wonderful Testing Framework (#1…
Browse files Browse the repository at this point in the history
…7913)

with one script in the root folder the product configurator e2e tests can be called from the Wonderful Testing Framework with the command: ./run-spartacus-product-configurator-e2es.sh cpq
./run-spartacus-product-configurator-e2es.sh b2c
./run-spartacus-product-configurator-e2es.sh b2c_flaky or the tests can be run locally with the second option "local" against specific ccv2 server. I.e.: ./run-spartacus-product-configurator-e2es.sh b2c_flaky local
  • Loading branch information
alepil authored Oct 12, 2023
1 parent 9ac4e3b commit 7849d3e
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"e2e:run:ci:epd-visualization": "npm --prefix ./projects/storefrontapp-e2e-cypress run cy:run:ci:epd-visualization",
"e2e:run:ci:ccv2": "npm --prefix ./projects/storefrontapp-e2e-cypress run cy:run:ci:ccv2",
"e2e:run:ci:ccv2-b2b": "npm --prefix ./projects/storefrontapp-e2e-cypress run cy:run:ci:ccv2-b2b",
"e2e:run:ci:ccv2-cpq": "npm --prefix ./projects/storefrontapp-e2e-cypress run cy:run:ci:ccv2-cpq",
"e2e:run:ci:ccv2-product-configurator": "npm --prefix ./projects/storefrontapp-e2e-cypress run cy:run:ci:ccv2-product-configurator",
"e2e:run:ci:mcs": "npm --prefix ./projects/storefrontapp-e2e-cypress run run cy:run:ci:mcs",
"e2e:run:ci:cdc-b2b": "npm --prefix ./projects/storefrontapp-e2e-cypress run cy:run:ci:cdc-b2b",
"e2e:run:ci:segment-refs": "npm --prefix ./projects/storefrontapp-e2e-cypress run cy:run:ci:segment-refs",
Expand Down
2 changes: 1 addition & 1 deletion projects/storefrontapp-e2e-cypress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"cy:run:ci:core:b2b": "cypress run --config-file cypress.config.ci.ts --env BASE_SITE=powertools-spa,OCC_PREFIX_USER_ENDPOINT=orgUsers --record --key $CYPRESS_KEY --tag \"b2b,core\" --parallel --ci-build-id $BUILD_NUMBER --group B2B --spec \"cypress/e2e/b2b/regression/**/*.core-e2e.cy.ts\"",
"cy:run:ci:ccv2": "cypress run --config-file cypress.config.ci.ts --config baseUrl=$ENDPOINT_URL_PUBLIC_SPARTACUS --reporter junit --reporter-options mochaFile=results/spartacus-test-results-[hash].xml --env API_URL=$ENDPOINT_URL_PUBLIC_API --spec $E2ES_TO_RUN",
"cy:run:ci:ccv2-b2b": "cypress run --config-file cypress.config.ci.ts --config baseUrl=$ENDPOINT_URL_PUBLIC_SPARTACUS --reporter junit --reporter-options mochaFile=results/spartacus-test-results-[hash].xml --env API_URL=$ENDPOINT_URL_PUBLIC_API,BASE_SITE=powertools-spa,OCC_PREFIX_USER_ENDPOINT=orgUsers --spec \"cypress/e2e/cx_ccv2/regression/b2b/**/*.e2e.cy.ts\"",
"cy:run:ci:ccv2-cpq": "cypress run --config-file cypress.config.ci.ts --config baseUrl=$ENDPOINT_URL_PUBLIC_SPARTACUS --reporter junit --reporter-options mochaFile=results/spartacus-test-results-[hash].xml --env API_URL=$ENDPOINT_URL_PUBLIC_API,BASE_SITE=powertools-spa,OCC_PREFIX_USER_ENDPOINT=orgUsers --spec \"cypress/e2e/**/cpq-configuration.ccv2-e2e.cy.ts\"",
"cy:run:ci:ccv2-product-configurator": "cypress run --config-file cypress.config.ci.ts --config baseUrl=$ENDPOINT_URL_PUBLIC_SPARTACUS --reporter junit --reporter-options mochaFile=results/spartacus-test-results-[hash].xml --env API_URL=$ENDPOINT_URL_PUBLIC_API,BASE_SITE=$E2E_BASE_SITE,OCC_PREFIX_USER_ENDPOINT=orgUsers --spec $E2ES_TO_RUN",
"cy:run:ci:mcs": "cypress run --config-file cypress.config.ci.ts --config baseUrl=$ENDPOINT_URL_PUBLIC_SPARTACUS --reporter junit --reporter-options mochaFile=results/spartacus-test-results-[hash].xml --env API_URL=$ENDPOINT_URL_PUBLIC_API --spec \"cypress/e2e/cx_mcs/regression/b2c/**/*e2e.cy.ts\"",
"cy:run:ci:ssr": "cypress run --config-file cypress.config.ci.ts --config baseUrl=http://localhost:4000 --record --key $CYPRESS_KEY --tag \"ssr,all\" --parallel --ci-build-id $BUILD_NUMBER --group SSR --spec \"cypress/e2e/ssr/pages.core-e2e.cy.ts\" --reporter junit --reporter-options mochaFile=results/e2e-test-ssr-[hash].xml",
"cy:run:ci:cds": "cypress run --config-file cypress.config.ci.ts --record --key $CYPRESS_KEY --tag \"2011,b2c,all-cds\" --group CDS --spec \"cypress/e2e/vendor/cds/**/*.core-e2e.cy.ts\"",
Expand Down
41 changes: 41 additions & 0 deletions run-spartacus-product-configurator-e2es.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash
# This script is invoked from https://github.tools.sap/cx-commerce/wonderful-testing-framework/blob/main/resources/wtf/config.yaml
# By default, the e2es for b2c product-configurator will be executed without parameters.
# Supported options include "cpq", "b2c" and "b2c_flaky"
# To execute the test locally, include a second parameter "local". The cpq tests will run locally against ccv2 p3 and the b2c tests against ccv2 s7

param=${1:-"b2c"} # Default to "b2c" if no parameter provided

if [ "$2" = "local" ]; then
export ENDPOINT_URL_PUBLIC_SPARTACUS="https://spartacusstore.cg79x9wuu9-eccommerc1-s7-public.model-t.myhybris.cloud"
export ENDPOINT_URL_PUBLIC_API="https://api.cg79x9wuu9-eccommerc1-s7-public.model-t.myhybris.cloud"
export ENDPOINT_URL_PUBLIC_SPA_POWERTOOLS="https://b2bspastore.cg79x9wuu9-eccommerc1-p3-public.model-t.myhybris.cloud"
[ "$param" = "cpq" ] && export ENDPOINT_URL_PUBLIC_API="https://api.cg79x9wuu9-eccommerc1-p3-public.model-t.myhybris.cloud"
fi

# Update variables based on the provided parameter
case "$param" in
"cpq")
export E2E_BASE_SITE="powertools-spa"
export ENDPOINT_URL_PUBLIC_SPARTACUS=$ENDPOINT_URL_PUBLIC_SPA_POWERTOOLS
export E2ES_TO_RUN="'cypress/e2e/**/cpq-configuration.ccv2-e2e.cy.ts'"
;;
"b2c")
export E2E_BASE_SITE="electronics-spa"
export E2ES_TO_RUN="'cypress/e2e/**/product_configurator/*-configurator*e2e.cy.ts'"
;;
"b2c_flaky")
export E2E_BASE_SITE="electronics-spa"
export E2ES_TO_RUN="'cypress/e2e/**/*-configurator*e2e*flaky.cy.ts'"
;;
*)
echo "Invalid parameter. Please provide a valid parameter."
exit 1
;;
esac

# Install cypress standalone dependencies
(cd projects/storefrontapp-e2e-cypress && npm install)

# run spartacus ccv2 e2es for product-configurator
npm run e2e:run:ci:ccv2-product-configurator

0 comments on commit 7849d3e

Please sign in to comment.