Skip to content

Commit

Permalink
add scenario for audit shipping
Browse files Browse the repository at this point in the history
  • Loading branch information
florine2623 committed Dec 9, 2024
1 parent 1e78430 commit d1522f4
Showing 1 changed file with 103 additions and 0 deletions.
103 changes: 103 additions & 0 deletions tests/UI/campaigns/audit/BO/09_shipping.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import {expect} from 'chai';
import testContext from '@utils/testContext';
import preferencesPage from '@pages/BO/shipping/preferences';

import {
boDashboardPage,
boLoginPage,
boCarriersPage,
boCarriersCreatePage,
type BrowserContext,
type Page,
utilsPlaywright,
} from '@prestashop-core/ui-testing';

const baseContext: string = 'audit_BO_shipping';

describe('BO - Shipping', async () => {
let browserContext: BrowserContext;

Check failure on line 18 in tests/UI/campaigns/audit/BO/09_shipping.ts

View workflow job for this annotation

GitHub Actions / ESLint

Expected indentation of 2 spaces but found 4
let page: Page;

Check failure on line 19 in tests/UI/campaigns/audit/BO/09_shipping.ts

View workflow job for this annotation

GitHub Actions / ESLint

Expected indentation of 2 spaces but found 4

before(async function () {

Check failure on line 21 in tests/UI/campaigns/audit/BO/09_shipping.ts

View workflow job for this annotation

GitHub Actions / ESLint

Expected indentation of 2 spaces but found 4
utilsPlaywright.setErrorsCaptured(true);

Check failure on line 22 in tests/UI/campaigns/audit/BO/09_shipping.ts

View workflow job for this annotation

GitHub Actions / ESLint

Expected indentation of 4 spaces but found 6

browserContext = await utilsPlaywright.createBrowserContext(this.browser);

Check failure on line 24 in tests/UI/campaigns/audit/BO/09_shipping.ts

View workflow job for this annotation

GitHub Actions / ESLint

Expected indentation of 4 spaces but found 6
page = await utilsPlaywright.newTab(browserContext);

Check failure on line 25 in tests/UI/campaigns/audit/BO/09_shipping.ts

View workflow job for this annotation

GitHub Actions / ESLint

Expected indentation of 4 spaces but found 6
});

Check failure on line 26 in tests/UI/campaigns/audit/BO/09_shipping.ts

View workflow job for this annotation

GitHub Actions / ESLint

Expected indentation of 2 spaces but found 4

after(async () => {

Check failure on line 28 in tests/UI/campaigns/audit/BO/09_shipping.ts

View workflow job for this annotation

GitHub Actions / ESLint

Expected indentation of 2 spaces but found 4
await utilsPlaywright.closeBrowserContext(browserContext);

Check failure on line 29 in tests/UI/campaigns/audit/BO/09_shipping.ts

View workflow job for this annotation

GitHub Actions / ESLint

Expected indentation of 4 spaces but found 8
});

Check failure on line 30 in tests/UI/campaigns/audit/BO/09_shipping.ts

View workflow job for this annotation

GitHub Actions / ESLint

Expected indentation of 2 spaces but found 4

it('should login in BO', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'loginBO', baseContext);

await boLoginPage.goTo(page, global.BO.URL);
await boLoginPage.successLogin(page, global.BO.EMAIL, global.BO.PASSWD);

const pageTitle = await boDashboardPage.getPageTitle(page);
expect(pageTitle).to.contains(boDashboardPage.pageTitle);

const jsErrors = utilsPlaywright.getJsErrors();
expect(jsErrors.length).to.equals(0);
});

it('should go to \'Shipping > Carriers\' page', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'goToShippingCarriersPage', baseContext);

await boDashboardPage.goToSubMenu(
page,
boDashboardPage.shippingLink,
boDashboardPage.carriersLink,
);
await boCarriersPage.closeSfToolBar(page);

const pageTitle = await boCarriersPage.getPageTitle(page);
expect(pageTitle).to.contains(boCarriersPage.pageTitle);

const jsErrors = utilsPlaywright.getJsErrors();
expect(jsErrors.length).to.equals(0);
});

it('should go to add new carrier page', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'goToAddCarrierPage', baseContext);

await boCarriersPage.goToAddNewCarrierPage(page);

const pageTitle = await boCarriersCreatePage.getPageTitle(page);
expect(pageTitle).to.contains(boCarriersCreatePage.pageTitleCreate);

const jsErrors = utilsPlaywright.getJsErrors();
expect(jsErrors.length).to.equals(0);
});

it('should return to \'Shipping > Carriers\' page', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'goBackToShippingCarriersPage', baseContext);

await boCarriersCreatePage.goToPreviousPage(page);

const pageTitle = await boCarriersPage.getPageTitle(page);
expect(pageTitle).to.contains(boCarriersPage.pageTitle);

const jsErrors = utilsPlaywright.getJsErrors();
expect(jsErrors.length).to.equals(0);

});

it('should go to \'Shipping > Preferences\' page', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'goToShippingPreferencesPage', baseContext);

await boDashboardPage.goToSubMenu(
page,
boDashboardPage.shippingLink,
boDashboardPage.shippingPreferencesLink,
);

const pageTitle = await preferencesPage.getPageTitle(page);
expect(pageTitle).to.contains(preferencesPage.pageTitle);

const jsErrors = utilsPlaywright.getJsErrors();
expect(jsErrors.length).to.equals(0);
});
});

0 comments on commit d1522f4

Please sign in to comment.