diff --git a/src/page-objects/AdministrationPages.ts b/src/page-objects/AdministrationPages.ts index dffbb38..5c60096 100644 --- a/src/page-objects/AdministrationPages.ts +++ b/src/page-objects/AdministrationPages.ts @@ -126,12 +126,12 @@ export const test = base.extend({ await use(new CustomerGroupListing(AdminPage)); }, - AdminCustomerGroupCreate: async ({ AdminPage }, use) => { - await use(new CustomerGroupCreate(AdminPage)); + AdminCustomerGroupCreate: async ({ AdminPage, InstanceMeta }, use) => { + await use(new CustomerGroupCreate(AdminPage, InstanceMeta)); }, - AdminCustomerGroupDetail: async ({ AdminPage }, use) => { - await use(new CustomerGroupDetail(AdminPage)); + AdminCustomerGroupDetail: async ({ AdminPage, InstanceMeta }, use) => { + await use(new CustomerGroupDetail(AdminPage, InstanceMeta)); }, AdminFirstRunWizard: async ({ AdminPage, InstanceMeta }, use) => { @@ -214,12 +214,12 @@ export const test = base.extend({ await use(new ManufacturerListing(AdminPage)); }, - AdminManufacturerCreate: async ({ AdminPage }, use) => { - await use(new ManufacturerCreate(AdminPage)); + AdminManufacturerCreate: async ({ AdminPage, InstanceMeta }, use) => { + await use(new ManufacturerCreate(AdminPage, InstanceMeta)); }, - AdminManufacturerDetail: async ({ AdminPage }, use) => { - await use(new ManufacturerDetail(AdminPage)); + AdminManufacturerDetail: async ({ AdminPage, InstanceMeta }, use) => { + await use(new ManufacturerDetail(AdminPage, InstanceMeta)); }, AdminProductListing: async ({ AdminPage }, use) => { diff --git a/src/page-objects/administration/CustomerGroupCreate.ts b/src/page-objects/administration/CustomerGroupCreate.ts index acd350f..67dc25d 100644 --- a/src/page-objects/administration/CustomerGroupCreate.ts +++ b/src/page-objects/administration/CustomerGroupCreate.ts @@ -1,5 +1,7 @@ import type { Page, Locator } from '@playwright/test'; import type { PageObject } from '../../types/PageObject'; +import { satisfies } from 'compare-versions'; +import { HelperFixtureTypes } from 'src/fixtures/HelperFixtures'; export class CustomerGroupCreate implements PageObject { public readonly headline: Locator; @@ -17,7 +19,7 @@ export class CustomerGroupCreate implements PageObject { public readonly customerGroupSaleschannelSelection: Locator; public readonly customerGroupSaleschannelResultList: Locator; - constructor(public readonly page: Page) { + constructor(public readonly page: Page, public readonly instanceMeta: HelperFixtureTypes['InstanceMeta']) { this.headline = page.getByRole('heading', { name: 'New customer group' }); this.saveButton = page.getByRole('button', { name: 'Save' }); this.cancelButton = page.getByRole('button', { name: 'Cancel' }); @@ -27,7 +29,11 @@ export class CustomerGroupCreate implements PageObject { this.customerGroupNetTaxDisplay = page.locator('#sw-field--castedValue-1'); this.customSignupFormToggle = page.getByLabel('Custom signup form'); this.signupFormTitle = page.locator('#sw-field--customerGroup-registrationTitle'); - this.signupFormIntroduction = page.locator('.sw-text-editor__content-editor'); + if (satisfies(instanceMeta.version, '<6.7')) { + this.signupFormIntroduction = page.locator('.sw-text-editor__content-editor'); + } else { + this.signupFormIntroduction = page.locator('.mt-text-editor__content-editor'); + } this.signupFormSeoDescription = page.locator('#sw-field--customerGroup-registrationSeoMetaDescription'); this.signupFormCompanySignupToggle = page.getByLabel('Company signup form'); this.customerGroupSaleschannelSelection = page.locator('input[class=sw-select-selection-list__input]'); diff --git a/src/page-objects/administration/CustomerGroupDetail.ts b/src/page-objects/administration/CustomerGroupDetail.ts index 77c6dde..145f3f6 100644 --- a/src/page-objects/administration/CustomerGroupDetail.ts +++ b/src/page-objects/administration/CustomerGroupDetail.ts @@ -1,6 +1,7 @@ import type { Page, Locator } from '@playwright/test'; import type { PageObject } from '../../types/PageObject'; import { CustomerGroupCreate } from './CustomerGroupCreate'; +import { HelperFixtureTypes } from 'src/fixtures/HelperFixtures'; export class CustomerGroupDetail extends CustomerGroupCreate implements PageObject { public readonly headline: Locator; @@ -8,8 +9,8 @@ export class CustomerGroupDetail extends CustomerGroupCreate implements PageObje public readonly technicalUrl: Locator; public readonly saleschannelUrl: Locator; - constructor(public readonly page: Page) { - super(page); + constructor(public readonly page: Page, public readonly instanceMeta: HelperFixtureTypes['InstanceMeta']) { + super(page, instanceMeta); this.headline = page.locator('.smart-bar__header'); this.selectedSalesChannel = page.locator('.sw-select-selection-list'); this.technicalUrl = page.getByLabel('Technical URL'); diff --git a/src/page-objects/administration/ManufacturerCreate.ts b/src/page-objects/administration/ManufacturerCreate.ts index d5f48d6..dfdd3b1 100644 --- a/src/page-objects/administration/ManufacturerCreate.ts +++ b/src/page-objects/administration/ManufacturerCreate.ts @@ -1,5 +1,7 @@ import type { Page, Locator } from '@playwright/test'; import type { PageObject } from '../../types/PageObject'; +import { satisfies } from 'compare-versions'; +import { HelperFixtureTypes } from 'src/fixtures/HelperFixtures'; export class ManufacturerCreate implements PageObject { public readonly saveButton: Locator; @@ -8,12 +10,16 @@ export class ManufacturerCreate implements PageObject { public readonly websiteInput: Locator; public readonly descriptionInput: Locator; - constructor(public readonly page: Page) { + constructor(public readonly page: Page, public readonly instanceMeta: HelperFixtureTypes['InstanceMeta']) { this.saveButton = page.getByRole('button', { name: 'Save' }); this.cancelButton = page.getByRole('button', { name: 'Cancel' }); this.nameInput = page.getByLabel('Name'); this.websiteInput = page.getByLabel('Website'); - this.descriptionInput = page.locator('.sw-text-editor__content-editor'); + if (satisfies(instanceMeta.version, '<6.7')) { + this.descriptionInput = page.locator('.sw-text-editor__content-editor'); + } else { + this.descriptionInput = page.locator('.mt-text-editor__content-editor'); + } } url() { diff --git a/src/page-objects/administration/ManufacturerDetail.ts b/src/page-objects/administration/ManufacturerDetail.ts index 7c90c87..d092df0 100644 --- a/src/page-objects/administration/ManufacturerDetail.ts +++ b/src/page-objects/administration/ManufacturerDetail.ts @@ -1,13 +1,14 @@ import type { Page, Locator } from '@playwright/test'; import { ManufacturerCreate } from './ManufacturerCreate'; +import { HelperFixtureTypes } from 'src/fixtures/HelperFixtures'; export class ManufacturerDetail extends ManufacturerCreate { public readonly customFieldCard: Locator; public readonly customFieldSetTabs: Locator; public readonly customFieldSetTabCustomContent: Locator; - constructor(public readonly page: Page) { - super(page); + constructor(public readonly page: Page, public readonly instanceMeta: HelperFixtureTypes['InstanceMeta']) { + super(page, instanceMeta); this.customFieldCard = page.locator('.sw-card').getByText('Custom fields'); this.customFieldSetTabs = this.customFieldCard.locator('.sw-tabs-item');