Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functional tests - adding additional information to tests #17418

Merged
merged 6 commits into from Jan 31, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions tests/puppeteer/campaigns/commonTests/loginBO.js
@@ -1,8 +1,10 @@
const {expect} = require('chai');
const testContext = require('@utils/testContext');

module.exports = {
loginBO() {
it('should login in BO', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'loginBO');
await this.pageObjects.loginPage.goTo(global.BO.URL);
await this.pageObjects.loginPage.login(global.BO.EMAIL, global.BO.PASSWD);
const pageTitle = await this.pageObjects.dashboardPage.getPageTitle();
Expand All @@ -13,6 +15,7 @@ module.exports = {

logoutBO() {
it('should log out from BO', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'logoutBO');
await this.pageObjects.boBasePage.logoutBO();
const pageTitle = await this.pageObjects.loginPage.getPageTitle();
await expect(pageTitle).to.contains(this.pageObjects.loginPage.pageTitle);
Expand Down
12 changes: 12 additions & 0 deletions tests/puppeteer/campaigns/sanity/01_installShop/01_installShop.js
@@ -1,4 +1,7 @@
require('module-alias/register');
const testContext = require('@utils/testContext');

const baseContext = 'sanity_installShop_installShop';
// Using chai
const {expect} = require('chai');
const helper = require('@utils/helpers');
Expand Down Expand Up @@ -29,6 +32,7 @@ describe('Install Prestashop', async () => {
});
// Steps
it('should open the Install page', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'goToInstallPage', baseContext);
await this.pageObjects.installPage.goTo(global.INSTALL.URL);
const result = await this.pageObjects.installPage.checkStepTitle(
this.pageObjects.installPage.firstStepPageTitle,
Expand All @@ -41,6 +45,7 @@ describe('Install Prestashop', async () => {
});

it('should change language to English and check title', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'ChangeLanguageToEnglish', baseContext);
await this.pageObjects.installPage.setInstallLanguage();
const result = await this.pageObjects.installPage.checkStepTitle(
this.pageObjects.installPage.firstStepPageTitle,
Expand All @@ -50,6 +55,7 @@ describe('Install Prestashop', async () => {
});

it('should click on next and go to step \'License Agreements\'', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'goToLicenseAgreements', baseContext);
await this.pageObjects.installPage.nextStep();
const result = await this.pageObjects.installPage.checkStepTitle(
this.pageObjects.installPage.secondStepPageTitle,
Expand All @@ -59,6 +65,7 @@ describe('Install Prestashop', async () => {
});

it('should agree to terms and conditions and go to step \'System compatibility\'', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'goToSystemCompatibility', baseContext);
await this.pageObjects.installPage.agreeToTermsAndConditions();
await this.pageObjects.installPage.nextStep();
if (!this.pageObjects.installPage.elementVisible(this.pageObjects.installPage.thirdStepFinishedListItem)) {
Expand All @@ -71,6 +78,7 @@ describe('Install Prestashop', async () => {
});

it('should click on next and go to step \'shop Information\'', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'goToShopInformation', baseContext);
if (!this.pageObjects.installPage.elementVisible(this.pageObjects.installPage.thirdStepFinishedListItem)) {
await this.pageObjects.installPage.nextStep();
}
Expand All @@ -82,6 +90,7 @@ describe('Install Prestashop', async () => {
});

it('should fill shop Information form and go to step \'Database Configuration\'', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'goToDatabaseConfiguration', baseContext);
await this.pageObjects.installPage.fillInformationForm();
await this.pageObjects.installPage.nextStep();
const result = await this.pageObjects.installPage.checkStepTitle(
Expand All @@ -92,18 +101,21 @@ describe('Install Prestashop', async () => {
});

it('should fill database configuration form and check database connection', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'checkDatabaseConnection', baseContext);
await this.pageObjects.installPage.fillDatabaseForm();
const result = await this.pageObjects.installPage.isDatabaseConnected();
await expect(result).to.be.true;
});

it('should finish installation and check that installation is successful', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'checkInstallationSuccessful', baseContext);
await this.pageObjects.installPage.nextStep();
const result = await this.pageObjects.installPage.isInstallationSuccessful();
await expect(result).to.be.true;
});

it('should go to FO and check that Prestashop logo exists', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'checkPrestashopFO', baseContext);
page = await this.pageObjects.installPage.goToFOAfterInstall();
this.pageObjects = await init();
const result = await this.pageObjects.homePage.isHomePage();
Expand Down
Expand Up @@ -3,6 +3,9 @@ require('module-alias/register');
const {expect} = require('chai');
const helper = require('@utils/helpers');
const loginCommon = require('@commonTests/loginBO');
const testContext = require('@utils/testContext');

const baseContext = 'sanity_productsBO_filterProducts';

// importing pages
const LoginPage = require('@pages/BO/login');
Expand Down Expand Up @@ -41,6 +44,7 @@ describe('Filter in Products Page', async () => {
loginCommon.loginBO();

it('should go to Products page', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'goToProductsPage', baseContext);
await this.pageObjects.boBasePage.goToSubMenu(
this.pageObjects.boBasePage.catalogParentLink,
this.pageObjects.boBasePage.productsLink,
Expand All @@ -50,18 +54,20 @@ describe('Filter in Products Page', async () => {
});

it('should reset all filters and get Number of products in BO', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'resetFilters', baseContext);
await this.pageObjects.productsPage.resetFilterCategory();
numberOfProducts = await this.pageObjects.productsPage.resetAndGetNumberOfLines();
await expect(numberOfProducts).to.be.above(0);
});

const tests = [
{args: {filterBy: 'name', filterValue: Products.demo_14.name}},
{args: {filterBy: 'reference', filterValue: Products.demo_1.reference}},
{args: {filterBy: 'category', filterValue: Categories.men.name}},
{args: {identifier: 'filterName', filterBy: 'name', filterValue: Products.demo_14.name}},
{args: {identifier: 'filterReference', filterBy: 'reference', filterValue: Products.demo_1.reference}},
{args: {identifier: 'filterCategory', filterBy: 'category', filterValue: Categories.men.name}},
];
tests.forEach((test) => {
it(`should filter list by ${test.args.filterBy} and check result`, async function () {
await testContext.addContextItem(this, 'testIdentifier', `filterBy_${test.args.identifier}`, baseContext);
if (test.args.filterBy === 'category') {
await this.pageObjects.productsPage.filterProductsByCategory(test.args.filterValue);
} else {
Expand All @@ -72,6 +78,7 @@ describe('Filter in Products Page', async () => {
});

it('should reset filter and check result', async function () {
await testContext.addContextItem(this, 'testIdentifier', `resetFilters_${test.args.identifier}`, baseContext);
let numberOfProductsAfterReset;
if (test.args.filterBy === 'category') {
await this.pageObjects.productsPage.resetFilterCategory();
Expand Down
Expand Up @@ -3,6 +3,9 @@ require('module-alias/register');
const {expect} = require('chai');
const helper = require('@utils/helpers');
const loginCommon = require('@commonTests/loginBO');
const testContext = require('@utils/testContext');

const baseContext = 'sanity_productsBO_CRUDStandardProductInBO';

// importing pages
const LoginPage = require('@pages/BO/login');
Expand Down Expand Up @@ -50,6 +53,7 @@ describe('Create, read, update and delete Standard product in BO', async () => {
loginCommon.loginBO();

it('should go to Products page', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'goToProductsPage', baseContext);
await this.pageObjects.boBasePage.goToSubMenu(
this.pageObjects.boBasePage.catalogParentLink,
this.pageObjects.boBasePage.productsLink,
Expand All @@ -60,18 +64,21 @@ describe('Create, read, update and delete Standard product in BO', async () => {
});

it('should reset all filters', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'resetFilters', baseContext);
await this.pageObjects.productsPage.resetFilterCategory();
const numberOfProducts = await this.pageObjects.productsPage.resetAndGetNumberOfLines();
await expect(numberOfProducts).to.be.above(0);
});

it('should create Product', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'createProduct', baseContext);
await this.pageObjects.productsPage.goToAddProductPage();
const createProductMessage = await this.pageObjects.addProductPage.createEditProduct(productData);
await expect(createProductMessage).to.equal(this.pageObjects.addProductPage.settingUpdatedMessage);
});

it('should preview and check product in FO', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'previewProduct1', baseContext);
page = await this.pageObjects.addProductPage.previewProduct();
this.pageObjects = await init();
const result = await this.pageObjects.foProductPage.checkProduct(productData);
Expand All @@ -87,11 +94,13 @@ describe('Create, read, update and delete Standard product in BO', async () => {
});

it('should edit Product', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'editProduct', baseContext);
const createProductMessage = await this.pageObjects.addProductPage.createEditProduct(editedProductData, false);
await expect(createProductMessage).to.equal(this.pageObjects.addProductPage.settingUpdatedMessage);
});

it('should preview and check product in FO', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'previewProduct2', baseContext);
page = await this.pageObjects.addProductPage.previewProduct();
this.pageObjects = await init();
const result = await this.pageObjects.foProductPage.checkProduct(editedProductData);
Expand All @@ -107,6 +116,7 @@ describe('Create, read, update and delete Standard product in BO', async () => {
});

it('should delete Product and be on product list page', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'deleteProduct', baseContext);
const testResult = await this.pageObjects.addProductPage.deleteProduct();
await expect(testResult).to.equal(this.pageObjects.productsPage.productDeletedSuccessfulMessage);
const pageTitle = await this.pageObjects.productsPage.getPageTitle();
Expand Down
Expand Up @@ -3,6 +3,9 @@ require('module-alias/register');
const {expect} = require('chai');
const helper = require('@utils/helpers');
const loginCommon = require('@commonTests/loginBO');
const testContext = require('@utils/testContext');

const baseContext = 'sanity_productsBO_CRUDStandardProductWithCombinationsInBO';

// importing pages
const LoginPage = require('@pages/BO/login');
Expand Down Expand Up @@ -50,6 +53,7 @@ describe('Create, read, update and delete Standard product with combinations in
loginCommon.loginBO();

it('should go to Products page', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'goToProductsPage', baseContext);
await this.pageObjects.boBasePage.goToSubMenu(
this.pageObjects.boBasePage.catalogParentLink,
this.pageObjects.boBasePage.productsLink,
Expand All @@ -60,18 +64,21 @@ describe('Create, read, update and delete Standard product with combinations in
});

it('should reset all filters', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'resetFilters', baseContext);
await this.pageObjects.productsPage.resetFilterCategory();
const numberOfProducts = await this.pageObjects.productsPage.resetAndGetNumberOfLines();
await expect(numberOfProducts).to.be.above(0);
});

it('should create Product with Combinations', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'createProduct', baseContext);
await this.pageObjects.productsPage.goToAddProductPage();
const createProductMessage = await this.pageObjects.addProductPage.createEditProduct(productWithCombinations);
await expect(createProductMessage).to.equal(this.pageObjects.addProductPage.settingUpdatedMessage);
});

it('should preview and check product in FO', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'previewProduct1', baseContext);
page = await this.pageObjects.addProductPage.previewProduct();
this.pageObjects = await init();
const result = await this.pageObjects.foProductPage.checkProduct(productWithCombinations);
Expand All @@ -87,12 +94,14 @@ describe('Create, read, update and delete Standard product with combinations in
});

it('should edit Product', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'editProduct', baseContext);
const createProductMessage = await this.pageObjects.addProductPage.createEditProduct(editedProductWithCombinations,
false);
await expect(createProductMessage).to.equal(this.pageObjects.addProductPage.settingUpdatedMessage);
});

it('should preview and check product in FO', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'previewProduct2', baseContext);
page = await this.pageObjects.addProductPage.previewProduct();
this.pageObjects = await init();
const result = await this.pageObjects.foProductPage.checkProduct(editedProductWithCombinations);
Expand All @@ -108,6 +117,7 @@ describe('Create, read, update and delete Standard product with combinations in
});

it('should delete Product and be on product list page', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'deleteProduct', baseContext);
const testResult = await this.pageObjects.addProductPage.deleteProduct();
await expect(testResult).to.equal(this.pageObjects.productsPage.productDeletedSuccessfulMessage);
const pageTitle = await this.pageObjects.productsPage.getPageTitle();
Expand Down
Expand Up @@ -3,6 +3,9 @@ require('module-alias/register');
const {expect} = require('chai');
const helper = require('@utils/helpers');
const loginCommon = require('@commonTests/loginBO');
const testContext = require('@utils/testContext');

const baseContext = 'sanity_productsBO_deleteProduct';

// importing pages
const LoginPage = require('@pages/BO/login');
Expand Down Expand Up @@ -46,6 +49,7 @@ describe('Create Standard product in BO and Delete it with DropDown Menu', async
loginCommon.loginBO();

it('should go to Products page', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'goToProductsPage1', baseContext);
await this.pageObjects.boBasePage.goToSubMenu(
this.pageObjects.boBasePage.catalogParentLink,
this.pageObjects.boBasePage.productsLink,
Expand All @@ -55,30 +59,35 @@ describe('Create Standard product in BO and Delete it with DropDown Menu', async
});

it('should reset all filters', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'resetFilters1', baseContext);
await this.pageObjects.productsPage.resetFilterCategory();
const numberOfProducts = await this.pageObjects.productsPage.resetAndGetNumberOfLines();
await expect(numberOfProducts).to.be.above(0);
});

it('should create Product', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'createProduct', baseContext);
await this.pageObjects.productsPage.goToAddProductPage();
const createProductMessage = await this.pageObjects.addProductPage.createEditProduct(productData);
await expect(createProductMessage).to.equal(this.pageObjects.addProductPage.settingUpdatedMessage);
});

it('should go to Products page', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'goToProductsPage2', baseContext);
await this.pageObjects.boBasePage.goToSubMenu(this.pageObjects.boBasePage.catalogParentLink,
this.pageObjects.boBasePage.productsLink);
const pageTitle = await this.pageObjects.productsPage.getPageTitle();
await expect(pageTitle).to.contains(this.pageObjects.productsPage.pageTitle);
});

it('should delete product with from DropDown Menu', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'deleteProduct', baseContext);
const deleteTextResult = await this.pageObjects.productsPage.deleteProduct(productData);
await expect(deleteTextResult).to.equal(this.pageObjects.productsPage.productDeletedSuccessfulMessage);
});

it('should reset all filters', async function () {
await testContext.addContextItem(this, 'testIdentifier', 'resetFilters2', baseContext);
await this.pageObjects.productsPage.resetFilterCategory();
const numberOfProducts = await this.pageObjects.productsPage.resetAndGetNumberOfLines();
await expect(numberOfProducts).to.be.above(0);
Expand Down