From 8e57805282856976c1503e8977dc67479954b864 Mon Sep 17 00:00:00 2001 From: Boubker Bribri Date: Fri, 10 Sep 2021 11:50:21 +0200 Subject: [PATCH 1/8] Run E2E tests on master --- .github/workflows/e2e_nightly_upgrade.yml | 9 ++++++++- tests/e2e/globals.js | 1 + tests/e2e/scenarios/01_install.js | 2 +- tests/e2e/scenarios/02_upgrade.js | 3 ++- tests/e2e/scripts/copy_reports.sh | 3 ++- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/e2e_nightly_upgrade.yml b/.github/workflows/e2e_nightly_upgrade.yml index e54cfc1ae..5169016a6 100755 --- a/.github/workflows/e2e_nightly_upgrade.yml +++ b/.github/workflows/e2e_nightly_upgrade.yml @@ -1,6 +1,7 @@ name: Nightly upgrades with user inferfaces on: + push: schedule: - cron: "0 6 * * *" # Every day at 06:00Am @@ -53,12 +54,16 @@ jobs: ps_target_version: ${{ fromJson(needs.get_ps_target_versions.outputs.target_versions) }} + module_branch: ['dev', 'master'] + fail-fast: false steps: # Setup PrestaShop and Install Autoupgrade module - uses: actions/checkout@v2 + with: + ref: ${{ matrix.module_branch }} # Build PrestaShop with docker-compose - uses: shivammathur/setup-php@v2 @@ -93,6 +98,7 @@ jobs: env: URL_FO: "http://localhost:8001/" PS_VERSION: ${{ matrix.ps_start_version }} + AUTOUPGRADE_VERSION: ${{ matrix.module_branch }} - name: Download nightly build shell: bash @@ -110,6 +116,7 @@ jobs: PS_VERSION: ${{ matrix.ps_start_version }} PS_VERSION_UPGRADE_TO: ${{ matrix.ps_target_version.for_test }} ZIP_NAME: ${{ matrix.ps_target_version.filename }} + AUTOUPGRADE_VERSION: ${{ matrix.module_branch }} - uses: actions/upload-artifact@v2 name: Upload failed screenshots @@ -121,7 +128,7 @@ jobs: # Upload Mochawesome reports - name: Rename Mochawesome report if: ${{ always() }} - run: ./tests/e2e/scripts/copy_reports.sh ${{ env.reports_directory }} ${{ matrix.ps_start_version }} ${{ matrix.ps_target_version.branch }} + run: ./tests/e2e/scripts/copy_reports.sh ${{ env.reports_directory }} ${{ matrix.ps_start_version }} ${{ matrix.ps_target_version.branch }} ${{ matrix.module_branch }} - uses: actions/upload-artifact@v2 name: Upload Mochawesome report diff --git a/tests/e2e/globals.js b/tests/e2e/globals.js index c3e1159da..5a285d888 100755 --- a/tests/e2e/globals.js +++ b/tests/e2e/globals.js @@ -5,3 +5,4 @@ global.PS_RESOLVER_VERSION = { TO: global.PS_VERSION_UPGRADE_TO.substr(0, global.PS_VERSION_UPGRADE_TO.lastIndexOf('.')), }; global.ZIP_NAME = process.env.ZIP_NAME; +global.AUTOUPGRADE_VERSION = process.env.AUTOUPGRADE_VERSION || 'dev'; diff --git a/tests/e2e/scenarios/01_install.js b/tests/e2e/scenarios/01_install.js index 9beb1c507..ab05cb6f8 100644 --- a/tests/e2e/scenarios/01_install.js +++ b/tests/e2e/scenarios/01_install.js @@ -31,7 +31,7 @@ Check PS version Log in Install 1-Click Upgrade module */ -describe(`Install '${moduleToInstall.name}' module`, async () => { +describe(`[${global.AUTOUPGRADE_VERSION}] Install '${moduleToInstall.name}' module`, async () => { // before and after functions before(async function () { browserContext = await helper.createBrowserContext(this.browser); diff --git a/tests/e2e/scenarios/02_upgrade.js b/tests/e2e/scenarios/02_upgrade.js index 174c033b7..02525fbf7 100755 --- a/tests/e2e/scenarios/02_upgrade.js +++ b/tests/e2e/scenarios/02_upgrade.js @@ -38,7 +38,8 @@ Upgrade Log out Check new version */ -describe(`Upgrade PrestaShop from '${global.PS_VERSION}' to '${global.PS_VERSION_UPGRADE_TO}'`, async () => { +// eslint-disable-next-line max-len +describe(`[${global.AUTOUPGRADE_VERSION}] Upgrade PrestaShop from '${global.PS_VERSION}' to '${global.PS_VERSION_UPGRADE_TO}'`, async () => { // before and after functions before(async function () { browserContext = await helper.createBrowserContext(this.browser); diff --git a/tests/e2e/scripts/copy_reports.sh b/tests/e2e/scripts/copy_reports.sh index 8246adada..0158a1804 100755 --- a/tests/e2e/scripts/copy_reports.sh +++ b/tests/e2e/scripts/copy_reports.sh @@ -3,6 +3,7 @@ REPORTS_PATH=$1 PS_START_VERSION=$2 PS_TARGET_VERSION=$3 +MODULE_BRANCH=$4 mkdir -p $REPORTS_PATH -cp ./tests/e2e/mochawesome-report/mochawesome.json $REPORTS_PATH/upgrade-from-$PS_START_VERSION-to-$PS_TARGET_VERSION.json +cp ./tests/e2e/mochawesome-report/mochawesome.json $REPORTS_PATH/$MODULE_BRANCH-upgrade-from-$PS_START_VERSION-to-$PS_TARGET_VERSION.json From 5c86dc2a6a38b0305c987bc0c7ab69ce43dc7aae Mon Sep 17 00:00:00 2001 From: Boubker Bribri Date: Fri, 10 Sep 2021 14:22:28 +0200 Subject: [PATCH 2/8] Rewrite needed files for master branch --- .github/workflows/e2e_nightly_upgrade.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/e2e_nightly_upgrade.yml b/.github/workflows/e2e_nightly_upgrade.yml index 5169016a6..9fd0970cb 100755 --- a/.github/workflows/e2e_nightly_upgrade.yml +++ b/.github/workflows/e2e_nightly_upgrade.yml @@ -62,8 +62,6 @@ jobs: # Setup PrestaShop and Install Autoupgrade module - uses: actions/checkout@v2 - with: - ref: ${{ matrix.module_branch }} # Build PrestaShop with docker-compose - uses: shivammathur/setup-php@v2 @@ -85,8 +83,18 @@ jobs: # Install Module with user interface - name: Setup Node uses: actions/setup-node@v2 - with: - node-version: 10 + + - run: | + cp -r .github .github_dev + cp -r tests/e2e tests/e2e_dev + cp docker-compose.yml docker-compose.dev.yml + git fetch origin ${{ matrix.module_branch }} + git checkout ${{ matrix.module_branch }} + rm -r .github docker-compose.yml tests/e2e + cp -r .github_dev .github + cp -r tests/e2e_dev tests/e2e + cp docker-compose.dev.yml docker-compose.yml + if: ${{ matrix.module_branch != 'dev' }} - name: Install dependencies run: npm install From be5beb12afb4d24259a5a1ee2ad0307ec33ce237 Mon Sep 17 00:00:00 2001 From: Boubker Bribri Date: Fri, 10 Sep 2021 14:25:11 +0200 Subject: [PATCH 3/8] Fix last commit --- .github/workflows/e2e_nightly_upgrade.yml | 24 +++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/e2e_nightly_upgrade.yml b/.github/workflows/e2e_nightly_upgrade.yml index 9fd0970cb..4334e8881 100755 --- a/.github/workflows/e2e_nightly_upgrade.yml +++ b/.github/workflows/e2e_nightly_upgrade.yml @@ -63,6 +63,18 @@ jobs: # Setup PrestaShop and Install Autoupgrade module - uses: actions/checkout@v2 + - run: | + cp -r .github .github_dev + cp -r tests/e2e tests/e2e_dev + cp docker-compose.yml docker-compose.dev.yml + git fetch origin ${{ matrix.module_branch }} + git checkout ${{ matrix.module_branch }} + rm -r .github docker-compose.yml tests/e2e + cp -r .github_dev .github + cp -r tests/e2e_dev tests/e2e + cp docker-compose.dev.yml docker-compose.yml + if: ${{ matrix.module_branch != 'dev' }} + # Build PrestaShop with docker-compose - uses: shivammathur/setup-php@v2 name: Setup PHP @@ -84,18 +96,6 @@ jobs: - name: Setup Node uses: actions/setup-node@v2 - - run: | - cp -r .github .github_dev - cp -r tests/e2e tests/e2e_dev - cp docker-compose.yml docker-compose.dev.yml - git fetch origin ${{ matrix.module_branch }} - git checkout ${{ matrix.module_branch }} - rm -r .github docker-compose.yml tests/e2e - cp -r .github_dev .github - cp -r tests/e2e_dev tests/e2e - cp docker-compose.dev.yml docker-compose.yml - if: ${{ matrix.module_branch != 'dev' }} - - name: Install dependencies run: npm install working-directory: ./tests/e2e From f9b578fa1601684668c997ff4ac7c2695128a771 Mon Sep 17 00:00:00 2001 From: Boubker Bribri Date: Fri, 10 Sep 2021 14:29:40 +0200 Subject: [PATCH 4/8] Force delete to avoid error when directory do not exist --- .github/workflows/e2e_nightly_upgrade.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/e2e_nightly_upgrade.yml b/.github/workflows/e2e_nightly_upgrade.yml index 4334e8881..6c5e9b99d 100755 --- a/.github/workflows/e2e_nightly_upgrade.yml +++ b/.github/workflows/e2e_nightly_upgrade.yml @@ -69,10 +69,10 @@ jobs: cp docker-compose.yml docker-compose.dev.yml git fetch origin ${{ matrix.module_branch }} git checkout ${{ matrix.module_branch }} - rm -r .github docker-compose.yml tests/e2e - cp -r .github_dev .github - cp -r tests/e2e_dev tests/e2e - cp docker-compose.dev.yml docker-compose.yml + rm -rf .github docker-compose.yml tests/e2e + mv -r .github_dev .github + mv -r tests/e2e_dev tests/e2e + mv docker-compose.dev.yml docker-compose.yml if: ${{ matrix.module_branch != 'dev' }} # Build PrestaShop with docker-compose From fe45f1c6d9051371c36c884ffe4ec2ba454a7389 Mon Sep 17 00:00:00 2001 From: Boubker Bribri Date: Fri, 10 Sep 2021 14:32:54 +0200 Subject: [PATCH 5/8] Fix moving directories --- .github/workflows/e2e_nightly_upgrade.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e_nightly_upgrade.yml b/.github/workflows/e2e_nightly_upgrade.yml index 6c5e9b99d..89d3b4503 100755 --- a/.github/workflows/e2e_nightly_upgrade.yml +++ b/.github/workflows/e2e_nightly_upgrade.yml @@ -70,8 +70,8 @@ jobs: git fetch origin ${{ matrix.module_branch }} git checkout ${{ matrix.module_branch }} rm -rf .github docker-compose.yml tests/e2e - mv -r .github_dev .github - mv -r tests/e2e_dev tests/e2e + mv .github_dev .github + mv tests/e2e_dev tests/e2e mv docker-compose.dev.yml docker-compose.yml if: ${{ matrix.module_branch != 'dev' }} From 557c7edc89ee5253d508b86e89b305dfaf723996 Mon Sep 17 00:00:00 2001 From: Boubker Bribri Date: Fri, 10 Sep 2021 14:52:07 +0200 Subject: [PATCH 6/8] Include module name for screenshot_names --- .github/workflows/e2e_nightly_upgrade.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e_nightly_upgrade.yml b/.github/workflows/e2e_nightly_upgrade.yml index 89d3b4503..f1e3b492b 100755 --- a/.github/workflows/e2e_nightly_upgrade.yml +++ b/.github/workflows/e2e_nightly_upgrade.yml @@ -130,7 +130,7 @@ jobs: name: Upload failed screenshots if: ${{ always() }} with: - name: failed-steps-for-test-${{ matrix.ps_start_version }}-${{ matrix.ps_target_version.for_test }} + name: failed-tests-${{ matrix.ps_start_version }}-${{ matrix.ps_target_version.for_test }}-${{ matrix.module_branch }} path: ./tests/e2e/screenshots/ # Upload Mochawesome reports From 2820233a20d908c4abec18f9dff864ad84091091 Mon Sep 17 00:00:00 2001 From: Boubker Bribri Date: Fri, 10 Sep 2021 14:52:48 +0200 Subject: [PATCH 7/8] Do not run on push --- .github/workflows/e2e_nightly_upgrade.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/e2e_nightly_upgrade.yml b/.github/workflows/e2e_nightly_upgrade.yml index f1e3b492b..43aa7ccb9 100755 --- a/.github/workflows/e2e_nightly_upgrade.yml +++ b/.github/workflows/e2e_nightly_upgrade.yml @@ -1,7 +1,6 @@ name: Nightly upgrades with user inferfaces on: - push: schedule: - cron: "0 6 * * *" # Every day at 06:00Am From 9c301effeb1d1df40f3a856840f0f93d6ae30f45 Mon Sep 17 00:00:00 2001 From: Boubker Bribri Date: Fri, 10 Sep 2021 15:03:37 +0200 Subject: [PATCH 8/8] Add node version --- .github/workflows/e2e_nightly_upgrade.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/e2e_nightly_upgrade.yml b/.github/workflows/e2e_nightly_upgrade.yml index 43aa7ccb9..18d3c2ee1 100755 --- a/.github/workflows/e2e_nightly_upgrade.yml +++ b/.github/workflows/e2e_nightly_upgrade.yml @@ -94,6 +94,8 @@ jobs: # Install Module with user interface - name: Setup Node uses: actions/setup-node@v2 + with: + node-version: 12 - name: Install dependencies run: npm install