Skip to content

Commit

Permalink
fix: add new selectors for mt-text-editor
Browse files Browse the repository at this point in the history
  • Loading branch information
jleifeld committed Jan 16, 2025
1 parent 03d2dc4 commit a531b12
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 16 deletions.
16 changes: 8 additions & 8 deletions src/page-objects/AdministrationPages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@ export const test = base.extend<FixtureTypes>({
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) => {
Expand Down Expand Up @@ -214,12 +214,12 @@ export const test = base.extend<FixtureTypes>({
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) => {
Expand Down
10 changes: 8 additions & 2 deletions src/page-objects/administration/CustomerGroupCreate.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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' });
Expand All @@ -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]');
Expand Down
5 changes: 3 additions & 2 deletions src/page-objects/administration/CustomerGroupDetail.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
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;
public readonly selectedSalesChannel: Locator;
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');
Expand Down
10 changes: 8 additions & 2 deletions src/page-objects/administration/ManufacturerCreate.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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() {
Expand Down
5 changes: 3 additions & 2 deletions src/page-objects/administration/ManufacturerDetail.ts
Original file line number Diff line number Diff line change
@@ -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');
Expand Down

0 comments on commit a531b12

Please sign in to comment.