From 56e994269fdd9108de0c3754e529f72ec807e858 Mon Sep 17 00:00:00 2001 From: nesrineabdmouleh Date: Fri, 29 Sep 2023 10:24:00 +0200 Subject: [PATCH 1/6] Add new test to check seo tab --- .../productV2/functional/18_seoTab.ts | 273 ++++++++++++++++++ tests/UI/data/faker/product.ts | 17 ++ tests/UI/data/types/product.d.ts | 3 + .../pages/BO/catalog/productsV2/add/seoTab.ts | 102 ++++++- 4 files changed, 394 insertions(+), 1 deletion(-) create mode 100644 tests/UI/campaigns/productV2/functional/18_seoTab.ts diff --git a/tests/UI/campaigns/productV2/functional/18_seoTab.ts b/tests/UI/campaigns/productV2/functional/18_seoTab.ts new file mode 100644 index 0000000000000..6280706f4285b --- /dev/null +++ b/tests/UI/campaigns/productV2/functional/18_seoTab.ts @@ -0,0 +1,273 @@ +// Import utils +import helper from '@utils/helpers'; +import testContext from '@utils/testContext'; + +// Import common tests +import loginCommon from '@commonTests/BO/loginBO'; + +// Import BO pages +import dashboardPage from '@pages/BO/dashboard'; +import createProductPage from '@pages/BO/catalog/productsV2/add'; +import seoTab from '@pages/BO/catalog/productsV2/add/seoTab'; +import productsPage from '@pages/BO/catalog/productsV2'; + +// Import FO pages +import foProductPage from '@pages/FO/product'; +import {searchResultsPage} from '@pages/FO/searchResults'; +import categoryPageFO from '@pages/FO/category'; + +// Import data +import ProductData from '@data/faker/product'; +import Products from '@data/demo/products'; + +import type {BrowserContext, Page} from 'playwright'; +import {expect} from 'chai'; + +const baseContext: string = 'productV2_functional_seoTab'; + +describe('BO - Catalog - Products : Seo tab', async () => { + let browserContext: BrowserContext; + let page: Page; + + // Data to create standard product + const newProductData: ProductData = new ProductData({ + name: 'Oriental fresh chair', + type: 'standard', + quantity: 100, + minimumQuantity: 1, + status: true, + }); + // Data to edit standard product + const editProductData: ProductData = new ProductData({ + metaTitle: 'lorem ipsum', + metaDescription: 'lorem ipsum', + friendlyUrl: 'lorem ipsum', + }); + + // before and after functions + before(async function () { + browserContext = await helper.createBrowserContext(this.browser); + page = await helper.newTab(browserContext); + }); + + after(async () => { + await helper.closeBrowserContext(browserContext); + }); + + // 1 - Create product + describe('Create product', async () => { + it('should login in BO', async function () { + await loginCommon.loginBO(this, page); + }); + + it('should go to \'Catalog > Products\' page', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'goToProductsPage', baseContext); + + await dashboardPage.goToSubMenu( + page, + dashboardPage.catalogParentLink, + dashboardPage.productsLink, + ); + + await productsPage.closeSfToolBar(page); + + const pageTitle = await productsPage.getPageTitle(page); + await expect(pageTitle).to.contains(productsPage.pageTitle); + }); + + it('should click on \'New product\' button and check new product modal', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'clickOnNewProductButton', baseContext); + + const isModalVisible = await productsPage.clickOnNewProductButton(page); + await expect(isModalVisible).to.be.true; + }); + + it('should choose \'Standard product\' and go to new product page', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'chooseStandardProduct', baseContext); + + await productsPage.selectProductType(page, newProductData.type); + await productsPage.clickOnAddNewProduct(page); + + const pageTitle = await createProductPage.getPageTitle(page); + await expect(pageTitle).to.contains(createProductPage.pageTitle); + }); + + it('should create standard product', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'createStandardProduct', baseContext); + + const createProductMessage = await createProductPage.setProduct(page, newProductData); + await expect(createProductMessage).to.equal(createProductPage.successfulUpdateMessage); + }); + }); + + // 2 - Check all options in SEO tab + describe('Check all options in SEO tab', async () => { + it('should fill all fields on SEO Tab and check the error message', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'checkErrorMessage', baseContext); + + await createProductPage.goToTab(page, 'seo'); + await seoTab.setMetaTitle(page, editProductData.metaTitle!); + await seoTab.setMetaDescription(page, editProductData.metaDescription!); + await seoTab.setFriendlyUrl(page, editProductData.friendlyUrl!); + + const errorMessage = await seoTab.getErrorMessageOfFriendlyUrl(page); + expect(errorMessage).to.eq('"lorem ipsum" is invalid - Language: English (English)'); + }); + + it('should edit friendly URL', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'editFriendlyURL', baseContext); + + await seoTab.setFriendlyUrl(page, 'lorem-ipsum'); + + const message = await createProductPage.saveProduct(page); + expect(message).to.eq(createProductPage.successfulUpdateMessage); + }); + + it('should reset URL', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'resetURL', baseContext); + + await seoTab.clickOnGenerateUrlFromNameButton(page); + + const message = await createProductPage.saveProduct(page); + expect(message).to.eq(createProductPage.successfulUpdateMessage); + + const friendlyUrl = await seoTab.getValue(page, 'link_rewrite', '1'); + expect(friendlyUrl).to.eq('oriental-fresh-chair'); + }); + + it('should switch the product status to off', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'switchProductStatusToOff', baseContext); + + await createProductPage.setProductStatus(page, false); + + const message = await createProductPage.saveProduct(page); + expect(message).to.eq(createProductPage.successfulUpdateMessage); + }); + + it(`'should choose redirectionPage 'Products : ${Products.demo_1.name}'`, async function () { + await testContext.addContextItem(this, 'testIdentifier', 'chooseRedirectionPage2', baseContext); + + await seoTab.selectRedirectionPage(page, 'Permanent redirection to a product (301)'); + await seoTab.searchOptionTarget(page, Products.demo_1.name); + + const message = await createProductPage.saveProduct(page); + expect(message).to.eq(createProductPage.successfulUpdateMessage); + }); + + it(`should preview product and check '${Products.demo_1.name}' page`, async function () { + await testContext.addContextItem(this, 'testIdentifier', 'previewProduct2', baseContext); + + // Click on preview button + page = await createProductPage.previewProduct(page); + await foProductPage.changeLanguage(page, 'en'); + + const pageTitle = await foProductPage.getPageTitle(page); + expect(pageTitle).to.contains(Products.demo_1.name); + }); + + it('should go back to BO', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'goBackToBO2', baseContext); + + // Go back to BO + page = await foProductPage.closePage(browserContext, page, 0); + + const pageTitle = await createProductPage.getPageTitle(page); + expect(pageTitle).to.contains(createProductPage.pageTitle); + }); + + it('should choose redirectionPage \'Category : Home accessories\'', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'chooseRedirectionPage', baseContext); + + await seoTab.selectRedirectionPage(page, 'Permanent redirection to a category (301)'); + await seoTab.searchOptionTarget(page, 'Home accessories'); + + const message = await createProductPage.saveProduct(page); + expect(message).to.eq(createProductPage.successfulUpdateMessage); + }); + + it('should preview product and check \'Home Accessories\' page', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'previewProduct', baseContext); + + // Click on preview button + page = await createProductPage.previewProduct(page); + const currentUrl = await foProductPage.getCurrentURL(page); + const newUrl = currentUrl.split('token'); + await foProductPage.goTo(page, newUrl[0]); + await foProductPage.changeLanguage(page, 'en'); + + const pageTitle = await foProductPage.getPageTitle(page); + expect(pageTitle).to.contains('Home Accessories'); + }); + + it('should go back to BO', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'goBackToBO', baseContext); + + // Go back to BO + page = await foProductPage.closePage(browserContext, page, 0); + + const pageTitle = await createProductPage.getPageTitle(page); + expect(pageTitle).to.contains(createProductPage.pageTitle); + }); + + it('should add tag', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'addTag', baseContext); + + await seoTab.setTag(page, 'hello'); + + const message = await createProductPage.saveProduct(page); + expect(message).to.eq(createProductPage.successfulUpdateMessage); + }); + + it('should switch the product status to on', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'switchProductStatusToOn', baseContext); + + await createProductPage.setProductStatus(page, true); + + const message = await createProductPage.saveProduct(page); + expect(message).to.eq(createProductPage.successfulUpdateMessage); + }); + + it('should preview product', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'previewProduct3', baseContext); + + // Click on preview button + page = await createProductPage.previewProduct(page); + await foProductPage.changeLanguage(page, 'en'); + + const pageTitle = await foProductPage.getPageTitle(page); + expect(pageTitle).to.contains(Products.demo_1.name); + }); + + it('should search the new tag \'hello\' from the search bar', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'searchTag', baseContext); + + await foProductPage.searchProduct(page, 'hello'); + + const pageTitle = await searchResultsPage.getPageTitle(page); + await expect(pageTitle).to.equal(searchResultsPage.pageTitle); + + const numberOfProducts = await categoryPageFO.getNumberOfProducts(page); + expect(numberOfProducts).to.eql(1); + }); + + it('should go back to BO', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'goBackToBO3', baseContext); + + // Go back to BO + page = await foProductPage.closePage(browserContext, page, 0); + + const pageTitle = await createProductPage.getPageTitle(page); + expect(pageTitle).to.contains(createProductPage.pageTitle); + }); + }); + + // 3 - Delete product + describe('POST-TEST: Delete product', async () => { + it('should delete product', async function () { + await testContext.addContextItem(this, 'testIdentifier', 'deleteProduct', baseContext); + + const createProductMessage = await createProductPage.deleteProduct(page); + expect(createProductMessage).to.equal(productsPage.successfulDeleteMessage); + }); + }); +}); diff --git a/tests/UI/data/faker/product.ts b/tests/UI/data/faker/product.ts index 5dff8eed07cd2..df4d661954c88 100644 --- a/tests/UI/data/faker/product.ts +++ b/tests/UI/data/faker/product.ts @@ -112,6 +112,14 @@ export default class ProductData { public numberOfDays: number | null; + public weight: number; + + public metaTitle: string | null; + + public metaDescription: string | null; + + public friendlyUrl: string | null; + public combinations: ProductCombination[]; public packageDimensionWidth: number; @@ -323,6 +331,15 @@ export default class ProductData { /** @type {number} Number of days limit */ this.numberOfDays = productToCreate.numberOfDays || null; + /** @type {string} Meta title */ + this.metaTitle = productToCreate.metaTitle || null; + + /** @type {string} Meta description */ + this.metaDescription = productToCreate.metaDescription || null; + + /** @type {string} Friendly URL */ + this.friendlyUrl = productToCreate.friendlyUrl || null; + /** @type {number} Weight of the package */ this.packageDimensionWeight = productToCreate.packageDimensionWeight || faker.number.int({min: 1, max: 20}); diff --git a/tests/UI/data/types/product.d.ts b/tests/UI/data/types/product.d.ts index ee89a53043607..3b63e00251f38 100644 --- a/tests/UI/data/types/product.d.ts +++ b/tests/UI/data/types/product.d.ts @@ -62,6 +62,9 @@ type ProductCreator = { packageDimensionWidth?: number deliveryTime?: string combinations?: ProductCombination[] + metaTitle?: string | null + metaDescription?: string | null + friendlyUrl?: string | null }; type ProductCombination = { diff --git a/tests/UI/pages/BO/catalog/productsV2/add/seoTab.ts b/tests/UI/pages/BO/catalog/productsV2/add/seoTab.ts index 29ef7142742cc..e1b097f37ee78 100644 --- a/tests/UI/pages/BO/catalog/productsV2/add/seoTab.ts +++ b/tests/UI/pages/BO/catalog/productsV2/add/seoTab.ts @@ -2,6 +2,8 @@ import BOBasePage from '@pages/BO/BObasePage'; import type {Page} from 'playwright'; +import ProductData from "@data/faker/product"; +import createProductPage from "@pages/BO/catalog/productsV2/add/index"; /** * SEO tab on new product V2 page, contains functions that can be used on the page @@ -19,6 +21,16 @@ class SeoTab extends BOBasePage { private readonly productRedirectProduct: string; + private readonly tagInput: string; + + private readonly alertText: string; + + private readonly generateURLFromNameButton: string; + + private readonly redirectionWhenOfflineSelect: string; + + private readonly searchOptionTargetInput: string; + /** * @constructs * Setting up texts and selectors to use on Shipping tab @@ -26,17 +38,105 @@ class SeoTab extends BOBasePage { constructor() { super(); - // Selectors in stocks tab + // Selectors in seo tab this.productMetaTitleInput = '#product_seo_meta_title'; this.productMetaDescriptionInput = '#product_seo_meta_description'; this.productLinkRewriteInput = '#product_seo_link_rewrite'; this.productRedirectTypeSelect = '#product_seo_redirect_option_type'; this.productRedirectProduct = '#product_seo_redirect_option_target_0_id'; + this.tagInput = '#product_seo_tags_1-tokenfield'; + this.alertText = '#product_seo div.alert-danger div.alert-text'; + this.generateURLFromNameButton = '#product_seo button.reset-link-rewrite'; + this.redirectionWhenOfflineSelect = '#product_seo_redirect_option_type'; + this.searchOptionTargetInput = '#product_seo_redirect_option_target_search_input'; } /* Methods */ + /** + * Set meta title + * @param page {Page} Browser tab + * @param metaTitle {string} Meta title to set in the input + * @returns {Promise} + */ + async setMetaTitle(page: Page, metaTitle: string): Promise { + await this.setValue(page, `${this.productMetaTitleInput}_1`, metaTitle); + } + + /** + * Set meta description + * @param page {Page} Browser tab + * @param metaDescription {string} Meta description to set in the input + * @returns {Promise} + */ + async setMetaDescription(page: Page, metaDescription: string): Promise { + await this.setValue(page, `${this.productMetaDescriptionInput}_1`, metaDescription); + } + + /** + * Set friendly URL + * @param page {Page} Browser tab + * @param friendlyUrl {string} Friendly URL to set in the input + * @returns {Promise} + */ + async setFriendlyUrl(page: Page, friendlyUrl: string): Promise { + await this.setValue(page, `${this.productLinkRewriteInput}_1`, friendlyUrl); + } + + /** + * Get error message of friendly URL + * @param page {Page} Browser tab + * @returns {Promise} + */ + async getErrorMessageOfFriendlyUrl(page: Page): Promise { + await this.clickAndWaitForLoadState(page, createProductPage.saveProductButton); + + return this.getTextContent(page, this.alertText); + } + + /** + * Click on generate URL from name button + * @param page {Page} Browser tab + * @returns {Promise} + */ + async clickOnGenerateUrlFromNameButton(page: Page): Promise { + await page.locator(this.generateURLFromNameButton).click(); + } + + /** + * Select redirect page + * @param page {Page} Browser tab + * @param redirectionPage {string} Redirect page to select + * @returns {Promise} + */ + async selectRedirectionPage(page: Page, redirectionPage: string): Promise { + await this.selectByVisibleText(page, this.redirectionWhenOfflineSelect, redirectionPage); + } + + /** + * Search option target + * @param page {Page} Browser tab + * @param target {string} Target to search + * @returns {Promise} + */ + async searchOptionTarget(page: Page, target: string): Promise { + await page.locator(this.searchOptionTargetInput).fill(target); + await page.waitForTimeout(1000); + await page.keyboard.press('ArrowDown'); + await page.keyboard.press('Enter'); + } + + /** + * Set tag + * @param page {Page} Browser tab + * @param tag {string} tag to set in the input + * @returns {Promise} + */ + async setTag(page: Page, tag: string): Promise { + await page.locator(this.tagInput).fill(tag); + await page.keyboard.press('Enter'); + } /** * Returns the value of a form element From 3524fb04fe77f9544d1cfdc44a37c55613087530 Mon Sep 17 00:00:00 2001 From: nesrineabdmouleh Date: Fri, 29 Sep 2023 10:40:52 +0200 Subject: [PATCH 2/6] Fix review --- tests/UI/campaigns/productV2/functional/18_seoTab.ts | 1 - tests/UI/pages/BO/catalog/productsV2/add/seoTab.ts | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/UI/campaigns/productV2/functional/18_seoTab.ts b/tests/UI/campaigns/productV2/functional/18_seoTab.ts index 6280706f4285b..34ff0cbc80978 100644 --- a/tests/UI/campaigns/productV2/functional/18_seoTab.ts +++ b/tests/UI/campaigns/productV2/functional/18_seoTab.ts @@ -68,7 +68,6 @@ describe('BO - Catalog - Products : Seo tab', async () => { dashboardPage.catalogParentLink, dashboardPage.productsLink, ); - await productsPage.closeSfToolBar(page); const pageTitle = await productsPage.getPageTitle(page); diff --git a/tests/UI/pages/BO/catalog/productsV2/add/seoTab.ts b/tests/UI/pages/BO/catalog/productsV2/add/seoTab.ts index e1b097f37ee78..ea821b03e9b0f 100644 --- a/tests/UI/pages/BO/catalog/productsV2/add/seoTab.ts +++ b/tests/UI/pages/BO/catalog/productsV2/add/seoTab.ts @@ -1,9 +1,8 @@ // Import pages import BOBasePage from '@pages/BO/BObasePage'; +import createProductPage from '@pages/BO/catalog/productsV2/add/index'; import type {Page} from 'playwright'; -import ProductData from "@data/faker/product"; -import createProductPage from "@pages/BO/catalog/productsV2/add/index"; /** * SEO tab on new product V2 page, contains functions that can be used on the page From 7869d53056eb2a2a3c951105eb2c5079042002be Mon Sep 17 00:00:00 2001 From: nesrineabdmouleh Date: Fri, 29 Sep 2023 10:47:21 +0200 Subject: [PATCH 3/6] Fix review --- tests/UI/campaigns/productV2/functional/18_seoTab.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/UI/campaigns/productV2/functional/18_seoTab.ts b/tests/UI/campaigns/productV2/functional/18_seoTab.ts index 34ff0cbc80978..eaa00f4be44bc 100644 --- a/tests/UI/campaigns/productV2/functional/18_seoTab.ts +++ b/tests/UI/campaigns/productV2/functional/18_seoTab.ts @@ -17,8 +17,8 @@ import {searchResultsPage} from '@pages/FO/searchResults'; import categoryPageFO from '@pages/FO/category'; // Import data -import ProductData from '@data/faker/product'; import Products from '@data/demo/products'; +import ProductData from '@data/faker/product'; import type {BrowserContext, Page} from 'playwright'; import {expect} from 'chai'; From 2257e9d3e666ab3dfe23fc96070070222507e622 Mon Sep 17 00:00:00 2001 From: nesrineabdmouleh Date: Fri, 29 Sep 2023 10:52:50 +0200 Subject: [PATCH 4/6] Fix lint error --- tests/UI/data/faker/product.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/UI/data/faker/product.ts b/tests/UI/data/faker/product.ts index df4d661954c88..812e7485cb984 100644 --- a/tests/UI/data/faker/product.ts +++ b/tests/UI/data/faker/product.ts @@ -112,8 +112,6 @@ export default class ProductData { public numberOfDays: number | null; - public weight: number; - public metaTitle: string | null; public metaDescription: string | null; From 8f79478d0be6b94ca035ae5427a82d7dd62ecdcb Mon Sep 17 00:00:00 2001 From: nesrineabdmouleh Date: Tue, 3 Oct 2023 10:19:54 +0200 Subject: [PATCH 5/6] Fix tag name --- tests/UI/campaigns/productV2/functional/18_seoTab.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/UI/campaigns/productV2/functional/18_seoTab.ts b/tests/UI/campaigns/productV2/functional/18_seoTab.ts index eaa00f4be44bc..dc03f4eb766ca 100644 --- a/tests/UI/campaigns/productV2/functional/18_seoTab.ts +++ b/tests/UI/campaigns/productV2/functional/18_seoTab.ts @@ -211,7 +211,7 @@ describe('BO - Catalog - Products : Seo tab', async () => { it('should add tag', async function () { await testContext.addContextItem(this, 'testIdentifier', 'addTag', baseContext); - await seoTab.setTag(page, 'hello'); + await seoTab.setTag(page, 'welcome'); const message = await createProductPage.saveProduct(page); expect(message).to.eq(createProductPage.successfulUpdateMessage); @@ -237,10 +237,10 @@ describe('BO - Catalog - Products : Seo tab', async () => { expect(pageTitle).to.contains(Products.demo_1.name); }); - it('should search the new tag \'hello\' from the search bar', async function () { + it('should search the new tag \'welcome\' from the search bar', async function () { await testContext.addContextItem(this, 'testIdentifier', 'searchTag', baseContext); - await foProductPage.searchProduct(page, 'hello'); + await foProductPage.searchProduct(page, 'welcome'); const pageTitle = await searchResultsPage.getPageTitle(page); await expect(pageTitle).to.equal(searchResultsPage.pageTitle); From 660d1f6b12a03de4418c7a5186b5c16887234e3e Mon Sep 17 00:00:00 2001 From: nesrineabdmouleh Date: Thu, 5 Oct 2023 19:06:25 +0200 Subject: [PATCH 6/6] Fix review --- tests/UI/campaigns/productV2/functional/18_seoTab.ts | 1 + tests/UI/pages/BO/catalog/productsV2/add/index.ts | 11 ++++++++++- tests/UI/pages/BO/catalog/productsV2/add/seoTab.ts | 3 --- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/UI/campaigns/productV2/functional/18_seoTab.ts b/tests/UI/campaigns/productV2/functional/18_seoTab.ts index dc03f4eb766ca..c5cc50be7bda5 100644 --- a/tests/UI/campaigns/productV2/functional/18_seoTab.ts +++ b/tests/UI/campaigns/productV2/functional/18_seoTab.ts @@ -108,6 +108,7 @@ describe('BO - Catalog - Products : Seo tab', async () => { await seoTab.setMetaTitle(page, editProductData.metaTitle!); await seoTab.setMetaDescription(page, editProductData.metaDescription!); await seoTab.setFriendlyUrl(page, editProductData.friendlyUrl!); + await createProductPage.clickOnSaveProductButton(page); const errorMessage = await seoTab.getErrorMessageOfFriendlyUrl(page); expect(errorMessage).to.eq('"lorem ipsum" is invalid - Language: English (English)'); diff --git a/tests/UI/pages/BO/catalog/productsV2/add/index.ts b/tests/UI/pages/BO/catalog/productsV2/add/index.ts index 303a29a5b2f5e..9ea6e161c9e4c 100644 --- a/tests/UI/pages/BO/catalog/productsV2/add/index.ts +++ b/tests/UI/pages/BO/catalog/productsV2/add/index.ts @@ -151,7 +151,7 @@ class CreateProduct extends BOBasePage { // Modal : Switch Product Type this.modalSwitchType = '#switch-product-type-modal'; this.modalSwitchTypeBtnChoice = (productType: string) => `${this.modalSwitchType} button.product-type-choice` - + `[data-value="${productType}"]`; + + `[data-value="${productType}"]`; this.modalSwitchTypeBtnSubmit = `${this.modalSwitchType} .modal-footer button.btn-confirm-submit`; this.modalConfirmType = '#modal-confirm-product-type'; this.modalConfirmTypeBtnSubmit = `${this.modalConfirmType} .modal-footer button.btn-confirm-submit`; @@ -341,6 +341,15 @@ class CreateProduct extends BOBasePage { await this.setValue(page, this.productNameInput(locale), name); } + /** + * Click on save product button + * @param page {Page} Browser tab + * @returns {Promise} + */ + async clickOnSaveProductButton(page: Page): Promise { + await this.clickAndWaitForLoadState(page, this.saveProductButton); + } + /** * Save product * @param page {Page} Browser tab diff --git a/tests/UI/pages/BO/catalog/productsV2/add/seoTab.ts b/tests/UI/pages/BO/catalog/productsV2/add/seoTab.ts index ea821b03e9b0f..286886b18b0c0 100644 --- a/tests/UI/pages/BO/catalog/productsV2/add/seoTab.ts +++ b/tests/UI/pages/BO/catalog/productsV2/add/seoTab.ts @@ -1,6 +1,5 @@ // Import pages import BOBasePage from '@pages/BO/BObasePage'; -import createProductPage from '@pages/BO/catalog/productsV2/add/index'; import type {Page} from 'playwright'; @@ -89,8 +88,6 @@ class SeoTab extends BOBasePage { * @returns {Promise} */ async getErrorMessageOfFriendlyUrl(page: Page): Promise { - await this.clickAndWaitForLoadState(page, createProductPage.saveProductButton); - return this.getTextContent(page, this.alertText); }