Skip to content

Commit

Permalink
Merge pull request #15151 from boubkerbribri/InheritanceBOClass
Browse files Browse the repository at this point in the history
All BO classes should inherit from BObasePage
  • Loading branch information
matthieu-rolland committed Aug 19, 2019
2 parents 6490244 + 6cae9b5 commit b8bf5bc
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 25 deletions.
3 changes: 2 additions & 1 deletion tests/puppeteer/.eslintrc.js
Expand Up @@ -16,6 +16,7 @@ module.exports = {
sourceType: 'module',
},
rules: {
'no-plusplus': [2, { allowForLoopAfterthoughts: true }]
'no-plusplus': [2, { allowForLoopAfterthoughts: true }],
'max-len': [2, {code: 120}]
},
};
6 changes: 5 additions & 1 deletion tests/puppeteer/campaigns/linkchecker.js
Expand Up @@ -127,7 +127,11 @@ const run = async () => {

const curDate = new Date();

const filename = `report_${curDate.toJSON().slice(0, 10)}_${curDate.getHours()}${curDate.getMinutes()}${curDate.getSeconds()}.json`;
const dateString = curDate.toJSON().slice(0, 10);
const hours = curDate.getHours();
const minutes = curDate.getMinutes();
const seconds = curDate.getSeconds();
const filename = `report_${dateString}_${hours}${minutes}${seconds}.json`;
// Create folder reports if not exist
if (!fs.existsSync(reportPath)) {
fs.mkdirSync(reportPath);
Expand Down
2 changes: 1 addition & 1 deletion tests/puppeteer/campaigns/smoke/crawlingBO.js
Expand Up @@ -3,7 +3,7 @@ const LoginPage = require('../../pages/BO/login');
const DashboardPage = require('../../pages/BO/dashboard');
const BOBasePage = require('../../pages/BO/BObasePage');
const OrderPage = require('../../pages/BO/order');
const ProductPage= require('../../pages/BO/product');
const ProductPage = require('../../pages/BO/product');
const CustomerPage = require('../../pages/BO/customer');

let page;
Expand Down
4 changes: 2 additions & 2 deletions tests/puppeteer/pages/BO/customer.js
@@ -1,6 +1,6 @@
const CommonPage = require('../commonPage');
const BOBasePage = require('../BO/BObasePage');

module.exports = class Customer extends CommonPage {
module.exports = class Customer extends BOBasePage {
constructor(page) {
super(page);

Expand Down
4 changes: 2 additions & 2 deletions tests/puppeteer/pages/BO/dashboard.js
@@ -1,6 +1,6 @@
const CommonPage = require('../commonPage');
const BOBasePage = require('../BO/BObasePage');

module.exports = class Dashboard extends CommonPage {
module.exports = class Dashboard extends BOBasePage {
constructor(page) {
super(page);

Expand Down
4 changes: 2 additions & 2 deletions tests/puppeteer/pages/BO/login.js
@@ -1,6 +1,6 @@
const CommonPage = require('../commonPage');
const BOBasePage = require('../BO/BObasePage');

module.exports = class Login extends CommonPage {
module.exports = class Login extends BOBasePage {
constructor(page) {
super(page);

Expand Down
4 changes: 2 additions & 2 deletions tests/puppeteer/pages/BO/order.js
@@ -1,6 +1,6 @@
const CommonPage = require('../commonPage');
const BOBasePage = require('../BO/BObasePage');

module.exports = class Order extends CommonPage {
module.exports = class Order extends BOBasePage {
constructor(page) {
super(page);

Expand Down
4 changes: 2 additions & 2 deletions tests/puppeteer/pages/BO/product.js
@@ -1,6 +1,6 @@
const CommonPage = require('../commonPage');
const BOBasePage = require('../BO/BObasePage');

module.exports = class Product extends CommonPage {
module.exports = class Product extends BOBasePage {
constructor(page) {
super(page);

Expand Down
18 changes: 9 additions & 9 deletions tests/puppeteer/pages/Install/install.js
Expand Up @@ -48,15 +48,15 @@ module.exports = class Install extends CommonPage {

// Selectors for Final step
this.installationProgressBar = '#install_process_form #progress_bar .installing';
this.generateSettingsFileStep = "#process_step_generateSettingsFile";
this.installDatabaseStep = "#process_step_installDatabase";
this.installDefaultDataStep = "#process_step_installDefaultData";
this.populateDatabaseStep = "#process_step_populateDatabase";
this.configureShopStep = "#process_step_configureShop";
this.installModulesStep = "#process_step_installModules";
this.installModulesAddons = "#process_step_installModulesAddons";
this.installThemeStep = "#process_step_installTheme";
this.installFixturesStep = "#process_step_installFixtures";
this.generateSettingsFileStep = '#process_step_generateSettingsFile';
this.installDatabaseStep = '#process_step_installDatabase';
this.installDefaultDataStep = '#process_step_installDefaultData';
this.populateDatabaseStep = '#process_step_populateDatabase';
this.configureShopStep = '#process_step_configureShop';
this.installModulesStep = '#process_step_installModules';
this.installModulesAddons = '#process_step_installModulesAddons';
this.installThemeStep = '#process_step_installTheme';
this.installFixturesStep = '#process_step_installFixtures';
this.finalStepPageTitle = '#install_process_success h2';
this.discoverFoButton = '#foBlock';

Expand Down
6 changes: 3 additions & 3 deletions tests/puppeteer/pages/commonPage.js
Expand Up @@ -81,11 +81,11 @@ module.exports = class CommonPage {
switch (parameter) {
case 'equal':
await this.page.$eval(selector, el => el.innerText)
.then(text => expect(text.replace(/\s+/g, ' ').trim()).to.equal(textToCheckWith));
.then(text => global.expect(text.replace(/\s+/g, ' ').trim()).to.equal(textToCheckWith));
break;
case 'contain':
await this.page.$eval(selector, el => el.innerText)
.then(text => expect(text).to.contain(textToCheckWith));
.then(text => global.expect(text).to.contain(textToCheckWith));
break;
default:
// do nothing
Expand All @@ -103,6 +103,6 @@ module.exports = class CommonPage {
await this.page.waitForSelector(selector);
const value = await this.page.$eval(selector, (el, attribute) => el
.getAttribute(attribute), attribute);
expect(value).to.be.equal(textToCheckWith);
global.expect(value).to.be.equal(textToCheckWith);
}
};

0 comments on commit b8bf5bc

Please sign in to comment.