Skip to content

Commit

Permalink
Bump dependency @prestashop-core/ui-testing to 0.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Progi1984 committed Jan 25, 2024
1 parent 0153840 commit 52441e2
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,23 @@ import {
dataModules,
} from '@prestashop-core/ui-testing';

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

const baseContext: string = 'modules_blockwishlist_configuration_statisticsTabSettings';

test('Wishlist module - Statistics tab settings', async ({ page, context }) => {
await test.step('should login in BO', async () => {
test.describe('Wishlist module - Statistics tab settings', () => {
let browserContext: BrowserContext;
let page: Page;

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

test('should login in BO', async () => {
await testContext.addContextItem(test.info(), 'testIdentifier', 'loginBO', baseContext);

await boLoginPage.goTo(page, global.BO.URL);
Expand All @@ -32,7 +43,7 @@ test('Wishlist module - Statistics tab settings', async ({ page, context }) => {
expect(pageTitle).toContain(boDashboardPage.pageTitle);
});

await test.step('should go to \'Modules > Module Manager\' page', async () => {
test('should go to \'Modules > Module Manager\' page', async () => {
await testContext.addContextItem(test.info(), 'testIdentifier', 'goToModuleManagerPage', baseContext);

await boDashboardPage.goToSubMenu(
Expand All @@ -46,14 +57,15 @@ test('Wishlist module - Statistics tab settings', async ({ page, context }) => {
expect(pageTitle).toContain(boModuleManagerPage.pageTitle);
});

await test.step(`should search the module ${dataModules.blockwishlist.name}`, async () => {

test(`should search the module ${dataModules.blockwishlist.name}`, async () => {
await testContext.addContextItem(test.info(), 'testIdentifier', 'searchModule', baseContext);

const isModuleVisible = await boModuleManagerPage.searchModule(page, dataModules.blockwishlist);
expect(isModuleVisible).toEqual(true);
});

await test.step(`should go to the configuration page of the module '${dataModules.blockwishlist.name}'`, async () => {
test(`should go to the configuration page of the module '${dataModules.blockwishlist.name}'`, async () => {
await testContext.addContextItem(test.info(), 'testIdentifier', 'goToConfigurationPage', baseContext);

await boModuleManagerPage.goToConfigurationPage(page, dataModules.blockwishlist.tag);
Expand All @@ -68,7 +80,7 @@ test('Wishlist module - Statistics tab settings', async ({ page, context }) => {
expect(isStatisticsTabActive).toEqual(false);
});

await test.step('should go on Statistics Tab', async () => {
test('should go on Statistics Tab', async () => {
await testContext.addContextItem(test.info(), 'testIdentifier', 'goToStatisticsTab', baseContext);

await modBlockwishlistBoMain.goToStatisticsTab(page);
Expand All @@ -80,7 +92,7 @@ test('Wishlist module - Statistics tab settings', async ({ page, context }) => {
expect(noRecordsFoundText).toContain('warning No records found');
});

await test.step('should go to the FO', async () => {
test('should go to the FO', async () => {
await testContext.addContextItem(test.info(), 'testIdentifier', 'goToFO', baseContext);

page = await modBlockwishlistBoStatistics.viewMyShop(page);
Expand All @@ -90,7 +102,7 @@ test('Wishlist module - Statistics tab settings', async ({ page, context }) => {
expect(isHomePage).toEqual(true);
});

await test.step('should go to login page', async () => {
test('should go to login page', async () => {
await testContext.addContextItem(test.info(), 'testIdentifier', 'goToLoginPage', baseContext);

await foHomePage.goToLoginPage(page);
Expand All @@ -99,7 +111,7 @@ test('Wishlist module - Statistics tab settings', async ({ page, context }) => {
expect(pageTitle, 'Fail to open FO login page').toContain(foLoginPage.pageTitle);
});

await test.step('should sign in with default customer', async () => {
test('should sign in with default customer', async () => {
await testContext.addContextItem(test.info(), 'testIdentifier', 'sighInFo', baseContext);

await foLoginPage.customerLogin(page, dataCustomers.johnDoe);
Expand All @@ -108,7 +120,7 @@ test('Wishlist module - Statistics tab settings', async ({ page, context }) => {
expect(isCustomerConnected, 'Customer is not connected').toEqual(true);
});

await test.step('should go to all products page', async () => {
test('should go to all products page', async () => {
await testContext.addContextItem(test.info(), 'testIdentifier', 'goToAllProducts', baseContext);

await foHomePage.goToAllProductsPage(page);
Expand All @@ -119,7 +131,7 @@ test('Wishlist module - Statistics tab settings', async ({ page, context }) => {

for (let idxProduct: number = 1; idxProduct <= 3; idxProduct++) {
// eslint-disable-next-line no-loop-func
await test.step(`should add product #${idxProduct} to wishlist`, async () => {
test(`should add product #${idxProduct} to wishlist`, async () => {
await testContext.addContextItem(test.info(), 'testIdentifier', `addToFavorite${idxProduct}`, baseContext);

const textResult = await foCategoryPage.addToWishList(page, idxProduct);
Expand All @@ -130,7 +142,7 @@ test('Wishlist module - Statistics tab settings', async ({ page, context }) => {
});
}

await test.step('should logout', async () => {
test('should logout', async () => {
await testContext.addContextItem(test.info(), 'testIdentifier', 'foLogout', baseContext);

await foCategoryPage.logout(page);
Expand All @@ -139,17 +151,17 @@ test('Wishlist module - Statistics tab settings', async ({ page, context }) => {
expect(isCustomerConnected).toEqual(false);
});

await test.step('should go to BO', async () => {
test('should go to BO', async () => {
await testContext.addContextItem(test.info(), 'testIdentifier', 'goToBoBack', baseContext);

page = await foHomePage.closePage(context, page, 0);
page = await foHomePage.closePage(browserContext, page, 0);

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

// @todo : https://github.com/PrestaShop/PrestaShop/issues/33374
await test.step('should click on the refresh button', async () => {
test('should click on the refresh button', async () => {
await testContext.addContextItem(test.info(), 'testIdentifier', 'clickOnRefreshButton', baseContext);

test.skip(true, 'https://github.com/PrestaShop/PrestaShop/issues/33374');
Expand Down
14 changes: 7 additions & 7 deletions tests/UI/package-lock.json

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

2 changes: 1 addition & 1 deletion tests/UI/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"license": "MIT",
"devDependencies": {
"@playwright/test": "^1.40.1",
"@prestashop-core/ui-testing": "^0.0.5",
"@prestashop-core/ui-testing": "^0.0.6",
"@types/node": "^20.11.5",
"pwmochawesome": "^1.1.1",
"typescript": "^5.3.3"
Expand Down
4 changes: 2 additions & 2 deletions tests/UI/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,16 @@ loadGlobal();
export default defineConfig({
testDir: './',
/* Run tests in files in parallel */
fullyParallel: true,
fullyParallel: false,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
retries: 0,
workers: 1,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: [
['list', { printSteps: true }],
['json', { outputFolder: 'reports' }],
['html', { outputFolder: 'reports' }],
[ './reporters/mochawesome.js', { outputJSON: true, reportDir: 'reports'} ]
],
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
Expand Down

0 comments on commit 52441e2

Please sign in to comment.