diff --git a/Faviconotification/test/scenario/BO/enable_module.js b/Faviconotification/test/scenario/BO/enable_module.js index a26ccf1..dde6848 100644 --- a/Faviconotification/test/scenario/BO/enable_module.js +++ b/Faviconotification/test/scenario/BO/enable_module.js @@ -18,7 +18,7 @@ describe('The Activation of the Favicon Notification Module', function () { describe('Log in in Back Office', function (done) { - it('should log in successfully in BO', function (done) { + it('should log in successfully in actionbloc', function (done) { this.client .signinBO() .waitForExist(this.selector.BO.Common.menu, 90000) @@ -72,7 +72,7 @@ describe('The Activation of the Favicon Notification Module', function () { }); describe('Log out in Back Office', function (done) { - it('should log out successfully in BO', function (done) { + it('should log out successfully in actionbloc', function (done) { this.client .signoutBO() .call(done); diff --git a/Prestafraud/test/scenario/BO/check_default_configuration.webdriverio.js b/Prestafraud/test/scenario/BO/check_default_configuration.webdriverio.js index 60f3c31..80a83e4 100644 --- a/Prestafraud/test/scenario/BO/check_default_configuration.webdriverio.js +++ b/Prestafraud/test/scenario/BO/check_default_configuration.webdriverio.js @@ -15,7 +15,7 @@ describe('Test case n°1 = Check the default configuration', function () { after(common.after); describe('Log in in Back Office', function (done) { - it('should log in successfully in BO', function (done) { + it('should log in successfully in actionbloc', function (done) { this.client .signinBO() .waitForExist(this.selector.BO.Common.menu, 90000) diff --git a/Prestafraud/test/scenario/BO/check_the_notification_prestafraud.webdriverio.js b/Prestafraud/test/scenario/BO/check_the_notification_prestafraud.webdriverio.js index 5210e39..d934f34 100644 --- a/Prestafraud/test/scenario/BO/check_the_notification_prestafraud.webdriverio.js +++ b/Prestafraud/test/scenario/BO/check_the_notification_prestafraud.webdriverio.js @@ -15,7 +15,7 @@ describe('Verify the Configuration of the Module', function () { after(common.after); describe('Log in in Back Office', function (done) { - it('should log in successfully in BO', function (done) { + it('should log in successfully in actionbloc', function (done) { this.client .signinBO() .waitForExist(this.selector.BO.Common.menu, 90000) diff --git a/README.md b/README.md index 568066b..3a01258 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ b) How to launch tests - Go to the folder of the module you want to test and execute the following line: - Launch tests : - mocha index.webdriverio.js --URL=presto200917.staging-prestashopready.net --EMAIL=remi.gaillard@prestashop.com --PWD=abcd1234 + mocha launch-seoimage-module-tests.js --URL=presto200917.staging-prestashopready.net --EMAIL=remi.gaillard@prestashop.com --PWD=abcd1234 - URL: Front office URL of your prestashop website (without the “http://”) - Email : Admin email - PWD : Admin password diff --git a/SEOImage_module/test/campaings/launch-seoimage-module-tests.js b/SEOImage_module/test/campaings/launch-seoimage-module-tests.js new file mode 100644 index 0000000..c4de00f --- /dev/null +++ b/SEOImage_module/test/campaings/launch-seoimage-module-tests.js @@ -0,0 +1,245 @@ +'use strict'; +var should = require('should'); +var common = require('../common.webdriverio'); +var globals = require('../globals.webdriverio.js'); +var language = require('../scenario/actionbloc/set-language.webdriverio'); +var module = require('./../scenario/actionbloc/action-module.webdriverio'); +var authentication = require('../scenario/actionbloc/authentication.webdriverio'); +var rule = require('./../scenario/actionbloc/add-rule.webdriverio'); +var checkRule = require('../scenario/actionbloc/check-rule.webdriverio'); + +describe('Allscenario', function(){ + common.initMocha.call(this); + + before(function (done) { + this.client = common.getClient(); + this.client.call(done); + }); + + after(function (done) { + this.client + .end() + .call(done); + }); + + describe('Test case n°1 : Add and check english rule in all categories', function(){ + common.initMocha.call(this); + + before(function(done){ + this.selector = globals.selector; + this.client.call(done); + }); + + after(common.after); + + describe('Add english rule in all categories', function() { + authentication.loginBO(); + module.searchModule("seoimage"); + describe('Configure the SEO Image module', function () { + module.configureModule(); + rule.addRule('testEN1'); + language.selectRuleLanguage(1 , " english"); + rule.clickNextButton(); + rule.allCategory(); + rule.clickNextButton(); + rule.ruleCondition('{product_name}{product_reduce_price} EN1',' "{product_name}{product_reduce_price} EN1"' ); + rule.saveForm(); + rule.closeGreenValidation(); + rule.applyRule(1); + }); + authentication.logoutBO(); + }); + + describe('Check english rule in all categories in FO', function() { + authentication.openShop(); + describe('Check that the rule exists when the shop is in english', function () { + language.selectLanguageFO(1 , " english"); + checkRule.selectSleevesTshirtProduct(); + checkRule.verifRule("Faded Short Sleeves T-shirt€19.81 EN1" , ' "Faded Short Sleeves T-Shirt" product in the category "Tops"'); + checkRule.selectPrintedDressCasualDressesCategory(); + checkRule.verifRule("Printed Dress€31.19 EN1" , ' "Printed Dress" product in the category "Casual Dresses"'); + }); + + describe('Check that the rule does not exist when the shop is in french', function () { + language.selectLanguageFO(2 , " french"); + checkRule.verifRule("" , ' "Printed Dress" product in the category Casual "Dresses"'); + checkRule.selectSleevesTshirtProduct(); + checkRule.verifRule("" , ' "Faded Short Sleeves T-Shirt" product in the category "Tops"'); + }); + }); + }); + + describe('Test case n°2 : Edit and check english rule in all categories', function(){ + common.initMocha.call(this); + + before(function(done){ + this.selector = globals.selector; + this.client.call(done); + }); + + after(common.after); + + describe('Edit english rule in all categories', function() { + authentication.loginBO(); + module.searchModule("seoimage"); + describe('Configure the SEO Image module', function () { + module.configureModule(); + it('should click on "edit" rule', function(done) { + global.fctname = this.test.title; + this.client + .waitForExist(this.selector.BO.ModuleConfiguration.dropdown_button, 90000) + .click(this.selector.BO.ModuleConfiguration.dropdown_button) + .waitForExist(this.selector.BO.ModuleConfiguration.edit_rule_button, 90000) + .click(this.selector.BO.ModuleConfiguration.edit_rule_button) + .call(done); + }); + rule.clickNextButton(); + rule.clickNextButton(); + rule.ruleCondition('{default_cat_name} EN1',' "{default_cat_name} EN1"'); + rule.saveForm(); + rule.closeGreenValidation(); + rule.applyRule(1); + }); + authentication.logoutBO(); + }); + + describe('Check english rule in all categories in FO', function() { + authentication.openShop(); + describe('Check that the rule exists when the shop is in english', function () { + language.selectLanguageFO(1 , " english"); + checkRule.selectSleevesTshirtProduct(); + checkRule.verifRule("T-shirts EN1" , ' "Faded Short Sleeves T-Shirt" product in the category "Tops"'); + checkRule.selectPrintedDressCasualDressesCategory(); + checkRule.verifRule("Casual Dresses EN1" , ' "Printed Dress" product in the category "Casual Dresses"'); + }); + + describe('Check that the rule does not exist when the shop is in french', function () { + language.selectLanguageFO(2 , " french"); + checkRule.verifRule("" , ' "Printed Dress" product in the category "Casual Dresses"'); + checkRule.selectSleevesTshirtProduct(); + checkRule.verifRule("" , ' "Faded Short Sleeves T-Shirt" product in the category "Tops"'); + }); + }); + }); + + describe('Test case n°3 : Add and check english rule in a specific category', function(){ + common.initMocha.call(this); + + before(function(done){ + this.selector = globals.selector; + this.client.call(done); + }); + + after(common.after); + + describe('Add english rule in a specific category', function() { + authentication.loginBO(); + module.searchModule("seoimage"); + describe('Configure the SEO Image module', function () { + module.configureModule(); + rule.addRule('testEN2'); + language.selectRuleLanguage(1 , " english"); + rule.clickNextButton(); + rule.selectEveningDressesCategory(); + rule.clickNextButton(); + rule.ruleCondition('{product_price_wt}{product_reduce_price_wt}{product_reduction_percent} EN2',' "{product_price_wt}{product_reduce_price_wt}{product_reduction_percent} EN2"'); + rule.saveForm(); + rule.closeGreenValidation(); + rule.applyRule(2); + }); + + authentication.logoutBO(); + }); + + describe('Check english rule in a specific category in FO', function() { + authentication.openShop(); + describe('Check that the rule exists when the shop is in english', function () { + language.selectLanguageFO(1 , " english"); + checkRule.selectPrintedDressEveningDressesCategory(); + checkRule.verifRule("€50.99€50.99 EN2" , ' "Printed Dress" product in the category "Evening Dresses"'); + checkRule.selectPrintedDressCasualDressesCategory(); + checkRule.verifRule("Casual Dresses EN1" , ' "Printed Dress" product in the category "Casual Dresses"'); + + }); + + describe('Check that the rule does not exist when the shop is in french', function () { + language.selectLanguageFO(2 , " french") + checkRule.verifRule("" , ' "Printed Dress" product in the category "Casual Dresses"'); + checkRule.selectPrintedDressEveningDressesCategory(); + checkRule.verifRule("" , ' "Printed Dress" product in the category "Casual Dresses"'); + }); + }); + }); + + describe('Test case n°4 : Apply all rules', function(){ + common.initMocha.call(this); + + before(function(done){ + this.selector = globals.selector; + this.client.call(done); + }); + + after(common.after); + + describe('Add french rule in all categories', function() { + authentication.loginBO(); + module.searchModule("seoimage"); + describe('Configure the SEO Image module', function() { + module.configureModule(); + rule.addRule('testFR1'); + language.selectRuleLanguage(2 , " french"); + rule.clickNextButton(); + rule.allCategory(); + rule.clickNextButton(); + rule.ruleCondition('{product_name}{product_reference} FR1',' "{product_name}{product_reference} FR1"'); + rule.saveForm(); + rule.closeGreenValidation(); + }); + }); + + describe('Add french rule in a specific category', function() { + describe('Configure the SEO Image module', function () { + rule.addRule('testFR2'); + language.selectRuleLanguage(2 , " french"); + rule.clickNextButton(); + rule.selectEveningDressesCategory(); + rule.clickNextButton(); + rule.ruleCondition('{product_price_wt}{product_reduce_price_wt}{product_reduction_percent} FR2',' "{product_price_wt}{product_reduce_price_wt}{product_reduction_percent} FR2"'); + rule.saveForm(); + rule.closeGreenValidation(); + it('should click on apply all rules button ', function (done) { + global.fctname = this.test.title; + this.client + .pause(5000) + .waitForExist(this.selector.BO.ModuleConfiguration.apply_all_rules_button, 90000) + .click(this.selector.BO.ModuleConfiguration.apply_all_rules_button) + .pause(5000) + .call(done); + }); + }); + authentication.logoutBO(); + }); + + describe('Check all rules in FO', function() { + authentication.openShop(); + describe('Check that the rule exists when the shop is in english', function () { + language.selectLanguageFO(1 , " english") + checkRule.selectPrintedDressEveningDressesCategory(); + checkRule.verifRule("€50.99€50.99 EN2" , ' "Printed Dress" product in the category Evening "Dresses"'); + checkRule.selectSleevesTshirtProduct(); + checkRule.verifRule("T-shirts EN1" , ' "Faded Short Sleeves T-Shirt" product in the category "Tops"'); + }); + + describe('Check that the rule exists when the shop is in french', function () { + language.selectLanguageFO(2 ," french") + checkRule.verifRule("T-shirt délavé à manches courtesdemo_1 FR1" , ' "Faded Short Sleeves T-Shirt" product in the category "Tops"'); + checkRule.selectPrintedDressEveningDressesCategory(); + checkRule.verifRule("€50.99€50.99 FR2" , ' "Printed Dress" product in the category "Casual Dresses"'); + + }); + + + }); + }); + +}); \ No newline at end of file diff --git a/SEOImage_module/test/common.webdriverio.js b/SEOImage_module/test/common.webdriverio.js new file mode 100644 index 0000000..1dcdbf5 --- /dev/null +++ b/SEOImage_module/test/common.webdriverio.js @@ -0,0 +1,143 @@ +'use strict'; +var client; +var webdriverio = require('webdriverio'); +var globals = require('./globals.webdriverio'); + +var options = { + logLevel: 'silent', + waitForTimeout: 30000, + desiredCapabilities: { + browserName: 'chrome', + }, + port: 4444 +}; + +var options2 = { + logLevel: 'silent', + waitForTimeout: 30000, + desiredCapabilities: { + browserName: 'chrome', + 'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER, + username: process.env.SAUCE_USERNAME, + access_key: process.env.SAUCE_ACCESS_KEY, + screenResolution: "1680x1050", + platform: "Windows 7", + }, + port: 4445 +}; + +function initCommands(client) { + + client.addCommand('localhost', function (cb) { + this.selector = globals.selector; + client + .url('http://' + URL + 'install-dev') + .call(cb); + }); + + client.addCommand('signinBO', function (cb) { + this.selector = globals.selector; + client + .url('http://' + URL + '/admin-dev/') + .waitForExist(this.selector.BO.LoginPage.login_input, 90000) + .setValue(this.selector.BO.LoginPage.login_input, 'demo@prestashop.com') + .setValue(this.selector.BO.LoginPage.password_input, 'prestashop_demo') + .click(this.selector.BO.LoginPage.login_button) + .waitForExist(this.selector.BO.Common.menu, 90000) + .call(cb); + }); + + client.addCommand('signinFO', function (cb) { + this.selector = globals.selector; + client + .url('http://' + URL) + .waitForExist(this.selector.FO.HomePage.access_login_button, 90000) + .click(this.selector.FO.HomePage.access_login_button) + .waitForExist(this.selector.FO.HomePage.login_input, 90000) + .setValue(this.selector.FO.HomePage.login_input, 'pub@prestashop.com') + .setValue(this.selector.FO.HomePage.password_input, '123456789') + .click(this.selector.FO.HomePage.login_button) + .waitForExist(this.selector.FO.HomePage.logo_home_page) + .call(cb); + }); + + client.addCommand('signoutBO', function (cb) { + this.selector = globals.selector; + client + .deleteCookie() + .call(cb); + }); + + client.addCommand('signoutBO2', function (cb) { + this.selector = globals.selector; + client + .deleteCookie() + .call(cb); + }); + + client.addCommand('signoutFO', function (cb) { + this.selector = globals.selector; + client + .deleteCookie() + .call(cb); + }); + + client.addCommand('getProductname', function (cb) { + this.selector = globals.selector; + client + .getText(this.selector.FO.ProductPage.product_name).then(function (text) { + global.prod_name = text.toLowerCase(); + }) + .call(cb); + }); + + client.addCommand('getProductprice', function (cb) { + this.selector = globals.selector; + client + .getText(this.selector.FO.ProductPage.product_price).then(function (text) { + global.prod_price = text; + }) + .call(cb); + }); + + client.addCommand('getProductcategory', function (cb) { + this.selector = globals.selector; + client + .getText(this.selector.FO.ProductPage.category_name).then(function (text) { + global.categ_name = text.toLowerCase(); + }) + .call(cb); + }); +} +module.exports = { + getClient: function () { + if (client) { + return client; + } else { + if (typeof saucelabs !== 'undefined' && saucelabs != "None"){ + client = webdriverio + .remote(options2) + .init() + .windowHandleMaximize() + }else{ + client = webdriverio + .remote(options) + .init() + .windowHandleMaximize() + } + initCommands(client); + + return client; + } + }, + after: function (done) { + done(); + }, + /*take_screenshot: function (done) { + client.saveScreenshot(__dirname +'/screenshots/' + client.desiredCapabilities.browserName + '-Exception' + '_' + global.fctname + '.png'); + },*/ + initMocha: function () { + this.timeout(900000000); + this.slow(45000); + } +}; diff --git a/SEOImage_module/test/globals.webdriverio.js b/SEOImage_module/test/globals.webdriverio.js new file mode 100644 index 0000000..300f611 --- /dev/null +++ b/SEOImage_module/test/globals.webdriverio.js @@ -0,0 +1,100 @@ +'use strict'; +var common = require('./common.webdriverio'); +var path = require('path'); +var should = require('should'); +var argv = require('minimist')(process.argv.slice(2)); + +global.date_time = new Date().getTime(); +global.URL = argv.URL; +global.module_tech_name = argv.MODULE; +global.browser = argv.browser; +global.saucelabs = argv.SAUCELABS; +global._projectdir = path.join(__dirname, '..', '..'); +global.product_id=new Date().getTime(); +global.new_customer_email = 'pub' + date_time + '@prestashop.com'; + +module.exports = { + selector: { + + BO: { + //Back office login page selectors + LoginPage: { + login_input: '#email', + password_input: '#passwd', + login_button: '[name="submitLogin"]', + }, + + //Common selectors + Common: { + menu: '#nav-sidebar', + }, + + //Module page selectors + ModulePage: { + modules_subtub: '#subtab-AdminParentModulesSf', + installed_moule_tabs: '(//div[@class="page-head-tabs"]/a)[2]', + modules_search_results: '.module-search-result-wording', + modules_search_input: '.pstaggerAddTagInput.module-tags-input', + modules_search_button: '//*[@id="main-div"]/div[3]/div[2]/div/div[2]/div/div[5]/div/div[1]/div/button', + module_configuration_button: '//*[@id="modules-list-container-all"]/div[1]/div/div/div[5]/div[2]/form/button', + module_number_span: '//*[@id="main-div"]/div[3]/div[2]/div/div[2]/div/div[7]/span[1]', + }, + + //Module page configuration selectors + ModuleConfiguration: { + optimize_images_tab: '//*[@id="modulecontent"]/div[1]/div[1]/a[2]', + add_new_rule_button: '.process-icon-new', + rule_name_input: '//*[@id="rule_name"]', + ruleLanguage_dropdownlist: '//*[@id="step-1"]/div[3]/div/div[1]/button', + ruleLanguage_select: '//*[@id="step-1"]/div[3]/div/div[1]/div/ul/li[%s]', + next_step_rule_button: '//*[@id="next-step"]', + all_category_radio_button: '//*[@id="radios-0"]/label/input', + legend_input: '//*[@id="legend"]', + save_rule_button: '//*[@id="btn-save"]', + green_validation_notice: '/html/body/div[6]/div/div/div[1]/div/div[2]/button', + apply_rule_button: '//*[@id="table-metas-1"]/tbody/tr[%s]/td[7]/div/div/a', + apply_second_rule_button: '//*[@id="table-metas-1"]/tbody/tr[2]/td[7]/div/div/a', + apply_all_rules_button: '//*[@id="table-metas-1"]/a[1]', + dropdown_button: '//*[@id="table-metas-1"]/tbody/tr[1]/td[7]/div/div/button', + edit_rule_button: '//*[@id="table-metas-1"]/tbody/tr[1]/td[7]/div/div/ul/li[1]/a', + expan_all_button: '//*[@id="expandall"]', + evening_dresses_checkbox: '//*[@id="category_10"]/a/i[1]', + }, + }, + FO : { + //Common selectors + Common: { + language_button: '//*[@id="_desktop_language_selector"]/div/div/button', + chooseLanguage_button: '//*[@id="_desktop_language_selector"]/div/div/ul/li[%s]/a', + }, + + //Home page selectors + HomePage: { + access_login_button: 'div.user-info > a', + login_input: '//*[@id="login-form"]/section/div[1]/div[1]/input', + password_input: '//*[@id="login-form"]/section/div[2]/div[1]/div/input', + login_button: '//*[@id="login-form"]/footer/button', + logout_button: '.logout', + logo_home_page: '//*[@id="_desktop_logo"]/a/img', + sleeves_tshirt_image: '//*[@id="content"]/section/div/article[1]/div/a/img', + printed_dress_casual_dresses_category_image: '//*[@id="content"]/section/div/article[3]/div/a/img', + printed_dress_evening_dresses_category_image: '//*[@id="content"]/section/div/article[4]/div/a/img', + }, + + //Product page selectors + ProductPage: { + product_name: '//*[@id="main"]/div[1]/div[2]/h1', + product_price: '//*[@id="main"]/div[1]/div[2]/div[1]/div[1]/div/span', + product_image: '//*[@id="product-modal"]/div/div/div/figure/img', + thumbnail_image: '//*[@id="content"]/div[1]/div[2]/ul/li[1]/img', + category_name: '//*[@id="wrapper"]/div/nav/ol/li[4]/a/span', + women_category_select: '//*[@id="wrapper"]/div/nav/ol/li[2]/a', + }, + } + + }, + shouldExist: function(err, existing) { + should(err).be.not.defined; + should(existing).be.true; + } +}; \ No newline at end of file diff --git a/SEOImage_module/test/scenario/actionbloc/action-module.webdriverio.js b/SEOImage_module/test/scenario/actionbloc/action-module.webdriverio.js new file mode 100644 index 0000000..dbb3e2d --- /dev/null +++ b/SEOImage_module/test/scenario/actionbloc/action-module.webdriverio.js @@ -0,0 +1,48 @@ +module.exports = { + searchModule: function (moduleName) { + describe('Go to the module configuration page', function (done) { + it('should go to the modules page', function (done) { + global.fctname = this.test.title; + this.client + .pause(5000) + .click(this.selector.BO.ModulePage.modules_subtub) + .waitForExist(this.selector.BO.ModulePage.modules_search_results, 90000) + .call(done); + }); + + it('should search the ' + moduleName + ' module', function (done) { + global.fctname = this.test.title; + this.client + .click(this.selector.BO.ModulePage.installed_moule_tabs) + .waitForExist(this.selector.BO.ModulePage.modules_search_input, 90000) + .setValue(this.selector.BO.ModulePage.modules_search_input, moduleName) + .click(this.selector.BO.ModulePage.modules_search_button) + .getText(this.selector.BO.ModulePage.module_number_span).then(function (text) { + global.nbr = parseInt(text[0]); + if (global.nbr == 0) { + done(new Error('The module you are searching for does not exist!')); + } + else + done(); + }) + }); + }); + }, + configureModule: function () { + it('should go to the module configuration page', function (done) { + global.fctname = this.test.title; + this.client + .waitForExist(this.selector.BO.ModulePage.module_configuration_button, 90000) + .click(this.selector.BO.ModulePage.module_configuration_button) + .call(done); + }); + + it('should go to "Optimize Images" tab', function (done) { + global.fctname = this.test.title; + this.client + .waitForExist(this.selector.BO.ModuleConfiguration.optimize_images_tab, 90000) + .click(this.selector.BO.ModuleConfiguration.optimize_images_tab) + .call(done); + }); + } +} diff --git a/SEOImage_module/test/scenario/actionbloc/add-rule.webdriverio.js b/SEOImage_module/test/scenario/actionbloc/add-rule.webdriverio.js new file mode 100644 index 0000000..6467019 --- /dev/null +++ b/SEOImage_module/test/scenario/actionbloc/add-rule.webdriverio.js @@ -0,0 +1,98 @@ +module.exports = { + addRule : function (x) { + it('should click on "add new rule" button', function (done) { + global.fctname = this.test.title; + this.client + .pause(3000) + .waitForVisible(this.selector.BO.ModuleConfiguration.add_new_rule_button, 90000) + .click(this.selector.BO.ModuleConfiguration.add_new_rule_button) + .call(done); + }); + + it('should set the rule name', function (done) { + global.fctname = this.test.title; + this.client + .waitForExist(this.selector.BO.ModuleConfiguration.rule_name_input, 60000) + .setValue(this.selector.BO.ModuleConfiguration.rule_name_input, x) + .call(done); + }); + }, + + allCategory : function(){ + it('should select "all category"', function(done){ + global.fctname= this.test.title; + this.client + .pause(2000) + .waitForExist(this.selector.BO.ModuleConfiguration.all_category_radio_button, 90000) + .click(this.selector.BO.ModuleConfiguration.all_category_radio_button) + .call(done) + }); + }, + + clickNextButton : function(){ + it('should click on "next" button', function(done) { + global.fctname = this.test.title; + this.client + .waitForExist(this.selector.BO.ModuleConfiguration.next_step_rule_button, 90000) + .click(this.selector.BO.ModuleConfiguration.next_step_rule_button) + .call(done) + }); + }, + + selectEveningDressesCategory : function(){ + it('should select "Evening dresses" category', function(done){ + global.fctname= this.test.title; + this.client + .pause(2000) + .waitForExist(this.selector.BO.ModuleConfiguration.expan_all_button, 90000) + .click(this.selector.BO.ModuleConfiguration.expan_all_button) + .waitForExist(this.selector.BO.ModuleConfiguration.evening_dresses_checkbox, 90000) + .click(this.selector.BO.ModuleConfiguration.evening_dresses_checkbox) + .call(done) + }); + }, + + ruleCondition : function(x , ruleCondition){ + it('should set the rule condition to' + ruleCondition, function(done){ + global.fctname= this.test.title; + this.client + .waitForExist(this.selector.BO.ModuleConfiguration.legend_input, 90000) + .pause(5000) + .setValue(this.selector.BO.ModuleConfiguration.legend_input, x) + .call(done); + }); + }, + + saveForm : function(){ + it('should save the form', function(done) { + global.fctname = this.test.title; + this.client + .waitForExist(this.selector.BO.ModuleConfiguration.save_rule_button, 90000) + .click(this.selector.BO.ModuleConfiguration.save_rule_button) + .call(done); + }); + }, + + applyRule : function(i){ + it('should click on "apply rule" button', function(done){ + global.fctname= this.test.title; + this.client + .pause(6000) + .waitForVisible(this.selector.BO.ModuleConfiguration.apply_rule_button.replace('%s', i), 90000) + .click(this.selector.BO.ModuleConfiguration.apply_rule_button.replace('%s', i)) + .pause(5000) + .call(done); + }); + }, + + closeGreenValidation : function(){ + it('should close the green validatlon', function(done){ + global.fctname= this.test.title; + this.client + .pause(2000) + .waitForExist(this.selector.BO.ModuleConfiguration.green_validation_notice, 90000) + .click(this.selector.BO.ModuleConfiguration.green_validation_notice) + .call(done); + }); + } +} \ No newline at end of file diff --git a/SEOImage_module/test/scenario/actionbloc/authentication.webdriverio.js b/SEOImage_module/test/scenario/actionbloc/authentication.webdriverio.js new file mode 100644 index 0000000..bb983fa --- /dev/null +++ b/SEOImage_module/test/scenario/actionbloc/authentication.webdriverio.js @@ -0,0 +1,48 @@ +module.exports = { + loginBO : function () { + describe('Log in in Back Office', function (done) { + it('should log in successfully in BO', function (done) { + global.fctname = this.test.title; + this.client + .signinBO() + .waitForExist(this.selector.BO.Common.menu, 90000) + .call(done); + }); + }); + }, + + logoutBO : function(){ + describe('Log out from the Back Office', function (done) { + it('should log out successfully in BO', function (done) { + global.fctname = this.test.title; + this.client + .signoutBO() + .call(done); + }); + }); + }, + + loginFO : function() { + describe('Go to the front office', function () { + it('should go to the FO', function (done) { + global.fctname = this.test.title; + this.client + .signinFO() + .call(done); + }); + }); + }, + + openShop : function(){ + describe('Go to the front office', function () { + it('should go to the FO', function (done) { + global.fctname = this.test.title; + this.client + .url('http://' + URL) + .waitForExist(this.selector.FO.HomePage.logo_home_page) + .call(done); + }); + }); + } + +}; diff --git a/SEOImage_module/test/scenario/actionbloc/check-rule.webdriverio.js b/SEOImage_module/test/scenario/actionbloc/check-rule.webdriverio.js new file mode 100644 index 0000000..26684fc --- /dev/null +++ b/SEOImage_module/test/scenario/actionbloc/check-rule.webdriverio.js @@ -0,0 +1,61 @@ +var should = require('should'); + +module.exports = { + verifRule: function (x , y) { + it('should check the rule in the cover image of the' + y, function (done) { + global.fctname = this.test.title; + this.client + .getAttribute(this.selector.FO.ProductPage.product_image, "alt").then(function (text) { + should(text).be.equal(x); + }) + .call(done); + }); + + it('should check the rule in the thumbnail image of the' + y, function (done) { + global.fctname = this.test.title; + this.client + .getAttribute(this.selector.FO.ProductPage.thumbnail_image, "alt").then(function (text) { + should(text).be.equal(x); + }) + .call(done); + }); + }, + + selectSleevesTshirtProduct: function () { + it('should select the "Faded Short Sleeves T-Shirt" product in the category "Tops"', function (done) { + global.fctname = this.test.title; + this.client + .waitForExist(this.selector.FO.HomePage.logo_home_page, 90000) + .click(this.selector.FO.HomePage.logo_home_page) + .waitForExist(this.selector.FO.HomePage.sleeves_tshirt_image, 90000) + .click(this.selector.FO.HomePage.sleeves_tshirt_image) + .call(done); + }); + }, + + selectPrintedDressCasualDressesCategory: function () { + it('should select the "Printed Dress" product in the category "Dresses"', function (done) { + global.fctname = this.test.title; + this.client + .waitForExist(this.selector.FO.HomePage.logo_home_page, 90000) + .click(this.selector.FO.HomePage.logo_home_page) + .waitForExist(this.selector.FO.HomePage.printed_dress_casual_dresses_category_image, 90000) + .click(this.selector.FO.HomePage.printed_dress_casual_dresses_category_image) + .call(done); + }); + }, + + selectPrintedDressEveningDressesCategory: function () { + it('should select the "Printed Dress" product in the category "Dresses"', function (done) { + global.fctname = this.test.title; + this.client + .waitForExist(this.selector.FO.HomePage.logo_home_page, 90000) + .click(this.selector.FO.HomePage.logo_home_page) + .waitForExist(this.selector.FO.HomePage.printed_dress_evening_dresses_category_image, 90000) + .click(this.selector.FO.HomePage.printed_dress_evening_dresses_category_image) + .call(done); + }); + } + + +} \ No newline at end of file diff --git a/SEOImage_module/test/scenario/actionbloc/set-language.webdriverio.js b/SEOImage_module/test/scenario/actionbloc/set-language.webdriverio.js new file mode 100644 index 0000000..46aacfd --- /dev/null +++ b/SEOImage_module/test/scenario/actionbloc/set-language.webdriverio.js @@ -0,0 +1,27 @@ +module.exports = { + selectRuleLanguage: function (i,language) { + it('should set the rule language to' + language, function(done) { + global.fctname = this.test.title; + this.client + .waitForExist(this.selector.BO.ModuleConfiguration.ruleLanguage_dropdownlist, 90000) + .click(this.selector.BO.ModuleConfiguration.ruleLanguage_dropdownlist) + .waitForExist(this.selector.BO.ModuleConfiguration.ruleLanguage_select.replace('%s', i), 90000) + .click(this.selector.BO.ModuleConfiguration.ruleLanguage_select.replace('%s', i)) + .call(done); + }); + }, + + selectLanguageFO: function (i,language) { + it('should set the shop language to' + language, function (done) { + global.fctname = this.test.title; + this.client + .waitForVisible(this.selector.FO.Common.language_button, 90000) + .click(this.selector.FO.Common.language_button) + .pause(3000) + .waitForExist(this.selector.FO.Common.chooseLanguage_button.replace('%s', i), 90000) + .click(this.selector.FO.Common.chooseLanguage_button.replace('%s', i)) + .pause(5000) + .call(done); + }); + } +}; diff --git a/Upela/test/scenario/BO/check_account_creation.webdriverio.js b/Upela/test/scenario/BO/check_account_creation.webdriverio.js index 9caf6a4..9c38e23 100644 --- a/Upela/test/scenario/BO/check_account_creation.webdriverio.js +++ b/Upela/test/scenario/BO/check_account_creation.webdriverio.js @@ -14,7 +14,7 @@ describe('Test case n°1 = check account creation', function () { after(common.after); describe('Log in in Back Office', function (done) { - it('should log in successfully in BO', function (done) { + it('should log in successfully in actionbloc', function (done) { this.client .signinBO() .waitForExist(this.selector.BO.Common.menu, 90000) diff --git a/Upela/test/scenario/BO/check_login_to_upela_account.webdriverio.js b/Upela/test/scenario/BO/check_login_to_upela_account.webdriverio.js index 1be4f65..05ecd71 100644 --- a/Upela/test/scenario/BO/check_login_to_upela_account.webdriverio.js +++ b/Upela/test/scenario/BO/check_login_to_upela_account.webdriverio.js @@ -14,7 +14,7 @@ describe('Test case n°2 = check upela account connection', function () { after(common.after); describe('Log in in Back Office', function (done) { - it('should log in successfully in BO', function (done) { + it('should log in successfully in actionbloc', function (done) { this.client .url('http://' + URL + '/backoffice/') .waitForExist(this.selector.BO.Common.menu, 90000) diff --git a/Upela/test/scenario/BO/check_shop_creation.webdriverio.js b/Upela/test/scenario/BO/check_shop_creation.webdriverio.js index 87dda73..cfb86df 100644 --- a/Upela/test/scenario/BO/check_shop_creation.webdriverio.js +++ b/Upela/test/scenario/BO/check_shop_creation.webdriverio.js @@ -14,7 +14,7 @@ describe('Test case n°3 = check upela account connection', function () { after(common.after); describe('Log in in Back Office', function (done) { - it('should log in successfully in BO', function (done) { + it('should log in successfully in actionbloc', function (done) { this.client .url('http://' + URL + '/backoffice/') .waitForExist(this.selector.BO.Common.menu, 90000)