Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run E2E tests on master #404

Merged
merged 8 commits into from
Sep 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions .github/workflows/e2e_nightly_upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,27 @@ 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

- 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 -rf .github docker-compose.yml 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' }}
Comment on lines +65 to +75
Copy link
Contributor Author

@boubkerbribri boubkerbribri Sep 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since some directories/files are not merged on the master branch, adding the same files from the dev branch to be able to run tests.


# Build PrestaShop with docker-compose
- uses: shivammathur/setup-php@v2
name: Setup PHP
Expand All @@ -81,7 +95,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 10
node-version: 12

- name: Install dependencies
run: npm install
Expand All @@ -93,6 +107,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
Expand All @@ -110,18 +125,19 @@ 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
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
- 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
Expand Down
1 change: 1 addition & 0 deletions tests/e2e/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
2 changes: 1 addition & 1 deletion tests/e2e/scenarios/01_install.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/scenarios/02_upgrade.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Copy link
Contributor Author

@boubkerbribri boubkerbribri Sep 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a hack to make tests look like the capture since the nightly site can't handle how to insert and display 2 module's branches.
image

// before and after functions
before(async function () {
browserContext = await helper.createBrowserContext(this.browser);
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/scripts/copy_reports.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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