-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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 #36393 from Progi1984/test3615
Functional Tests : BO - Shop Parameters - Search : Blacklisted words
- Loading branch information
Showing
9 changed files
with
261 additions
and
604 deletions.
There are no files selected for viewing
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
178 changes: 178 additions & 0 deletions
178
...nal/BO/13_shopParameters/07_search/01_search/01_editSearchSettings/06_blacklistedWords.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,178 @@ | ||
// Import utils | ||
import testContext from '@utils/testContext'; | ||
|
||
// Import login steps | ||
import loginCommon from '@commonTests/BO/loginBO'; | ||
|
||
// Import pages | ||
// Import BO pages | ||
import boProductsPage from '@pages/BO/catalog/products'; | ||
import boProductsCreatePage from '@pages/BO/catalog/products/add'; | ||
// Import FO pages | ||
import {homePage} from '@pages/FO/classic/home'; | ||
import {searchResultsPage} from '@pages/FO/classic/searchResults'; | ||
|
||
import {expect} from 'chai'; | ||
import type {BrowserContext, Page} from 'playwright'; | ||
import { | ||
boDashboardPage, | ||
boSearchPage, | ||
dataLanguages, | ||
utilsPlaywright, | ||
} from '@prestashop-core/ui-testing'; | ||
|
||
const baseContext: string = 'functional_BO_shopParameters_search_search_editSearchSettings_blacklistedWords'; | ||
|
||
describe('BO - Shop Parameters - Search : Blacklisted words', async () => { | ||
const searchWord: string = 'does'; | ||
|
||
let browserContext: BrowserContext; | ||
let page: Page; | ||
let blacklistedWordsListEN: string; | ||
|
||
// before and after functions | ||
before(async function () { | ||
browserContext = await utilsPlaywright.createBrowserContext(this.browser); | ||
page = await utilsPlaywright.newTab(browserContext); | ||
}); | ||
|
||
after(async () => { | ||
await utilsPlaywright.closeBrowserContext(browserContext); | ||
}); | ||
|
||
it('should login in BO', async function () { | ||
await loginCommon.loginBO(this, page); | ||
}); | ||
|
||
it('should go to \'Shop Parameters > Search\' page', async function () { | ||
await testContext.addContextItem(this, 'testIdentifier', 'goToSearchPage', baseContext); | ||
|
||
await boDashboardPage.goToSubMenu( | ||
page, | ||
boDashboardPage.shopParametersParentLink, | ||
boDashboardPage.searchLink, | ||
); | ||
|
||
const pageTitle = await boSearchPage.getPageTitle(page); | ||
expect(pageTitle).to.contains(boSearchPage.pageTitle); | ||
}); | ||
|
||
it('should verify that the Blacklisted words list is not empty', async function () { | ||
await testContext.addContextItem(this, 'testIdentifier', 'checkBlacklistedWordsList', baseContext); | ||
|
||
blacklistedWordsListEN = await boSearchPage.getBlacklistedWords(page, dataLanguages.english.id); | ||
expect(blacklistedWordsListEN.length).to.be.gt(0); | ||
expect(blacklistedWordsListEN).to.contains(searchWord); | ||
|
||
const blacklistedWordsListFR = await boSearchPage.getBlacklistedWords(page, dataLanguages.french.id); | ||
expect(blacklistedWordsListFR.length).to.be.gt(0); | ||
}); | ||
|
||
it('should go to \'Catalog > Products\' page', async function () { | ||
await testContext.addContextItem(this, 'testIdentifier', 'goToCatalogProducts', baseContext); | ||
|
||
await boDashboardPage.goToSubMenu(page, boDashboardPage.catalogParentLink, boDashboardPage.productsLink); | ||
await boProductsPage.closeSfToolBar(page); | ||
|
||
const pageTitle = await boProductsPage.getPageTitle(page); | ||
expect(pageTitle).to.contains(boProductsPage.pageTitle); | ||
}); | ||
|
||
it('should create a standard product', async function () { | ||
await testContext.addContextItem(this, 'testIdentifier', 'clickAddNewProduct', baseContext); | ||
|
||
const isModalVisible = await boProductsPage.clickOnNewProductButton(page); | ||
expect(isModalVisible).to.eq(true); | ||
|
||
await boProductsPage.selectProductType(page, 'standard'); | ||
await boProductsPage.clickOnAddNewProduct(page); | ||
|
||
const pageTitle = await boProductsCreatePage.getPageTitle(page); | ||
expect(pageTitle).to.contains(boProductsCreatePage.pageTitle); | ||
}); | ||
|
||
it('should set the title product and publish', async function () { | ||
await testContext.addContextItem(this, 'testIdentifier', 'setTitleProduct', baseContext); | ||
|
||
await boProductsCreatePage.setProductName(page, `Test ${searchWord}`); | ||
await boProductsCreatePage.setProductStatus(page, true); | ||
|
||
const updateProductMessage = await boProductsCreatePage.saveProduct(page); | ||
expect(updateProductMessage).to.equal(boProductsCreatePage.successfulUpdateMessage); | ||
}); | ||
|
||
it('should go to the FrontOffice', async function () { | ||
await testContext.addContextItem(this, 'testIdentifier', 'viewMyShop', baseContext); | ||
|
||
page = await boProductsCreatePage.viewMyShop(page); | ||
await homePage.changeLanguage(page, 'en'); | ||
|
||
const isHomePage = await homePage.isHomePage(page); | ||
expect(isHomePage, 'Fail to open FO home page').to.eq(true); | ||
}); | ||
|
||
it(`should search the word "${searchWord}"`, async function () { | ||
await testContext.addContextItem(this, 'testIdentifier', 'searchWordWithError', baseContext); | ||
|
||
await homePage.searchProduct(page, searchWord); | ||
|
||
const pageTitle = await searchResultsPage.getPageTitle(page); | ||
expect(pageTitle).to.equal(searchResultsPage.pageTitle); | ||
|
||
const hasResults = await searchResultsPage.hasResults(page); | ||
expect(hasResults).to.eq(false); | ||
|
||
const searchInputValue = await searchResultsPage.getSearchValue(page); | ||
expect(searchInputValue).to.be.equal(searchWord); | ||
}); | ||
|
||
it('should return to \'Shop Parameters > Search\' page', async function () { | ||
await testContext.addContextItem(this, 'testIdentifier', 'returnToSearchPage', baseContext); | ||
|
||
page = await searchResultsPage.changePage(browserContext, 0); | ||
await boDashboardPage.goToSubMenu( | ||
page, | ||
boDashboardPage.shopParametersParentLink, | ||
boDashboardPage.searchLink, | ||
); | ||
|
||
const pageTitle = await boSearchPage.getPageTitle(page); | ||
expect(pageTitle).to.contains(boSearchPage.pageTitle); | ||
}); | ||
|
||
it(`should remove the word ${searchWord} from the list`, async function () { | ||
await testContext.addContextItem(this, 'testIdentifier', 'removeWordFromList', baseContext); | ||
|
||
const textResult = await boSearchPage.setBlacklistedWords( | ||
page, | ||
dataLanguages.english.id, | ||
blacklistedWordsListEN.replace(`${searchWord}|`, ''), | ||
); | ||
expect(textResult).to.be.eq(boSearchPage.settingsUpdateMessage); | ||
}); | ||
|
||
it(`should search the word "${searchWord}"`, async function () { | ||
await testContext.addContextItem(this, 'testIdentifier', 'searchWordWithSuccess', baseContext); | ||
|
||
page = await searchResultsPage.changePage(browserContext, 1); | ||
await page.reload(); | ||
|
||
const pageTitle = await searchResultsPage.getPageTitle(page); | ||
expect(pageTitle).to.equal(searchResultsPage.pageTitle); | ||
|
||
const hasResults = await searchResultsPage.hasResults(page); | ||
expect(hasResults).to.eq(true); | ||
|
||
const searchInputValue = await searchResultsPage.getSearchValue(page); | ||
expect(searchInputValue).to.be.equal(searchWord); | ||
}); | ||
|
||
it('should reset the list', async function () { | ||
await testContext.addContextItem(this, 'testIdentifier', 'resetList', baseContext); | ||
|
||
page = await searchResultsPage.changePage(browserContext, 0); | ||
|
||
const textResult = await boSearchPage.setBlacklistedWords(page, dataLanguages.english.id, blacklistedWordsListEN); | ||
expect(textResult).to.be.eq(boSearchPage.settingsUpdateMessage); | ||
}); | ||
}); |
Oops, something went wrong.