Skip to content

Commit

Permalink
Test install module for all versions
Browse files Browse the repository at this point in the history
  • Loading branch information
nesrineabdmouleh committed Jan 13, 2025
1 parent ade7232 commit d65250e
Show file tree
Hide file tree
Showing 4 changed files with 146 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/sanity-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Sanity Tests
name: Upgrade CLI
on:
## Check each PR
push:
Expand All @@ -20,7 +20,7 @@ env:
jobs:
ui_test_matrix:
if: github.event.pull_request.draft == false
name: Sanity Tests (Matrix)
name: Upgrade CLI (Matrix)
runs-on: ubuntu-latest
env:
JSON_FILE: ${{ (github.event_name == 'schedule' || (github.event_name == 'pull_request' && github.event.pull_request.head.ref == 'dev' && github.event.pull_request.base.ref == 'master')) && 'nightly.json' || 'sanity.json' }}
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/ui-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: UI Tests
name: Upgrade UI
on:
## Check each PR
push:
Expand All @@ -20,7 +20,7 @@ env:
jobs:
ui_test_matrix:
if: github.event.pull_request.draft == false
name: UI Tests (Matrix)
name: Upgrade UI (Matrix)
runs-on: ubuntu-latest
env:
JSON_FILE: ${{ (github.event_name == 'schedule' || (github.event_name == 'pull_request' && github.event.pull_request.head.ref == 'dev' && github.event.pull_request.base.ref == 'master')) && 'nightly.json' || 'sanity.json' }}
Expand Down Expand Up @@ -60,6 +60,15 @@ jobs:
- name: Add permission to modules
run: docker exec -t prestashop chmod 777 -R /var/www/html/modules

- name: Display new interface
working-directory: /var/www/html/modules/autoupgrade
run: |
cd _dev
npm install
npm run vite:build
cd ..
composer install
- name: Install dependencies
working-directory: tests/UI/
run: npm ci
Expand Down
149 changes: 131 additions & 18 deletions tests/UI/campaigns/functional/01_upgrade.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import {
boDashboardPage,
boLoginPage,
boModuleManagerPage,
boInstalledModulesPage,
boModuleSelectionPage,
boModuleCatalogPage,
boModuleManagerUninstalledModulesPage,
boMarketplacePage,
boMaintenancePage,
dataModules,
modAutoupgradeBoMain,
Expand Down Expand Up @@ -42,7 +46,66 @@ test.describe('Verify the New UI', () => {
expect(pageTitle).toContain(boDashboardPage.pageTitle);
});

if (semver.lt(psVersion, '8.0.0')) {
// Steps to install module
if (semver.lt(psVersion, '7.4.0')) {
test('should go to \'Modules > Modules & Services\' page', async () => {
await boDashboardPage.goToSubMenu(
page,
boDashboardPage.modulesParentLink,
boDashboardPage.moduleManagerLink,
);
await boModuleManagerPage.closeSfToolBar(page);

const pageTitle = await boModuleSelectionPage.getPageTitle(page);
expect(pageTitle).toContain(boModuleSelectionPage.pageTitle);
});

test(`should install the module '${dataModules.autoupgrade.name}'`, async () => {
const successMessage = await boModuleSelectionPage.installModule(page, dataModules.autoupgrade.tag);
expect(successMessage).toEqual(boModuleSelectionPage.installMessageSuccessful(dataModules.autoupgrade.tag));
});
} else if (semver.lt(psVersion, '7.5.0')) {
test('should go to \'Modules > Modules & Services\' page', async () => {
await boDashboardPage.goToSubMenu(
page,
boDashboardPage.modulesParentLink,
boDashboardPage.moduleManagerLink,
);
await boModuleManagerPage.closeSfToolBar(page);

const pageTitle = await boInstalledModulesPage.getPageTitle(page);
expect(pageTitle).toContain(boInstalledModulesPage.pageTitle);
});

test('should go to Selection page', async () => {
await boInstalledModulesPage.goToSelectionPage(page);

const pageTitle = await boModuleSelectionPage.getPageTitle(page);
expect(pageTitle).toContain(boModuleSelectionPage.pageTitle);
});

test(`should install the module '${dataModules.autoupgrade.name}'`, async () => {
const successMessage = await boModuleSelectionPage.installModule(page, dataModules.autoupgrade.tag);
expect(successMessage).toEqual(boModuleSelectionPage.installMessageSuccessful(dataModules.autoupgrade.tag));
});
} else if (semver.lt(psVersion, '7.6.0')) {
test('should go to \'Modules > Marketplace\' page', async () => {
await boDashboardPage.goToSubMenu(
page,
boDashboardPage.modulesParentLink,
boDashboardPage.moduleCatalogueLink,
);
await boModuleManagerPage.closeSfToolBar(page);

const pageTitle = await boMarketplacePage.getPageTitle(page);
expect(pageTitle).toContain(boMarketplacePage.pageTitle);
});

test(`should install the module '${dataModules.autoupgrade.name}'`, async () => {
const successMessage = await boMarketplacePage.installModule(page, dataModules.autoupgrade.tag);
expect(successMessage).toEqual(boMarketplacePage.installMessageSuccessful(dataModules.autoupgrade.tag));
});
} else if (semver.lt(psVersion, '8.0.0')) {
test('should go to \'Modules > Module Manager\' page', async () => {
await boDashboardPage.goToSubMenu(
page,
Expand All @@ -63,27 +126,77 @@ test.describe('Verify the New UI', () => {
});
}

test('should go to Module Manager page', async () => {
await boDashboardPage.goToSubMenu(
page,
boDashboardPage.modulesParentLink,
boDashboardPage.moduleManagerLink,
);
// Steps to go to module configuration page
if (semver.lt(psVersion, '7.4.0')) {
test('should go to Installed modules page', async () => {
await boModuleSelectionPage.goToInstalledModulesPage(page);

const pageTitle = await boModuleManagerPage.getPageTitle(page);
expect(pageTitle).toContain(boModuleManagerPage.pageTitle);
});
const pageTitle = await boInstalledModulesPage.getPageTitle(page);
expect(pageTitle).toContain(boInstalledModulesPage.pageTitle);
});

test(`should search the module '${dataModules.autoupgrade.name}'`, async () => {
const isModuleVisible = await boModuleManagerPage.searchModule(page, dataModules.autoupgrade);
expect(isModuleVisible).toEqual(true);
});
test(`should search the module '${dataModules.autoupgrade.name}'`, async () => {
const isModuleVisible = await boInstalledModulesPage.searchModule(page, dataModules.autoupgrade);
expect(isModuleVisible).toEqual(true);
});

test(`should go to the configuration page of the module '${dataModules.autoupgrade.name}'`, async () => {
await boModuleManagerPage.goToConfigurationPage(page, dataModules.autoupgrade.tag);
test(`should go to the configuration page of the module '${dataModules.autoupgrade.name}'`, async () => {
await boInstalledModulesPage.goToModuleConfigurationPage(page, dataModules.autoupgrade.tag);

const pageTitle = await modAutoupgradeBoMain.getPageTitle(page);
expect(pageTitle).toEqual(modAutoupgradeBoMain.pageTitle);
const pageTitle = await modAutoupgradeBoMain.getPageTitle(page);
expect(pageTitle).toEqual(modAutoupgradeBoMain.pageTitle);
});
} else if (semver.lt(psVersion, '7.5.0')) {
test('should go to Modules and services page', async () => {
await boDashboardPage.goToSubMenu(
page,
boDashboardPage.modulesParentLink,
boDashboardPage.moduleManagerLink,
);

const pageTitle = await boInstalledModulesPage.getPageTitle(page);
expect(pageTitle).toContain(boInstalledModulesPage.pageTitle);
});

test(`should search the module '${dataModules.autoupgrade.name}'`, async () => {
const isModuleVisible = await boInstalledModulesPage.searchModule(page, dataModules.autoupgrade);
expect(isModuleVisible).toEqual(true);
});

test(`should go to the configuration page of the module '${dataModules.autoupgrade.name}'`, async () => {
await boInstalledModulesPage.goToModuleConfigurationPage(page, dataModules.autoupgrade.tag);

const pageTitle = await modAutoupgradeBoMain.getPageTitle(page);
expect(pageTitle).toEqual(modAutoupgradeBoMain.pageTitle);
});
} else {
test('should go to Module Manager page', async () => {
await boDashboardPage.goToSubMenu(
page,
boDashboardPage.modulesParentLink,
boDashboardPage.moduleManagerLink,
);

const pageTitle = await boModuleManagerPage.getPageTitle(page);
expect(pageTitle).toContain(boModuleManagerPage.pageTitle);
});

test(`should search the module '${dataModules.autoupgrade.name}'`, async () => {
const isModuleVisible = await boModuleManagerPage.searchModule(page, dataModules.autoupgrade);
expect(isModuleVisible).toEqual(true);
});

test(`should go to the configuration page of the module '${dataModules.autoupgrade.name}'`, async () => {
await boModuleManagerPage.goToConfigurationPage(page, dataModules.autoupgrade.tag);

const pageTitle = await modAutoupgradeBoMain.getPageTitle(page);
expect(pageTitle).toEqual(modAutoupgradeBoMain.pageTitle);
});
}

test('should display the new interface', async ()=> {
const url = await modAutoupgradeBoMain.getCurrentURL(page);
console.log(url);
});

/*test('should go to maintenance page', async () => {
Expand Down
4 changes: 2 additions & 2 deletions tests/UI/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d65250e

Please sign in to comment.