Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15312 from nesrineabdmouleh/sanity_tests_orders_BO
Order BO tests with puppeteer - Sanity tests campaign
- Loading branch information
Showing
4 changed files
with
226 additions
and
0 deletions.
There are no files selected for viewing
65 changes: 65 additions & 0 deletions
65
tests/puppeteer/campaigns/sanity/ordersBO/01_filterOrders.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Using chai | ||
const {expect} = require('chai'); | ||
// importing pages | ||
const LoginPage = require('../../../pages/BO/login'); | ||
const DashboardPage = require('../../../pages/BO/dashboard'); | ||
const BOBasePage = require('../../../pages/BO/BObasePage'); | ||
const OrderPage = require('../../../pages/BO/order'); | ||
|
||
let page; | ||
let loginPage; | ||
let dashboardPage; | ||
let boBasePage; | ||
let orderPage; | ||
// creating pages objects in a function | ||
const init = async () => { | ||
page = await global.browser.newPage(); | ||
loginPage = await (new LoginPage(page)); | ||
dashboardPage = await (new DashboardPage(page)); | ||
boBasePage = await (new BOBasePage(page)); | ||
orderPage = await (new OrderPage(page)); | ||
}; | ||
|
||
/* | ||
Connect to the BO | ||
Filter the Orders table | ||
Logout from the BO | ||
*/ | ||
global.scenario('Filter the Orders table by ID, REFERENCE, STATUS', async () => { | ||
test('should login into BO', async () => { | ||
await loginPage.goTo(global.URL_BO); | ||
await loginPage.login(global.EMAIL, global.PASSWD); | ||
const pageTitle = await dashboardPage.getPageTitle(); | ||
await expect(pageTitle).to.contains(dashboardPage.pageTitle); | ||
await boBasePage.closeOnboardingModal(); | ||
}); | ||
|
||
test('should go to the Orders page', async () => { | ||
await boBasePage.goToSubMenu(boBasePage.ordersParentLink, orderPage.ordersLink); | ||
const pageTitle = await orderPage.getPageTitle(); | ||
await expect(pageTitle).to.contains(orderPage.pageTitle); | ||
}); | ||
|
||
test('should filter the Orders table by ID and check the result', async () => { | ||
await orderPage.filterTableByInput(orderPage.orderFilterIdInput, '1', orderPage.searchButton); | ||
await boBasePage.checkTextValue(orderPage.orderfirstLineIdTD, '1'); | ||
await orderPage.waitForSelectorAndClick(orderPage.resetButton) | ||
}); | ||
|
||
test('should filter the Orders table by REFERENCE and check the result', async () => { | ||
await orderPage.filterTableByInput(orderPage.orderFilterReferenceInput, 'FFATNOMMJ', orderPage.searchButton); | ||
await boBasePage.checkTextValue(orderPage.orderfirstLineReferenceTD, 'FFATNOMMJ'); | ||
await orderPage.waitForSelectorAndClick(orderPage.resetButton) | ||
}); | ||
|
||
test('should filter the Orders table by STATUS and check the result', async () => { | ||
await orderPage.filterTableBySelect(orderPage.orderFilterStatusSelect, '8'); | ||
await orderPage.checkTextValue(orderPage.orderfirstLineStatusTD, 'Payment error'); | ||
}); | ||
|
||
test('should logout from the BO', async () => { | ||
await boBasePage.logoutBO(); | ||
const pageTitle = await loginPage.getPageTitle(); | ||
await expect(pageTitle).to.contains(loginPage.pageTitle); | ||
}); | ||
}, init, true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Using chai | ||
const {expect} = require('chai'); | ||
// importing pages | ||
const LoginPage = require('../../../pages/BO/login'); | ||
const DashboardPage = require('../../../pages/BO/dashboard'); | ||
const BOBasePage = require('../../../pages/BO/BObasePage'); | ||
const OrderPage = require('../../../pages/BO/order'); | ||
|
||
let page; | ||
let loginPage; | ||
let dashboardPage; | ||
let boBasePage; | ||
let orderPage; | ||
// creating pages objects in a function | ||
const init = async () => { | ||
page = await global.browser.newPage(); | ||
loginPage = await (new LoginPage(page)); | ||
dashboardPage = await (new DashboardPage(page)); | ||
boBasePage = await (new BOBasePage(page)); | ||
orderPage = await (new OrderPage(page)); | ||
}; | ||
|
||
/* | ||
Connect to the BO | ||
Edit the first order | ||
Logout from the BO | ||
*/ | ||
global.scenario('Edit Order BO', async () => { | ||
test('should login into BO', async () => { | ||
await loginPage.goTo(global.URL_BO); | ||
await loginPage.login(global.EMAIL, global.PASSWD); | ||
const pageTitle = await dashboardPage.getPageTitle(); | ||
await expect(pageTitle).to.contains(dashboardPage.pageTitle); | ||
await boBasePage.closeOnboardingModal(); | ||
}); | ||
|
||
test('should go to the Orders page', async () => { | ||
await boBasePage.goToSubMenu(boBasePage.ordersParentLink, orderPage.ordersLink); | ||
const pageTitle = await orderPage.getPageTitle(); | ||
await expect(pageTitle).to.contains(orderPage.pageTitle); | ||
}); | ||
|
||
test('should go to the first order page', async () => { | ||
await boBasePage.waitForSelectorAndClick(orderPage.orderfirstLineIdTD); | ||
const pageTitle = await orderPage.getPageTitle(); | ||
await expect(pageTitle).to.contains(orderPage.orderPageTitle); | ||
}); | ||
|
||
test('should modify the product quantity and check the validation', async () => { | ||
await orderPage.modifyProductQuantity('1', '5'); | ||
}); | ||
|
||
test('should modify the order status and check the validation', async () => { | ||
await orderPage.modifyOrderStatus('Payment accepted'); | ||
}); | ||
|
||
test('should logout from the BO', async () => { | ||
await boBasePage.logoutBO(); | ||
const pageTitle = await loginPage.getPageTitle(); | ||
await expect(pageTitle).to.contains(loginPage.pageTitle); | ||
}); | ||
}, init, true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters