Skip to content

Commit

Permalink
Merge pull request #28 from shopware/feat-add-data-sharing-fixture
Browse files Browse the repository at this point in the history
feat: add dashboard and data sharing fixture
  • Loading branch information
Phil23 authored Jun 7, 2024
2 parents db82947 + 6391ce4 commit 16f2a21
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/page-objects/AdministrationPages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { CustomerDetail } from './administration/CustomerDetail';
import { FirstRunWizard } from './administration/FirstRunWizard';
import { FlowBuilderCreate } from './administration/FlowBuilderCreate';
import { FlowBuilderListing } from './administration/FlowBuilderListing';
import { DataSharing } from './administration/DataSharing';
import { Dashboard } from './administration/Dashboard';

export interface AdministrationPageTypes {
AdminProductDetail: ProductDetail;
Expand All @@ -15,6 +17,8 @@ export interface AdministrationPageTypes {
AdminFirstRunWizard: FirstRunWizard;
AdminFlowBuilderCreate: FlowBuilderCreate;
AdminFlowBuilderListing: FlowBuilderListing;
AdminDataSharing: DataSharing;
AdminDashboard: Dashboard;
}

export const AdminPageObjects = {
Expand All @@ -24,6 +28,8 @@ export const AdminPageObjects = {
FirstRunWizard,
FlowBuilderCreate,
FlowBuilderListing,
Dashboard,
DataSharing,
}

export const test = base.extend<FixtureTypes>({
Expand Down Expand Up @@ -51,4 +57,12 @@ export const test = base.extend<FixtureTypes>({
AdminFlowBuilderListing: async ({ AdminPage }, use) => {
await use(new FlowBuilderListing(AdminPage));
},

AdminDataSharing: async ({ AdminPage }, use) => {
await use(new DataSharing(AdminPage));
},

AdminDashboard: async ({ AdminPage }, use) => {
await use(new Dashboard(AdminPage));
},
});
27 changes: 27 additions & 0 deletions src/page-objects/administration/Dashboard.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import type { Page, Locator } from '@playwright/test';
import type { PageObject } from '../../types/PageObject';

export class Dashboard implements PageObject {

public readonly dataSharingConsentBanner: Locator;
public readonly dataSharingAgreeButton: Locator;
public readonly dataSharingNotAtTheMomentButton: Locator;
public readonly dataSharingTermsAgreementLabel: Locator;
public readonly dataSharingSettingsLink: Locator;
public readonly dataSharingAcceptMessageText: Locator;
public readonly dataSharingNotAtTheMomentMessageText: Locator;

constructor(public readonly page: Page) {
this.dataSharingConsentBanner = page.locator('.sw-usage-data-consent-banner');
this.dataSharingAgreeButton = page.getByRole('button', { name: 'Agree' });
this.dataSharingNotAtTheMomentButton = page.getByRole('button', { name: 'Not at the moment' });
this.dataSharingSettingsLink = page.locator('.sw-usage-data-consent-banner-reject-accept-message').getByRole('link');
this.dataSharingAcceptMessageText = page.getByText('Thank you for your participation!');
this.dataSharingNotAtTheMomentMessageText = page.getByText('You can at any time enter into the agreement and thus contribute to and profit from the constant evolution of our services');
this.dataSharingTermsAgreementLabel = page.getByText('By clicking "Agree", you confirm that you are authorized to enter into this agreement on behalf of your company.');
}

async goTo() {
await this.page.goto('#/sw/dashboard/index');
}
}
21 changes: 21 additions & 0 deletions src/page-objects/administration/DataSharing.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { Page, Locator } from '@playwright/test';
import type { PageObject } from '../../types/PageObject';

export class DataSharing implements PageObject {

public readonly dataSharingSuccessMessageLabel: Locator;
public readonly dataSharingAgreeButton: Locator;
public readonly dataSharingDisableButton: Locator;
public readonly dataSharingTermsAgreementLabel: Locator;

constructor(public readonly page: Page) {
this.dataSharingAgreeButton = page.getByRole('button', { name: 'Agree' });
this.dataSharingDisableButton = page.getByRole('button', { name: 'Disable data sharing' });
this.dataSharingSuccessMessageLabel = page.getByText('You are sharing data with us', { exact: true });
this.dataSharingTermsAgreementLabel = page.getByText('By clicking "Agree", you confirm that you are authorized to enter into this agreement on behalf of your company.');
}

async goTo() {
await this.page.goto('#/sw/settings/usage/data/index/general');
}
}

0 comments on commit 16f2a21

Please sign in to comment.