Skip to content
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
20 changes: 18 additions & 2 deletions .github/workflows/rollback_ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,26 @@ jobs:
docker compose -f "docker-compose.yml" up -d --build
bash -c 'while [[ "$(curl -L -s -o /dev/null -w %{http_code} http://localhost/)" != "200" ]]; do sleep 5; done'

- name: Install Update assistant module
if: startsWith(matrix.PS_VERSION_START, '1.7')
- name: Install Update assistant module for PS version < 1.7.4
if: startsWith(matrix.PS_VERSION_START, '1.7.3') ||
startsWith(matrix.PS_VERSION_START, '1.7.2') ||
startsWith(matrix.PS_VERSION_START, '1.7.1') ||
startsWith(matrix.PS_VERSION_START, '1.7.0')
run: |
docker exec -t prestashop /usr/local/bin/install-update.sh
docker exec -t prestashop chmod -R 777 /var/www/html/var/cache

- name: Install Update assistant module for PS version > 1.7.3
if: >
startsWith(matrix.PS_VERSION_START, '1.7') &&
!(
startsWith(matrix.PS_VERSION_START, '1.7.0') ||
startsWith(matrix.PS_VERSION_START, '1.7.1') ||
startsWith(matrix.PS_VERSION_START, '1.7.2') ||
startsWith(matrix.PS_VERSION_START, '1.7.3')
)
run: |
docker exec -t prestashop php bin/console prestashop:module install autoupgrade

- name: Delete welcome module
if: startsWith(matrix.PS_VERSION_START, '1.7') || matrix.PS_VERSION_START == '8.0.0'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ui-test/nightly-ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
"UPGRADE_CHANNEL": "online"
},
{
"comment": "1.7.3.4 PHP 7.1 online"
"comment": "1.7.3.0 PHP 7.1 online"
},
{
"PS_VERSION_START": "1.7.3.4",
"PS_VERSION_START": "1.7.3.0",
"PHP_VERSION": "7.1",
"UPGRADE_CHANNEL": "online"
},
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ui-test/pr-ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@
"UPGRADE_CHANNEL": "local"
}
]
}
}
9 changes: 7 additions & 2 deletions .github/workflows/upgrade-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,15 @@ jobs:
run: composer install

- name: Delete welcome module
if: startsWith(matrix.PS_VERSION_START, '1.7') || matrix.PS_VERSION_START == '8.0.0'
if: startsWith(matrix.PS_VERSION_START, '1.7')
run: |
docker exec -t prestashop rm -rf /var/www/html/modules/welcome/
docker exec -t prestashop chmod 777 -R /var/www/html/var
docker exec -t prestashop-mysql mysql -pprestashop prestashop -e "
DELETE FROM ps_tab_lang WHERE id_tab IN (SELECT id_tab FROM ps_tab WHERE class_name = 'AdminWelcome');
DELETE FROM ps_tab WHERE class_name = 'AdminWelcome';
DELETE FROM ps_module_shop WHERE id_module = (SELECT id_module FROM ps_module WHERE name = 'welcome');
DELETE FROM ps_hook_module WHERE id_module = (SELECT id_module FROM ps_module WHERE name = 'welcome');
DELETE FROM ps_module WHERE name = 'welcome';"

- name: Backup
run: |
Expand Down
28 changes: 22 additions & 6 deletions .github/workflows/upgrade-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@ jobs:
docker compose -f "docker-compose.yml" up -d --build
bash -c 'while [[ "$(curl -L -s -o /dev/null -w %{http_code} http://localhost/)" != "200" ]]; do sleep 5; done'

- name: Install Update assistant module
if: startsWith(matrix.PS_VERSION_START, '1.7')
run: |
docker exec -t prestashop chmod -R 777 /var/www/html/modules
docker exec -t prestashop /usr/local/bin/install-update.sh

- name: Composer install
run: composer install

Expand All @@ -86,6 +80,28 @@ jobs:
npm install --prefix ./_dev
npm run vite:build --prefix ./_dev
docker exec -t prestashop chmod 777 -R /var/www/html/admin-dev/autoupgrade
docker exec -t prestashop chmod 777 -R /var/www/html/modules

- name: Install Update assistant module for PS version < 1.7.4
if: startsWith(matrix.PS_VERSION_START, '1.7.3') ||
startsWith(matrix.PS_VERSION_START, '1.7.2') ||
startsWith(matrix.PS_VERSION_START, '1.7.1') ||
startsWith(matrix.PS_VERSION_START, '1.7.0')
run: |
docker exec -t prestashop /usr/local/bin/install-update.sh

- name: Install Update assistant module for PS version > 1.7.3
if: >
startsWith(matrix.PS_VERSION_START, '1.7') &&
!(
startsWith(matrix.PS_VERSION_START, '1.7.0') ||
startsWith(matrix.PS_VERSION_START, '1.7.1') ||
startsWith(matrix.PS_VERSION_START, '1.7.2') ||
startsWith(matrix.PS_VERSION_START, '1.7.3')
)
run: |
docker exec -t prestashop php bin/console prestashop:module install autoupgrade
docker exec -t prestashop chmod 777 -R /var/www/html/var/cache

- name: Setup node
uses: actions/setup-node@v4
Expand Down
108 changes: 108 additions & 0 deletions tests/UI/campaigns/functional/00_updateModal.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/

import {
// Import BO pages
boDashboardPage,
boLoginPage,
modAutoupgradeBoMain,
modAutoupgradeBoModal,
} from '@prestashop-core/ui-testing';

import {
test, expect, Page, BrowserContext,
} from '@playwright/test';

/*
Check update modal
*/
test.describe('Check Update modal', () => {
let browserContext: BrowserContext;
let page: Page;
let isModalVisible: boolean = true;

test.beforeAll(async ({browser}) => {
browserContext = await browser.newContext();
page = await browserContext.newPage();
});
test.afterAll(async () => {
await page.close();
});

// Steps
test('should login in BO', async () => {
await boLoginPage.goTo(page, global.BO.URL);
await boLoginPage.successLogin(page, global.BO.EMAIL, global.BO.PASSWD, false);

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

test('should get if the update modal is visible', async () => {
isModalVisible = await modAutoupgradeBoModal.isModalVisible(page);
});

test('should check the update link', async () => {
if (isModalVisible) {
const updateLink = await modAutoupgradeBoModal.getUpdateLinkFromModal(page);
expect(updateLink).toContain('https://build.prestashop-project.org/news');
} else {
test.skip();
}
});

test('should click on the update link from the modal', async () => {
if (isModalVisible) {
page = await modAutoupgradeBoModal.openUpdateLinkFromTheModal(page);

const pageTitle = await modAutoupgradeBoModal.getPageTitle(page);
expect(pageTitle).toContain('PrestaShop');
expect(pageTitle.toLowerCase()).toContain('available');

page = await modAutoupgradeBoModal.closePage(browserContext, page, 0);
} else {
test.skip();
}
});

test('should check the support link', async () => {
if (isModalVisible) {
const supportLink = await modAutoupgradeBoModal.getSupportLinkFromModal(page);
expect(supportLink).toEqual('https://www.prestashop-project.org/support/');
} else {
test.skip();
}
});

test('should click on Update and check the PS version', async () => {
if (isModalVisible) {
const version = await modAutoupgradeBoModal.getPSVersionFromTheModal(page);

await modAutoupgradeBoModal.clickOnUpdateButton(page);

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

const currentVersion = await modAutoupgradeBoMain.getCurrentPSAndPHPVersion(page);
expect(currentVersion).not.toContain(version);
} else {
test.skip();
}
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const psVersion = utilsTest.getPSVersion();
/*
Uninstall welcome module
*/
if (semver.lt(psVersion, '8.0.1')) {
if (semver.lt(psVersion, '8.0.0')) {
test.describe('Uninstall welcome module', () => {
let browserContext: BrowserContext;
let page: Page;
Expand Down Expand Up @@ -137,7 +137,7 @@ if (semver.lt(psVersion, '8.0.1')) {
expect(isModuleVisible).toEqual(true);
});

test(`should uninstall the module '${dataModules.autoupgrade.name}'`, async () => {
test(`should uninstall the module '${dataModules.welcome.name}'`, async () => {
const successMessage = await boModuleManagerPage.setActionInModule(page, dataModules.welcome, 'uninstall');
expect(successMessage).toEqual(boModuleManagerAlertsPage.uninstallModuleSuccessMessage(dataModules.welcome.tag));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const psVersion = utilsTest.getPSVersion();
test.describe('Upgrade using the online channel', () => {
let browserContext: BrowserContext;
let page: Page;
let isModalVisible: boolean = true;
const isModalVisible: boolean = true;

test.beforeAll(async ({browser}) => {
browserContext = await browser.newContext();
Expand All @@ -65,56 +65,9 @@ test.describe('Upgrade using the online channel', () => {
expect(pageTitle).toContain(boDashboardPage.pageTitle);
});

test('should get if the update modal is visible', async () => {
isModalVisible = await modAutoupgradeBoModal.isModalVisible(page);
});

test('should check the update link', async () => {
if (isModalVisible) {
const updateLink = await modAutoupgradeBoModal.getUpdateLinkFromModal(page);
expect(updateLink).toContain('https://build.prestashop-project.org/news');
} else {
test.skip();
}
});

test('should click on the update link from the modal', async () => {
if (isModalVisible) {
page = await modAutoupgradeBoModal.openUpdateLinkFromTheModal(page);

const pageTitle = await modAutoupgradeBoModal.getPageTitle(page);
expect(pageTitle).toContain('PrestaShop');
expect(pageTitle.toLowerCase()).toContain('available');

page = await modAutoupgradeBoModal.closePage(browserContext, page, 0);
} else {
test.skip();
}
});

test('should check the support link', async () => {
if (isModalVisible) {
const supportLink = await modAutoupgradeBoModal.getSupportLinkFromModal(page);
expect(supportLink).toEqual('https://www.prestashop-project.org/support/');
} else {
test.skip();
}
});

test('should click on Update and check the PS version', async () => {
if (isModalVisible) {
const version = await modAutoupgradeBoModal.getPSVersionFromTheModal(page);

await modAutoupgradeBoModal.clickOnUpdateButton(page);

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

const currentVersion = await modAutoupgradeBoMain.getCurrentPSAndPHPVersion(page);
expect(currentVersion).not.toContain(version);
} else {
test.skip();
}
test('should close update notification dialog', async () => {
const isDialogNotVisible = await modAutoupgradeBoModal.closeDialogUpdateNotification(page);
expect(isDialogNotVisible).toEqual(true);
});

// Steps to go to module configuration page
Expand Down
6 changes: 3 additions & 3 deletions tests/UI/package.json
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
"// Sanity": "Scripts to run sanity tests",
"test:sanity": "npx playwright test /sanity --workers 1 --max-failures 1",
"// upgradeOnline": "Scripts to run functional tests to upgrade online channel",
"test:upgradeOnline": "npx playwright test /functional/00_uninstallWelcome.spec.ts /functional/01_upgradeOnline.spec.ts --workers 1 --max-failures 1 --output=/tmp/test-results",
"test:upgradeOnline": "npx playwright test /functional/00_updateModal.spec.ts /functional/01_uninstallWelcome.spec.ts /functional/02_upgradeOnline.spec.ts --workers 1 --max-failures 1 --output=/tmp/test-results",
"// upgradeLocal": "Scripts to run functional tests to upgrade local channel",
"test:upgradeLocal": "npx playwright test /functional/00_uninstallWelcome.spec.ts /functional/02_upgradeLocal.spec.ts --workers 1 --max-failures 1 --output=/tmp/test-results",
"test:upgradeLocal": "npx playwright test /functional/00_updateModal.spec.ts /functional/01_uninstallWelcome.spec.ts /functional/03_upgradeLocal.spec.ts --workers 1 --max-failures 1 --output=/tmp/test-results",
"// rollback": "Scripts to run functional tests to rollabck",
"test:rollback": "npx playwright test /functional/03_rollback.spec.ts --workers 1 --max-failures 1 --output=/tmp/test-results"
"test:rollback": "npx playwright test /functional/04_rollback.spec.ts --workers 1 --max-failures 1 --output=/tmp/test-results"
},
"keywords": [],
"devDependencies": {
Expand Down