Skip to content

Commit

Permalink
Maintenance e2e tests (#4606)
Browse files Browse the repository at this point in the history
* Migrated warehouses tests: Edit warehouse; Delete warehouse

* Migrated categories tests: Create basic category; Edit category;Bulk delete categories

* Migrated warehouses tests: Edit warehouse; Delete warehouse (#4593)

* Migrated warehouses tests: Edit warehouse; Delete warehouse

* Update nervous-flowers-hear.md

* Update nervous-flowers-hear.md

* Use composites in pr automation workflow (#4597)

* Use composites

* Use composites

* Use composites

* Use composites

* Use composites

* changed shipping metod id in shippings tests

* maintenance

* add console log to goto details page actions

* Trigger Build

* Create ten-feet-roll.md

---------

Co-authored-by: Patryk Andrzejewski <[email protected]>
  • Loading branch information
wojteknowacki and andrzejewsky authored Jan 10, 2024
1 parent a077f1c commit d43a3c9
Show file tree
Hide file tree
Showing 50 changed files with 458 additions and 603 deletions.
8 changes: 8 additions & 0 deletions .changeset/ten-feet-roll.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"saleor-dashboard": minor
---

Maintenance e2e tests:
- Class unification - selector initiation moved to constructors
- Adding navigation logs to specific products, channels, etc
- Improved imports: using aliases in all files
18 changes: 9 additions & 9 deletions playwright/pages/accountSettingsPage.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import type { Locator, Page } from "@playwright/test";

import { BasePage } from "./basePage";
import { ChangePasswordDialog } from "./dialogs/changePasswordDialog";
import { ChangePasswordDialog } from "@dialogs/changePasswordDialog";
import { BasePage } from "@pages/basePage";
import type { Page } from "@playwright/test";

export class AccountSettingsPage {
readonly page: Page;
readonly basePage: BasePage;
readonly changePasswordButton: Locator;
readonly saveButton: Locator;

readonly changePasswordDialog: ChangePasswordDialog;

constructor(page: Page) {
constructor(
page: Page,
readonly changePasswordButton = page.getByTestId("changePasswordBtn"),
readonly saveButton = page.getByTestId("button-bar-confirm"),
) {
this.page = page;
this.basePage = new BasePage(page);
this.changePasswordDialog = new ChangePasswordDialog(page);
this.changePasswordButton = page.getByTestId("changePasswordBtn");
this.saveButton = page.getByTestId("button-bar-confirm");
}

async clickChangePasswordButton() {
Expand Down
14 changes: 8 additions & 6 deletions playwright/pages/appsPage.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import type { Locator, Page } from "@playwright/test";
import type { Page } from "@playwright/test";

export class AppsPage {
readonly page: Page;
readonly installExternalAppButton: Locator;
readonly appsLogosList: Locator;

constructor(page: Page) {
constructor(
page: Page,
readonly installExternalAppButton = page.getByTestId(
"add-app-from-manifest",
),
readonly appsLogosList = page.getByTestId("app-logo"),
) {
this.page = page;
this.installExternalAppButton = page.getByTestId("add-app-from-manifest");
this.appsLogosList = page.getByTestId("app-logo");
}
}
45 changes: 21 additions & 24 deletions playwright/pages/attributesPage.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,34 @@
import { BasePage } from "@pages/basePage";
import { AddValueDialog } from "@pages/dialogs/addValueDialog";
import type { Locator, Page } from "@playwright/test";

import { BasePage } from "./basePage";
import type { Page } from "@playwright/test";

export class AttributesPage {
readonly page: Page;
readonly addValueDialog: AddValueDialog;
readonly basePage: BasePage;
readonly createAttributeButton: Locator;
readonly attributeSelect: Locator;
readonly attributesRows: Locator;
readonly attributeDefaultLabelInput: Locator;
readonly attributeCodeInput: Locator;
readonly assignAttributeValueButton: Locator;
readonly saveButton: Locator;
readonly valueRequiredCheckbox: Locator;

constructor(page: Page) {
constructor(
page: Page,
readonly createAttributeButton = page.getByTestId(
"create-attribute-button",
),
readonly valueRequiredCheckbox = page.getByLabel("Value Required"),
readonly saveButton = page.getByTestId("button-bar-confirm"),
readonly attributesRows = page.getByTestId("attributes-rows"),
readonly assignAttributeValueButton = page.getByTestId(
"assign-value-button",
),
readonly attributeSelect = page.getByTestId("attribute-type-select"),
readonly attributeDefaultLabelInput = page
.getByTestId("attribute-default-label-input")
.locator("input"),
readonly attributeCodeInput = page
.getByTestId("attribute-code-input")
.locator("input"),
) {
this.page = page;
this.addValueDialog = new AddValueDialog(page);
this.basePage = new BasePage(page);
this.createAttributeButton = page.getByTestId("create-attribute-button");
this.valueRequiredCheckbox = page.getByLabel("Value Required");
this.saveButton = page.getByTestId("button-bar-confirm");
this.attributesRows = page.getByTestId("attributes-rows");
this.assignAttributeValueButton = page.getByTestId("assign-value-button");
this.attributeSelect = page.getByTestId("attribute-type-select");
this.attributeDefaultLabelInput = page
.getByTestId("attribute-default-label-input")
.locator("input");
this.attributeCodeInput = page
.getByTestId("attribute-code-input")
.locator("input");
}

async clickCreateAttributeButton() {
Expand Down
6 changes: 3 additions & 3 deletions playwright/pages/categoriesPage.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { URL_LIST } from "@data/url";
import { DeleteCategoriesDialog } from "@dialogs/deleteCategoriesDialog";
import { DeleteDialog } from "@dialogs/deleteDialog";
import { MetadataSeoPage } from "@pageElements/metadataSeoPage";
import { BasePage } from "@pages/basePage";
import type { Page } from "@playwright/test";

export class CategoriesPage extends BasePage {
readonly page: Page;
readonly metadataSeoPage: MetadataSeoPage;
readonly deleteCategoriesDialog: DeleteCategoriesDialog;
readonly deleteCategoriesDialog: DeleteDialog;

constructor(
page: Page,
Expand All @@ -28,7 +28,7 @@ export class CategoriesPage extends BasePage {
super(page);
this.page = page;
this.metadataSeoPage = new MetadataSeoPage(page);
this.deleteCategoriesDialog = new DeleteCategoriesDialog(page);
this.deleteCategoriesDialog = new DeleteDialog(page);
}

async gotoCategoryListView() {
Expand Down
10 changes: 6 additions & 4 deletions playwright/pages/channelsPage.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { URL_LIST } from "@data/url";
import { DeleteChannelDialog } from "@dialogs/deleteChannelDialog";
import { RightSideDetailsPage } from "@pageElements/rightSideDetailsSection";
import { BasePage } from "@pages/basePage";
import { DeleteDialog } from "@pages/dialogs/deleteDialog";
import { Page } from "@playwright/test";

export class ChannelPage extends BasePage {
readonly page: Page;
readonly rightSideDetailsPage: RightSideDetailsPage;
readonly deleteChannelDialog: DeleteChannelDialog;
readonly deleteChannelDialog: DeleteDialog;

constructor(
page: Page,
Expand Down Expand Up @@ -43,7 +43,7 @@ export class ChannelPage extends BasePage {
super(page);
this.page = page;
this.rightSideDetailsPage = new RightSideDetailsPage(page);
this.deleteChannelDialog = new DeleteChannelDialog(page);
this.deleteChannelDialog = new DeleteDialog(page);
}

async clickAuthorizeInsteadOfChargingCheckbox() {
Expand Down Expand Up @@ -86,7 +86,9 @@ export class ChannelPage extends BasePage {
}

async gotoChannelDetails(channelId: string) {
await this.page.goto(URL_LIST.channels + channelId);
const channelDetailsUrl = URL_LIST.channels + channelId;
await console.log("Navigating to channel details: " + channelDetailsUrl);
await this.page.goto(channelDetailsUrl);
}
async gotoChannelList() {
await this.page.goto(URL_LIST.channels);
Expand Down
9 changes: 5 additions & 4 deletions playwright/pages/collectionsPage.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import type { Locator, Page } from "@playwright/test";
import type { Page } from "@playwright/test";

export class CollectionsPage {
readonly page: Page;
readonly createCollectionButton: Locator;

constructor(page: Page) {
constructor(
page: Page,
readonly createCollectionButton = page.getByTestId("create-collection"),
) {
this.page = page;
this.createCollectionButton = page.getByTestId("create-collection");
}
}
57 changes: 28 additions & 29 deletions playwright/pages/configurationPage.ts
Original file line number Diff line number Diff line change
@@ -1,41 +1,40 @@
import { URL_LIST } from "@data/url";
import type { Locator, Page } from "@playwright/test";
import type { Page } from "@playwright/test";

export class ConfigurationPage {
readonly page: Page;
readonly channelsButton: Locator;
readonly productTypesButton: Locator;
readonly webhooksAndEventsButton: Locator;
readonly taxesButton: Locator;
readonly permissionGroupsButton: Locator;
readonly pluginsButton: Locator;
readonly pageTypesButton: Locator;
readonly siteSettingsButton: Locator;
readonly staffMembersButton: Locator;
readonly shippingMethodsButton: Locator;
readonly attributesButton: Locator;

constructor(page: Page) {
this.page = page;
this.pluginsButton = page.locator("[data-test-id*='plugins']");
this.permissionGroupsButton = page.locator(
constructor(
page: Page,
readonly pluginsButton = page.locator("[data-test-id*='plugins']"),
readonly permissionGroupsButton = page.locator(
"[data-test-id*='permission-groups']",
);
this.staffMembersButton = page.locator("[data-test-id*='staff members']");
this.siteSettingsButton = page.locator("[data-test-id*='site-settings']");
this.channelsButton = page.locator("[data-test-id*='channels']");
this.shippingMethodsButton = page.locator(
),
readonly staffMembersButton = page.locator(
"[data-test-id*='staff members']",
),
readonly siteSettingsButton = page.locator(
"[data-test-id*='site-settings']",
),
readonly channelsButton = page.locator("[data-test-id*='channels']"),
readonly shippingMethodsButton = page.locator(
"[data-test-id*='shipping methods']",
);
this.productTypesButton = page.locator("[data-test-id*='product-types']");
this.webhooksAndEventsButton = page.locator("[data-test-id*='webhooks']");
this.attributesButton = page.locator("[data-test-id*='attributes']");
this.pageTypesButton = page.locator(
),
readonly productTypesButton = page.locator(
"[data-test-id*='product-types']",
),
readonly webhooksAndEventsButton = page.locator(
"[data-test-id*='webhooks']",
),
readonly attributesButton = page.locator("[data-test-id*='attributes']"),
readonly pageTypesButton = page.locator(
"[data-test-id*='configuration-menu-page-type']",
);
this.taxesButton = page.locator(
),
readonly taxesButton = page.locator(
"[data-test-id*='configuration-menu-taxes']",
);
),
) {
this.page = page;
}

async openShippingMethods() {
Expand Down
9 changes: 5 additions & 4 deletions playwright/pages/contentPage.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import type { Locator, Page } from "@playwright/test";
import type { Page } from "@playwright/test";

export class ContentPage {
readonly page: Page;
readonly createContentButton: Locator;

constructor(page: Page) {
constructor(
page: Page,
readonly createContentButton = page.getByTestId("create-page"),
) {
this.page = page;
this.createContentButton = page.getByTestId("create-page");
}
}
9 changes: 5 additions & 4 deletions playwright/pages/customersPage.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import type { Locator, Page } from "@playwright/test";
import type { Page } from "@playwright/test";

export class CustomersPage {
readonly page: Page;
readonly createCustomerButton: Locator;

constructor(page: Page) {
constructor(
page: Page,
readonly createCustomerButton = page.getByTestId("create-customer"),
) {
this.page = page;
this.createCustomerButton = page.getByTestId("create-customer");
}
}
25 changes: 11 additions & 14 deletions playwright/pages/dialogs/addPostalCodeDialog.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
import { Locator, Page } from "@playwright/test";
import { Page } from "@playwright/test";

export class AddPostalCodeDialog {
readonly page: Page;

readonly zipCodeStartsWithInput: Locator;
readonly zipCodeEndsWithInput: Locator;
readonly backButton: Locator;
readonly addButton: Locator;
constructor(
page: Page,

constructor(page: Page) {
this.page = page;

this.zipCodeStartsWithInput = page
readonly zipCodeStartsWithInput = page
.getByTestId("zip-code-starts-with-input")
.locator("input");
this.zipCodeEndsWithInput = page
.locator("input"),
readonly zipCodeEndsWithInput = page
.getByTestId("zip-code-ends-with-input")
.locator("input");
this.backButton = page.getByTestId("back");
this.addButton = page.getByTestId("submit");
.locator("input"),
readonly backButton = page.getByTestId("back"),
readonly addButton = page.getByTestId("submit"),
) {
this.page = page;
}

async addStartAndEndZipCodesRange(startsWith = "10", endsWith = "09") {
Expand Down
24 changes: 10 additions & 14 deletions playwright/pages/dialogs/addProductsDialog.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
import { expect, Locator, Page } from "@playwright/test";
import { expect, Page } from "@playwright/test";

export class AddProductsDialog {
readonly page: Page;
readonly productRow: Locator;
readonly variantRow: Locator;
readonly productRowCheckbox: Locator;
readonly backButton: Locator;
readonly confirmButton: Locator;
readonly assignAndSaveButton: Locator;

constructor(page: Page) {
constructor(
page: Page,
readonly productRow = page.getByTestId("product"),
readonly variantRow = page.getByTestId("variant"),
readonly backButton = page.getByTestId("back-button"),
readonly confirmButton = page.getByTestId("confirm-button"),
readonly productRowCheckbox = page.getByTestId("checkbox"),
readonly assignAndSaveButton = page.getByTestId("assign-and-save-button"),
) {
this.page = page;
this.productRow = page.getByTestId("product");
this.variantRow = page.getByTestId("variant");
this.backButton = page.getByTestId("back-button");
this.confirmButton = page.getByTestId("confirm-button");
this.productRowCheckbox = page.getByTestId("checkbox");
this.assignAndSaveButton = page.getByTestId("assign-and-save-button");
}

async clickConfirmButton() {
Expand Down
12 changes: 6 additions & 6 deletions playwright/pages/dialogs/addValueDialog.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import type { Locator, Page } from "@playwright/test";
import type { Page } from "@playwright/test";

export class AddValueDialog {
readonly page: Page;
readonly nameInput: Locator;
readonly saveButton: Locator;

constructor(page: Page) {
constructor(
page: Page,
readonly nameInput = page.getByTestId("value-name").locator("input"),
readonly saveButton = page.getByTestId("submit"),
) {
this.page = page;
this.nameInput = page.getByTestId("value-name").locator("input");
this.saveButton = page.getByTestId("submit");
}

async typeAndSaveAttributeValue(value = "XXL") {
Expand Down
Loading

0 comments on commit d43a3c9

Please sign in to comment.