forked from PrestaShop/PrestaShop
-
Notifications
You must be signed in to change notification settings - Fork 1
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 PrestaShop#35302 from nesrineabdmouleh/TEST-4984
Functional tests - Add new test in 'FO > Hummingbird > logout from user account page'
- Loading branch information
Showing
1 changed file
with
84 additions
and
0 deletions.
There are no files selected for viewing
84 changes: 84 additions & 0 deletions
84
tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/04_logOut.ts
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,84 @@ | ||
// Import utils | ||
import helper from '@utils/helpers'; | ||
import testContext from '@utils/testContext'; | ||
import files from '@utils/files'; | ||
|
||
// Import common tests | ||
import {installHummingbird, uninstallHummingbird} from '@commonTests/FO/hummingbird'; | ||
|
||
// Import FO pages | ||
import homePage from '@pages/FO/hummingbird/home'; | ||
import loginPage from '@pages/FO/hummingbird/login'; | ||
import myAccountPage from '@pages/FO/hummingbird/myAccount'; | ||
|
||
// Import data | ||
import Customers from '@data/demo/customers'; | ||
|
||
import {expect} from 'chai'; | ||
import type {BrowserContext, Page} from 'playwright'; | ||
|
||
const baseContext: string = 'functional_FO_hummingbird_userAccount_logOut'; | ||
|
||
describe('FO - User Account : LogOut', async () => { | ||
let browserContext: BrowserContext; | ||
let page: Page; | ||
|
||
// Pre-condition : Install Hummingbird | ||
installHummingbird(`${baseContext}_preTest`); | ||
|
||
// before and after functions | ||
before(async function () { | ||
browserContext = await helper.createBrowserContext(this.browser); | ||
page = await helper.newTab(browserContext); | ||
}); | ||
|
||
after(async () => { | ||
await helper.closeBrowserContext(browserContext); | ||
await files.deleteFile('../../admin-dev/hummingbird.zip'); | ||
}); | ||
|
||
describe('Logout in FO', async () => { | ||
it('should open the shop page', async function () { | ||
await testContext.addContextItem(this, 'testIdentifier', 'goToShopFO', baseContext); | ||
|
||
await homePage.goTo(page, global.FO.URL); | ||
|
||
const result = await homePage.isHomePage(page); | ||
expect(result).to.eq(true); | ||
}); | ||
|
||
it('should logIn', async function () { | ||
await testContext.addContextItem(this, 'testIdentifier', 'enterValidCredentials', baseContext); | ||
|
||
await homePage.goToLoginPage(page); | ||
await loginPage.customerLogin(page, Customers.johnDoe); | ||
|
||
const isCustomerConnected = await loginPage.isCustomerConnected(page); | ||
expect(isCustomerConnected, 'Customer is not connected!').to.eq(true); | ||
|
||
const result = await homePage.isHomePage(page); | ||
expect(result).to.eq(true); | ||
}); | ||
|
||
it('should go to my account page', async function () { | ||
await testContext.addContextItem(this, 'testIdentifier', 'goToAccountPage', baseContext); | ||
|
||
await homePage.goToMyAccountPage(page); | ||
|
||
const pageTitle = await myAccountPage.getPageTitle(page); | ||
expect(pageTitle).to.equal(myAccountPage.pageTitle); | ||
}); | ||
|
||
it('should logOut with link in the footer', async function () { | ||
await testContext.addContextItem(this, 'testIdentifier', 'signOutWithLinkAtAccountPage', baseContext); | ||
|
||
await myAccountPage.logout(page); | ||
|
||
const isCustomerConnected = await myAccountPage.isCustomerConnected(page); | ||
expect(isCustomerConnected, 'Customer is connected!').to.eq(false); | ||
}); | ||
}); | ||
|
||
// Post-condition : Uninstall Hummingbird | ||
uninstallHummingbird(`${baseContext}_postTest`); | ||
}); |