diff --git a/.github/workflows/sanity-tests.yml b/.github/workflows/sanity-tests.yml index 4adab61aa..a5f3c6c75 100755 --- a/.github/workflows/sanity-tests.yml +++ b/.github/workflows/sanity-tests.yml @@ -1,4 +1,4 @@ -name: Sanity Tests +name: Upgrade CLI on: ## Check each PR push: @@ -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' }} diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml index e02a4daa0..cea214d40 100755 --- a/.github/workflows/ui-tests.yml +++ b/.github/workflows/ui-tests.yml @@ -1,4 +1,4 @@ -name: UI Tests +name: Upgrade UI on: ## Check each PR push: @@ -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' }} @@ -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 diff --git a/tests/UI/campaigns/functional/01_upgrade.spec.ts b/tests/UI/campaigns/functional/01_upgrade.spec.ts index 15a5e34b3..1739bfb5a 100755 --- a/tests/UI/campaigns/functional/01_upgrade.spec.ts +++ b/tests/UI/campaigns/functional/01_upgrade.spec.ts @@ -5,7 +5,11 @@ import { boDashboardPage, boLoginPage, boModuleManagerPage, + boInstalledModulesPage, + boModuleSelectionPage, + boModuleCatalogPage, boModuleManagerUninstalledModulesPage, + boMarketplacePage, boMaintenancePage, dataModules, modAutoupgradeBoMain, @@ -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, @@ -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 () => { diff --git a/tests/UI/package-lock.json b/tests/UI/package-lock.json index a0779c83c..d3e6d6851 100644 --- a/tests/UI/package-lock.json +++ b/tests/UI/package-lock.json @@ -523,7 +523,7 @@ }, "node_modules/@prestashop-core/ui-testing": { "version": "0.0.12", - "resolved": "git+ssh://git@github.com/PrestaShop/ui-testing-library.git#60c81a990d9c1cbdb623f1904751c160a424b92f", + "resolved": "git+ssh://git@github.com/PrestaShop/ui-testing-library.git#92f687bf1ecdc00e3d00371fecca45cae6b539c8", "license": "MIT", "dependencies": { "@faker-js/faker": "^9.0.3", @@ -6683,7 +6683,7 @@ } }, "@prestashop-core/ui-testing": { - "version": "git+ssh://git@github.com/PrestaShop/ui-testing-library.git#60c81a990d9c1cbdb623f1904751c160a424b92f", + "version": "git+ssh://git@github.com/PrestaShop/ui-testing-library.git#92f687bf1ecdc00e3d00371fecca45cae6b539c8", "from": "@prestashop-core/ui-testing@https://github.com/PrestaShop/ui-testing-library#main", "requires": { "@faker-js/faker": "^9.0.3",