diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100755 index e69de29..0000000 diff --git a/README.md b/README.md index bd80a38..6146176 100755 --- a/README.md +++ b/README.md @@ -3,6 +3,10 @@ Currently this framework has been developed to run scripts on Chrome Browser and windows Platform To run the suite on different browser and platform changes in "wdio.conf.js" file will be required. +## Important + +Please verify that package.json file with described dependencies presents in the project. + ### Tech Stack * [Selenium Service] - This is a node based CLI library for launching Selenium with WebDrivers support. diff --git a/buildinfo.txt b/buildinfo.txt deleted file mode 100644 index 5ed8a0a..0000000 --- a/buildinfo.txt +++ /dev/null @@ -1,3 +0,0 @@ -Backend version: 6.06.01 -DB schema version: 6.06.01 -Frontend build version: 6.06.01 (Mon, 05 Jul 2021 07:02:00 GMT) \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100755 index e69de29..0000000 diff --git a/test/javascript/pageobjects/Catalog.page.js b/test/javascript/pageobjects/Catalog.page.js index 4c02849..9a4d67f 100644 --- a/test/javascript/pageobjects/Catalog.page.js +++ b/test/javascript/pageobjects/Catalog.page.js @@ -7,65 +7,18 @@ class CatalogPage extends Page { //get CatalogLink() { return $('#hp > div.main > div.header.box > div.slogan > ul > li:nth-child(3) > a""]'); } get cart() { return $('#cart')}; - /** - * Method to verify visible menu links - */ - verifyVisibleMenuList(allowedMenuItemList, dataTable) { - browser.pause(3000); - if (allowedMenuItemList == "Organization") { - //expect(super.organizationMenuLink.isDisplayed(), "Organization menu is not visible").to.be.true; - super.organizationMenuLink.click(); - utilObj.waitForDefaultTimeOut(); - var List = dataTable.raw(); - //console.log(List) - List.forEach(element => { - element.forEach(item => { - if (item == "Users and devices") { - //browser.saveScreenshot(); - //expect(super.userDeviceMenuLink.isDisplayed(), "Users and devices menu is not visible").to.be.true; - //allure.createStep("Admin has access of user and device page") - } - else if (item == "Hierarchies and groups") { - //browser.saveScreenshot(); - //expect(super.hieGroupMenuLink.isDisplayed(), "Hierarchies and groups menu is not visible").to.be.true; - //allure.createStep("Admin has access of user and device page") - } - else if (item == "User assignment") { - //browser.saveScreenshot(); - //expect(super.userAssignmentLink.isDisplayed(), "User assignment menu is not visible").to.be.true; - //allure.createStep("Admin has access of user and device page") - } - else if (item == "Device pool") { - //browser.saveScreenshot(); - //expect(super.devicePoolLink.isDisplayed(), "Device pool menu is not visible").to.be.true; - //allure.createStep("Admin has access of user and device page") - } else { - //browser.saveScreenshot(); - throw "Invalid menu item" - } - }); - }); - } - // else if (allowedMenuItemList == "Dashboard") { - - // } - } - - /** - * Method to verofy if current page is dashboard else navigate to dashboard - */ - verifyCurrentPage() { - let currentPage = browser.getTitle(); - if (currentPage.includes("Dashboard")) { - allure.createStep('User is on Dashboard'); - } - else { - // super.dashboardLink.scroll(); - super.dashboardLink.click(); - //allure.addDescription("open the server instance"); - } - } - + get firstItemSelect() { return $('#content > table > tbody > tr:nth-child(4) > td:nth-child(1) > a > b')}; + get addToCartButton() { return $('#content > div.product-list > div > div.right > div > input')}; + get totalCart() {return $('#cart-total')}; + get processOrderLink() {return $('#cart > div.content > div.checkout > a:nth-child(2)')}; + get processAsGuestButton() {return $('#button-account')}; + get firstName() {return $('#payment-address > div.checkout-content > div.left > input:nth-child(4)')}; + get lastName() {return $('#payment-address > div.checkout-content > div.left > input:nth-child(9)')}; + get email() {return $('#payment-address > div.checkout-content > div.left > input:nth-child(14)')}; + get phone() {return $('#payment-address > div.checkout-content > div.left > input:nth-child(19)')}; + get address() {return $('#payment-address > div.checkout-content > div.right > input:nth-child(11)')}; + get city() {return $('#payment-address > div.checkout-content > div.right > input:nth-child(20)')}; + get buttonGuest() {return $('#button-guest')}; /** * Method to navigate to home page */ @@ -86,15 +39,6 @@ class CatalogPage extends Page { } } - /** - * Verify admin can changes its password - */ - verifyAdminCanChangeCredentials(){ - utilObj.waitForDefaultTimeOut(); - super.adminNameClass.click(); - super.adminDivModel.waitForExist(30000); - } - verifyCatalogPage() { //this.cart.isDisplayed() if (this.cart.isDisplayed()) { @@ -109,6 +53,57 @@ class CatalogPage extends Page { } } + selectFirstItem() + { + //browser.pause(5000); + utilObj.waitForDefaultTimeOut(); + this.firstItemSelect.click(); + } + + addItemToCart() + + { + //browser.pause(5000); + utilObj.waitForDefaultTimeOut(); + this.addToCartButton.click(); + } + + clickTotalCart() + { + utilObj.waitForDefaultTimeOut(); + this.totalCart.click(); + } + + processWithOrder() + { + utilObj.waitForDefaultTimeOut(); + this.processOrderLink.click(); + } + + processAsGuest() { + utilObj.waitForDefaultTimeOut(); + this.processAsGuestButton.click(); + + } + + fillTheGuestPersonalInfo() { + this.firstName.click(); + this.firstName.setValue("Maksim") + this.lastName.click(); + this.lastName.setValue("KKK"); + this.email.click(); + this.email.setValue("someemail@someemail.com"); + this.phone.click(); + this.phone.setValue("123455"); + this.city.click(); + this.city.setValue("tallinn"); + this.address.setValue("tallinn 123434"); + this.address.click(); + //this.buttonGuest.click(); + //browser.pause(1000); + } + + } //module.exports = new HomePage(); module.exports = new CatalogPage(); \ No newline at end of file diff --git a/test/javascript/pageobjects/Home.page.js b/test/javascript/pageobjects/Home.page.js index d2b8b4c..aa83a2d 100755 --- a/test/javascript/pageobjects/Home.page.js +++ b/test/javascript/pageobjects/Home.page.js @@ -6,7 +6,9 @@ const utilObj = require( '../helper/WaitActions') class HomePage extends Page { get catalogLink() { return $('#hp > div.main > div.header.box > div.slogan > ul > li:nth-child(3) > a'); } - get News() { return $("#hp > div.main > div.header.box > div.slogan > ul > li:nth-child(2) > a"); } + get newsLink() { return $('#hp > div.main > div.header.box > div.slogan > ul > li:nth-child(2) > a'); } + get solutionsLink() { return $('#hp > div.main > div.header.box > div.slogan > ul > li:nth-child(4) > a'); } + /** * Method to verofy if current page is dashboard else navigate to dashboard @@ -58,7 +60,12 @@ class HomePage extends Page { navigateToNewsPage() { utilObj.waitForDefaultTimeOut(); - this.News.click(); + this.newsLink.click(); + } + + navigateToSolutionsPage() { + utilObj.waitForDefaultTimeOut(); + this.solutionsLink.click(); } } diff --git a/test/javascript/pageobjects/News.page.js b/test/javascript/pageobjects/News.page.js deleted file mode 100644 index 28a2f59..0000000 --- a/test/javascript/pageobjects/News.page.js +++ /dev/null @@ -1,114 +0,0 @@ -const Page = require('./Page'); -const allure = require('wdio-allure-reporter'); -const utilObj = require( '../helper/WaitActions') - - -class NewsPage extends Page { - - //get CatalogLink() { return $('#hp > div.main > div.header.box > div.slogan > ul > li:nth-child(3) > a""]'); } - get newsTitle() { return $("#hp > div.main > div.header.box > div.slogan > ul > li:nth-child(2) > a")}; - /** - * Method to verify visible menu links - */ - verifyVisibleMenuList(allowedMenuItemList, dataTable) { - browser.pause(3000); - if (allowedMenuItemList == "Organization") { - //expect(super.organizationMenuLink.isDisplayed(), "Organization menu is not visible").to.be.true; - super.organizationMenuLink.click(); - utilObj.waitForDefaultTimeOut(); - var List = dataTable.raw(); - //console.log(List) - List.forEach(element => { - element.forEach(item => { - if (item == "Users and devices") { - //browser.saveScreenshot(); - //expect(super.userDeviceMenuLink.isDisplayed(), "Users and devices menu is not visible").to.be.true; - //allure.createStep("Admin has access of user and device page") - } - else if (item == "Hierarchies and groups") { - //browser.saveScreenshot(); - //expect(super.hieGroupMenuLink.isDisplayed(), "Hierarchies and groups menu is not visible").to.be.true; - //allure.createStep("Admin has access of user and device page") - } - else if (item == "User assignment") { - //browser.saveScreenshot(); - //expect(super.userAssignmentLink.isDisplayed(), "User assignment menu is not visible").to.be.true; - //allure.createStep("Admin has access of user and device page") - } - else if (item == "Device pool") { - //browser.saveScreenshot(); - //expect(super.devicePoolLink.isDisplayed(), "Device pool menu is not visible").to.be.true; - //allure.createStep("Admin has access of user and device page") - } else { - //browser.saveScreenshot(); - throw "Invalid menu item" - } - }); - }); - } - // else if (allowedMenuItemList == "Dashboard") { - - // } - } - - /** - * Method to verofy if current page is dashboard else navigate to dashboard - */ - verifyCurrentPage() { - let currentPage = browser.getTitle(); - if (currentPage.includes("Dashboard")) { - allure.createStep('User is on Dashboard'); - } - else { - // super.dashboardLink.scroll(); - super.dashboardLink.click(); - //allure.addDescription("open the server instance"); - } - } - - /** - * Method to navigate to home page - */ - navigateToHomepage() { - utilObj.waitForDefaultTimeOut() - if (super.homePageLink.isDisplayed()) { - super.homePageLink.click() - utilObj.waitForPageToLoad() - } - else { - utilObj.waitForDefaultTimeOut() - super.reportsLink.waitForExist(utilObj.defaultwait) - super.reportsLink.click() - utilObj.waitForDefaultTimeOut() - super.homePageLink.waitForExist(utilObj.defaultwait) - super.homePageLink.click() - browser.pause(5000); - } - } - - /** - * Verify admin can changes its password - */ - verifyAdminCanChangeCredentials(){ - utilObj.waitForDefaultTimeOut(); - super.adminNameClass.click(); - super.adminDivModel.waitForExist(30000); - } - - verifyNewsPage() { - //this.NewPage.isDisplayed() - if (this.newsTitle.isDisplayed()) { - allure.createStep('User is on catalog'); - } - else { - // super.dashboardLink.scroll(); - utilObj.waitForDefaultTimeOut(); - throw "Something went wrong, User is not in catalog" - //super.dashboardLink.click(); - //allure.addDescription("open the server instance"); - } - } - -} -//module.exports = new HomePage(); -module.exports = new NewsPage(); \ No newline at end of file diff --git a/test/javascript/pageobjects/NewsPage.page.js b/test/javascript/pageobjects/NewsPage.page.js new file mode 100644 index 0000000..0d655a2 --- /dev/null +++ b/test/javascript/pageobjects/NewsPage.page.js @@ -0,0 +1,47 @@ +const Page = require('./Page'); +const allure = require('wdio-allure-reporter'); +const utilObj = require( '../helper/WaitActions') + + +class NewsPage extends Page { + + get newsTitle() { return $('#hp > div.main > div.content.box > h3:nth-child(1) > strong > i')}; + + + /** + * Method to navigate to home page + */ + navigateToHomepage() { + utilObj.waitForDefaultTimeOut() + if (super.homePageLink.isDisplayed()) { + super.homePageLink.click() + utilObj.waitForPageToLoad() + } + else { + utilObj.waitForDefaultTimeOut() + super.reportsLink.waitForExist(utilObj.defaultwait) + super.reportsLink.click() + utilObj.waitForDefaultTimeOut() + super.homePageLink.waitForExist(utilObj.defaultwait) + super.homePageLink.click() + browser.pause(5000); + } + } + + verifyNewsPage() { + //this.cart.isDisplayed() + if (this.newsTitle.isDisplayed()) { + allure.createStep('User is on catalog'); + } + else { + // super.dashboardLink.scroll(); + utilObj.waitForDefaultTimeOut(); + throw "Something went wrong, User is not in catalog" + //super.dashboardLink.click(); + //allure.addDescription("open the server instance"); + } + } + +} +//module.exports = new HomePage(); +module.exports = new NewsPage(); \ No newline at end of file diff --git a/test/javascript/pageobjects/solutions.page.js b/test/javascript/pageobjects/solutions.page.js index d598cf1..10a3a64 100644 --- a/test/javascript/pageobjects/solutions.page.js +++ b/test/javascript/pageobjects/solutions.page.js @@ -7,6 +7,7 @@ class SolutionsPage extends Page { //get SolutionsLink() { return $('#hp > div.main > div.content.box > ul:nth-child(1) > li:nth-child(1) > p.more > a); } get SolutionsTitle() { return $('#SolutionsTatle')}; + get galleryShowMoreButtonBlue() { return $('#hp > div.main > div.content.box > ul:nth-child(1) > li:nth-child(1) > p.more > a')}; /** * Method to verify visible menu links */ @@ -96,9 +97,10 @@ class SolutionsPage extends Page { } verifySolutionsPage() { + utilObj.waitForDefaultTimeOut(); //this.Solutions.isDisplayed() - if (this.SolutionPage.isDisplayed()) { - allure.createStep('User is on Solution'); + if (this.galleryShowMoreButtonBlue.isDisplayed()) { + allure.createStep('User is on Solution Page'); } else { // super.dashboardLink.scroll(); diff --git a/test/javascript/step-definition/CatalogPage.spec.js b/test/javascript/step-definition/CatalogPage.spec.js index 29a50f8..2edcc2c 100644 --- a/test/javascript/step-definition/CatalogPage.spec.js +++ b/test/javascript/step-definition/CatalogPage.spec.js @@ -17,6 +17,39 @@ When(/^User clicks Catalog link$/,()=>{ homeobject.navigateToCatalogPage(); }); +When(/^User selects first item$/,()=>{ + catalogobject.selectFirstItem(); +}); + +When(/^User adds item to cart$/,()=>{ + catalogobject.addItemToCart(); +}); + +When(/^User clicks cart$/,()=>{ + catalogobject.clickTotalCart(); +}); + +When(/^User processes with order$/,()=>{ + catalogobject.processWithOrder(); +}); + +When(/^User selects Guest option$/,()=>{ + catalogobject.processAsGuest(); +}); + + +When(/^User enters the personal details as Guest$/,()=>{ + catalogobject.fillTheGuestPersonalInfo(); +}); + +When(/^User does not select delivery mode$/,()=>{ + catalogobject.verifyCatalogPage(); +}); + +Then(/^User should see confirmation of order$/,()=>{ + catalogobject.verifyCatalogPage(); +}) + Then(/^User moves to Catalog page$/,()=>{ catalogobject.verifyCatalogPage(); }) \ No newline at end of file diff --git a/test/javascript/step-definition/NewsPage.spec.js b/test/javascript/step-definition/NewsPage.spec.js index aea80a9..70a9bac 100644 --- a/test/javascript/step-definition/NewsPage.spec.js +++ b/test/javascript/step-definition/NewsPage.spec.js @@ -1,13 +1,17 @@ const { Given, When, Then } = require('@cucumber/cucumber'); const homeobject = require('../pageobjects/Home.page'); -const Newsobject = require('../pageobjects/News.page'); +const newspageobject = require('../pageobjects/NewsPage.page'); +/*Given(/^User is on Home page$/,()=>{ + homeobject.open(); + homeobject.verifyCurrentPage(); +});*/ When(/^User clicks News link$/,()=>{ homeobject.navigateToNewsPage(); }); Then(/^User moves to News page$/,()=>{ - Newsobject.verifyNewsPage(); + newspageobject.verifyNewsPage(); }) \ No newline at end of file diff --git a/test/javascript/step-definition/SolutionsPage.spec.js b/test/javascript/step-definition/SolutionsPage.spec.js index b0d3732..9e95c57 100644 --- a/test/javascript/step-definition/SolutionsPage.spec.js +++ b/test/javascript/step-definition/SolutionsPage.spec.js @@ -3,15 +3,6 @@ const homeobject = require('../pageobjects/Home.page'); const Solutionsobject = require('../pageobjects/Solutions.page'); -Given(/^User is on Home page$/,()=>{ - homeobject.open(); - homeobject.verifyCurrentPage(); -}); - -Given(/^Admin is on Admin page$/,()=>{ - homeobject.openAdmin(); - //homeobject.verifyCurrentPage(); -}); When(/^User clicks Solutions link$/,()=>{ homeobject.navigateToSolutionsPage(); diff --git a/test/resources/features/CatalogBuyItemAsGuest.feature b/test/resources/features/CatalogBuyItemAsGuest.feature new file mode 100644 index 0000000..209e65a --- /dev/null +++ b/test/resources/features/CatalogBuyItemAsGuest.feature @@ -0,0 +1,15 @@ +Feature: User buys item as a guest + + Scenario: User buys item as a guest + Given User is on Home page + When User clicks Catalog link + And User selects first item + And User adds item to cart + And User clicks cart + And User processes with order + And User selects Guest option + And User enters the personal details as Guest + #And User does not select delivery mode + #Then User should see confirmation of order + + diff --git a/test/resources/features/CatalogPage.feature b/test/resources/features/CatalogPage.feature index e779220..76f9cb5 100644 --- a/test/resources/features/CatalogPage.feature +++ b/test/resources/features/CatalogPage.feature @@ -1,6 +1,5 @@ Feature: User navigates to Catalog page - @English Scenario: User navigates to Catalog page Given User is on Home page When User clicks Catalog link diff --git a/test/resources/features/Login.feature b/test/resources/features/Login.feature deleted file mode 100755 index 9b1d15c..0000000 --- a/test/resources/features/Login.feature +++ /dev/null @@ -1,36 +0,0 @@ -Feature: Login-Module. Admin should be able to login - - Background: Login Scenarios - Given Open the Login Page - - #JIRA Issue Id REVI-18 : https://mdm.atlassian.net/browse/REVI-18 - @English - Scenario Outline: Successful Login Scenario - Given Select the language English - When Enter and and click login button - Then user logged in successful and admin name is visible - And logout the user - Examples: - | Username | Password | - | admin | N3p1fwux | - - @English - #Jira Issue :https://mdm.atlassian.net/browse/REVI-19 - Scenario Outline: Unsuccessful Login Scenario - Given Select the language English - When Enter and and click login button - Then Incorrect credential message is visible - Examples: - | Username | Password | Langauge | ErrorMessage | - | admin | 123456 | English | Username or password is incorrect | - - @English - #Jira Issue :https://mdm.atlassian.net/browse/REVI-20 - Scenario Outline: Verify input field validation message - When Empty Username input - Then Validation message should be visible for Username - When Empty Password input - Then Validation message should be visible for Password - Examples: - | ErrorMessage | - | This field is required | diff --git a/test/resources/features/NewsPage.feature b/test/resources/features/NewsPage.feature index e71d9c1..95bc097 100644 --- a/test/resources/features/NewsPage.feature +++ b/test/resources/features/NewsPage.feature @@ -1,6 +1,5 @@ Feature: User navigates to News page - @English Scenario: User navigates to News page Given User is on Home page When User clicks News link diff --git a/test/resources/features/SolutionsPage.feature b/test/resources/features/SolutionsPage.feature index 13f8f8d..ddd5826 100644 --- a/test/resources/features/SolutionsPage.feature +++ b/test/resources/features/SolutionsPage.feature @@ -1,7 +1,7 @@ -Feature: User navigates to solutions page +Feature: User navigates to Solutions page @English - Scenario: User navigates to solutions page - Given User is on solutions page - When User clicks solutions link - Then User moves to solutions page \ No newline at end of file + Scenario: User navigates to Solutions page + Given User is on Home page + When User clicks Solutions link + Then User moves to Solutions page \ No newline at end of file diff --git a/wdio.conf.js b/wdio.conf.js index c69daac..e866719 100644 --- a/wdio.conf.js +++ b/wdio.conf.js @@ -5,8 +5,8 @@ const del = require('del'); global.downloadDir = path.join(__dirname, 'tempDownload'); global.dataDir = path.join(__dirname, './test/resources/testdata'); -global.username = 'admin'; -global.password = 'N3p1fwux'; +global.username = 'admin123'; +global.password = 'admin'; var dt = new Date() global.postfix = dt.getMonth() + '-' + dt.getDate() + '_' + dt.getHours() + ':' + dt.getMinutes() + ':' + dt.getSeconds(); global.tenant = '1_automation'; @@ -36,13 +36,14 @@ exports.config = { specs: [ //'./test/resources/features/**/*.feature', - './test/resources/features/CatalogPage.feature', - './test/resources/features/CatalogPageAdmin.feature', - './test/resources/features/NewsPage.feature', - './test/resources/features/SolutionsPage.feature' + './test/resources/features/CatalogBuyItemAsGuest.feature', ], // Patterns to exclude. exclude: [ + './test/resources/features/CatalogPage.feature', + './test/resources/features/NewsPage.feature', + './test/resources/features/CatalogPageAdmin.feature', + './test/resources/features/SolutionsPage.feature' // 'path/to/excluded/files' /*Important!!! always exclude this part*/ @@ -85,7 +86,7 @@ exports.config = { // maxInstances can get overwritten per capability. So if you have an in-house Selenium // grid with only 5 firefox instances available you can make sure that not more than // 5 instances get started at a time. - maxInstances: 5, + maxInstances: 2, // //browserName: 'chrome', browserName: 'chrome',