Skip to content

Commit 2e7f377

Browse files
Merge pull request #1647 from nesrineabdmouleh/addUItestUninstallWelcomeModule
UI tests - Add UI test to uninstall welcome module
2 parents 6865a46 + d3c09f1 commit 2e7f377

8 files changed

Lines changed: 162 additions & 55 deletions

File tree

.github/workflows/rollback_ui.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ jobs:
5959
run: |
6060
docker exec -t prestashop /usr/local/bin/install-update.sh
6161
62-
- name: Disable ps_welcome
63-
if: startsWith(matrix.PS_VERSION_START, '1.7')
62+
- name: Delete welcome module
63+
if: startsWith(matrix.PS_VERSION_START, '1.7') || matrix.PS_VERSION_START == '8.0.0'
6464
run: |
65-
docker exec -t prestashop /usr/local/bin/disable-welcome.sh
66-
docker exec -t prestashop chmod -R 777 /var/www/html/modules
65+
docker exec -t prestashop rm -rf /var/www/html/modules/welcome/
66+
docker exec -t prestashop chmod 777 -R /var/www/html/var
6767
6868
- name: Composer install
6969
run: |

.github/workflows/upgrade-cli.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ jobs:
5757
- name: Composer install
5858
run: composer install
5959

60+
- name: Delete welcome module
61+
if: startsWith(matrix.PS_VERSION_START, '1.7') || matrix.PS_VERSION_START == '8.0.0'
62+
run: |
63+
docker exec -t prestashop rm -rf /var/www/html/modules/welcome/
64+
docker exec -t prestashop chmod 777 -R /var/www/html/var
65+
6066
- name: Backup
6167
run: |
6268
docker exec -t prestashop php modules/autoupgrade/bin/console backup:create admin-dev
@@ -102,12 +108,6 @@ jobs:
102108
docker exec -t prestashop php modules/autoupgrade/bin/console update:start --config-file-path=modules/autoupgrade/config.json --channel=${{ matrix.UPGRADE_CHANNEL }} admin-dev
103109
docker exec -t prestashop chmod 777 -R /var/www/html/var
104110
105-
- name: Uninstall welcome module
106-
if: matrix.PHP_VERSION == '7.1'
107-
run: |
108-
docker exec -t prestashop php bin/console prestashop:module disable welcome
109-
docker exec -t prestashop chmod 777 -R /var/www/html/var
110-
111111
- name: Install dependencies
112112
working-directory: tests/UI/
113113
run: npm ci

.github/workflows/upgrade-ui.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,6 @@ jobs:
6060
docker exec -t prestashop chmod -R 777 /var/www/html/modules
6161
docker exec -t prestashop /usr/local/bin/install-update.sh
6262
63-
- name: Disable ps_welcome
64-
if: startsWith(matrix.PS_VERSION_START, '1.7')
65-
run: |
66-
docker exec -t prestashop /usr/local/bin/disable-welcome.sh
67-
docker exec -t prestashop chmod -R 777 /var/www/html/modules
68-
6963
- name: Composer install
7064
run: composer install
7165

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
/**
2+
* Copyright since 2007 PrestaShop SA and Contributors
3+
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
4+
*
5+
* NOTICE OF LICENSE
6+
*
7+
* This source file is subject to the Academic Free License version 3.0
8+
* that is bundled with this package in the file LICENSE.md.
9+
* It is also available through the world-wide-web at this URL:
10+
* https://opensource.org/licenses/AFL-3.0
11+
* If you did not receive a copy of the license and are unable to
12+
* obtain it through the world-wide-web, please send an email
13+
* to license@prestashop.com so we can send you a copy immediately.
14+
*
15+
* @author PrestaShop SA and Contributors <contact@prestashop.com>
16+
* @copyright Since 2007 PrestaShop SA and Contributors
17+
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
18+
*/
19+
20+
import {
21+
// Import utils
22+
utilsTest,
23+
// Import BO pages
24+
boDashboardPage,
25+
boLoginPage,
26+
boModuleManagerPage,
27+
boInstalledModulesPage,
28+
boModuleSelectionPage,
29+
boModuleManagerAlertsPage,
30+
modAutoupgradeBoModal,
31+
dataModules,
32+
} from '@prestashop-core/ui-testing';
33+
34+
import {
35+
test, expect, Page, BrowserContext,
36+
} from '@playwright/test';
37+
import semver from 'semver';
38+
39+
const psVersion = utilsTest.getPSVersion();
40+
41+
/*
42+
Uninstall welcome module
43+
*/
44+
if (semver.lt(psVersion, '8.0.1')) {
45+
test.describe('Uninstall welcome module', () => {
46+
let browserContext: BrowserContext;
47+
let page: Page;
48+
49+
test.beforeAll(async ({browser}) => {
50+
browserContext = await browser.newContext();
51+
page = await browserContext.newPage();
52+
});
53+
test.afterAll(async () => {
54+
await page.close();
55+
});
56+
57+
// Steps
58+
test('should login in BO', async () => {
59+
await boLoginPage.goTo(page, global.BO.URL);
60+
await boLoginPage.successLogin(page, global.BO.EMAIL, global.BO.PASSWD);
61+
62+
const pageTitle = await boDashboardPage.getPageTitle(page);
63+
expect(pageTitle).toContain(boDashboardPage.pageTitle);
64+
});
65+
66+
test('should close update notification dialog', async () => {
67+
const isDialogNotVisible = await modAutoupgradeBoModal.closeDialogUpdateNotification(page);
68+
expect(isDialogNotVisible).toEqual(true);
69+
});
70+
71+
// Steps to go to module configuration page
72+
if (semver.lt(psVersion, '7.4.0')) {
73+
test('should go to \'Modules > Modules & Services\' page', async () => {
74+
await boDashboardPage.goToSubMenu(
75+
page,
76+
boDashboardPage.modulesParentLink,
77+
boDashboardPage.moduleManagerLink,
78+
);
79+
await boModuleManagerPage.closeSfToolBar(page);
80+
81+
const pageTitle = await boModuleSelectionPage.getPageTitle(page);
82+
expect(pageTitle).toContain(boModuleSelectionPage.pageTitle);
83+
});
84+
85+
test('should go to Installed modules page', async () => {
86+
await boModuleSelectionPage.goToInstalledModulesPage(page);
87+
88+
const pageTitle = await boInstalledModulesPage.getPageTitle(page);
89+
expect(pageTitle).toContain(boInstalledModulesPage.pageTitle);
90+
});
91+
92+
test(`should search the module '${dataModules.welcome.name}'`, async () => {
93+
const isModuleVisible = await boInstalledModulesPage.searchModule(page, dataModules.welcome);
94+
expect(isModuleVisible).toEqual(true);
95+
});
96+
97+
test(`should uninstall the module '${dataModules.autoupgrade.name}'`, async () => {
98+
const successMessage = await boInstalledModulesPage.uninstallModule(page, dataModules.welcome.tag);
99+
expect(successMessage).toEqual(boModuleManagerAlertsPage.uninstallModuleSuccessMessage(dataModules.welcome.tag));
100+
});
101+
} else if (semver.lt(psVersion, '7.5.0')) {
102+
test('should go to \'Modules > Modules & Services\' page', async () => {
103+
await boDashboardPage.goToSubMenu(
104+
page,
105+
boDashboardPage.modulesParentLink,
106+
boDashboardPage.moduleManagerLink,
107+
);
108+
await boModuleManagerPage.closeSfToolBar(page);
109+
110+
const pageTitle = await boInstalledModulesPage.getPageTitle(page);
111+
expect(pageTitle).toContain(boInstalledModulesPage.pageTitle);
112+
});
113+
114+
test(`should search the module '${dataModules.welcome.name}'`, async () => {
115+
const isModuleVisible = await boInstalledModulesPage.searchModule(page, dataModules.welcome);
116+
expect(isModuleVisible).toEqual(true);
117+
});
118+
119+
test(`should uninstall the module '${dataModules.welcome.name}'`, async () => {
120+
const successMessage = await boInstalledModulesPage.uninstallModule(page, dataModules.welcome.tag);
121+
expect(successMessage).toEqual(boModuleManagerAlertsPage.uninstallModuleSuccessMessage(dataModules.welcome.tag));
122+
});
123+
} else {
124+
test('should go to Module Manager page', async () => {
125+
await boDashboardPage.goToSubMenu(
126+
page,
127+
boDashboardPage.modulesParentLink,
128+
boDashboardPage.moduleManagerLink,
129+
);
130+
131+
const pageTitle = await boModuleManagerPage.getPageTitle(page);
132+
expect(pageTitle).toContain(boModuleManagerPage.pageTitle);
133+
});
134+
135+
test(`should search the module '${dataModules.welcome.name}'`, async () => {
136+
const isModuleVisible = await boModuleManagerPage.searchModule(page, dataModules.welcome);
137+
expect(isModuleVisible).toEqual(true);
138+
});
139+
140+
test(`should uninstall the module '${dataModules.autoupgrade.name}'`, async () => {
141+
const successMessage = await boModuleManagerPage.setActionInModule(page, dataModules.welcome, 'uninstall');
142+
expect(successMessage).toEqual(boModuleManagerAlertsPage.uninstallModuleSuccessMessage(dataModules.welcome.tag));
143+
});
144+
}
145+
});
146+
}

tests/UI/docker-compose.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ services:
3434
source: ./post-install/install-update.sh
3535
# Mount Path
3636
target: /usr/local/bin/install-update.sh
37-
- type: bind
38-
# Local Path
39-
source: ./post-install/disable-welcome.sh
40-
# Mount Path
41-
target: /usr/local/bin/disable-welcome.sh
4237
ports:
4338
- "80:80"
4439
deploy:

tests/UI/package-lock.json

Lines changed: 4 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/UI/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
"// Sanity": "Scripts to run sanity tests",
1717
"test:sanity": "npx playwright test /sanity --workers 1 --max-failures 1",
1818
"// upgradeOnline": "Scripts to run functional tests to upgrade online channel",
19-
"test:upgradeOnline": "npx playwright test /functional/01_upgradeOnline.spec.ts --workers 1 --max-failures 1 --output=/tmp/test-results",
19+
"test:upgradeOnline": "npx playwright test /functional/00_uninstallWelcome.spec.ts /functional/01_upgradeOnline.spec.ts --workers 1 --max-failures 1 --output=/tmp/test-results",
2020
"// upgradeLocal": "Scripts to run functional tests to upgrade local channel",
21-
"test:upgradeLocal": "npx playwright test /functional/02_upgradeLocal.spec.ts --workers 1 --max-failures 1 --output=/tmp/test-results",
21+
"test:upgradeLocal": "npx playwright test /functional/00_uninstallWelcome.spec.ts /functional/02_upgradeLocal.spec.ts --workers 1 --max-failures 1 --output=/tmp/test-results",
2222
"// rollback": "Scripts to run functional tests to rollabck",
2323
"test:rollback": "npx playwright test /functional/03_rollback.spec.ts --workers 1 --max-failures 1 --output=/tmp/test-results"
2424
},

tests/UI/post-install/disable-welcome.sh

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)