Skip to content

Commit

Permalink
Migrate navigation tests to playwright (#4294)
Browse files Browse the repository at this point in the history
* migrated create products tests to Playwright

* permission tests with playwright wip

* migrated navigation tests to playwright

* switch to camel case in pw project - remove faker random number generator

* login function in setup unification, wait for success banner extended to 15s
  • Loading branch information
wojteknowacki authored Oct 12, 2023
1 parent 1db8fff commit 7329f2c
Show file tree
Hide file tree
Showing 56 changed files with 1,147 additions and 183 deletions.
5 changes: 5 additions & 0 deletions .changeset/perfect-ligers-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": minor
---

migrated navigation tests to playwright
168 changes: 121 additions & 47 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
"@graphql-codegen/typescript-apollo-client-helpers": "^2.1.10",
"@graphql-codegen/typescript-operations": "^2.2.4",
"@graphql-codegen/typescript-react-apollo": "^3.2.5",
"@playwright/test": "^1.37.1",
"@playwright/test": "^1.38.1",
"@saleor/app-sdk": "0.43.0",
"@sentry/cli": "^2.20.6",
"@swc/jest": "^0.2.26",
Expand All @@ -136,6 +136,7 @@
"@types/is-ci": "^3.0.0",
"@types/jscodeshift": "^0.11.3",
"@types/lodash-es": "^4.17.3",
"@types/node": "^20.8.0",
"@types/react": "^17.0.50",
"@types/react-dom": "^17.0.17",
"@types/react-dropzone": "^4.2.2",
Expand Down
File renamed without changes.
File renamed without changes.
16 changes: 16 additions & 0 deletions playwright/data/userPermissions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export const USER_PERMISSION = {
channel: "channel.manager@example.com",
shipping: "shipping.manager@example.com",
giftCard: "gift.card.manager@example.com",
app: "app.manager@example.com",
settings: "setting.manager@example.com",
page: "page.manager@example.com",
order: "order.manager@example.com",
translations: "translation.manager@example.com",
staff: "staff.manager@example.com",
customer: "user.manager@example.com",
productTypeAndAttribute: "product.type.and.attribute.manager@example.com",
discount: "discount.manager@example.com",
plugin: "plugin.manager@example.com",
product: "product.manager@example.com",
};
13 changes: 13 additions & 0 deletions playwright/pages/appsPage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { Locator, Page } from "@playwright/test";

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

constructor(page: Page) {
this.page = page;
this.installExternalAppButton = page.getByTestId("add-app-from-manifest");
this.appsLogosList = page.getByTestId("app-logo");
}
}
11 changes: 9 additions & 2 deletions playwright/pages/base-page.ts → playwright/pages/basePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,24 @@ import type { Locator, Page } from "@playwright/test";
import { expect } from "@playwright/test";

export class BasePage {
public page: Page;
public pageHeader: Locator;
readonly page: Page;
readonly pageHeader: Locator;
readonly gridCanvas: Locator;

constructor(page: Page) {
this.page = page;
this.pageHeader = page.getByTestId("page-header");
this.gridCanvas = page.locator('[data-testid="data-grid-canvas"]');
}
async gotoCreateProductPage(productTypeId: string) {
await this.page.goto(
`${URL_LIST.products}${URL_LIST.productsAdd}${productTypeId}`,
);
await expect(this.pageHeader).toBeVisible({ timeout: 10000 });
}
async expectGridToBeAttached() {
await expect(this.gridCanvas).toBeAttached({
timeout: 10000,
});
}
}
11 changes: 11 additions & 0 deletions playwright/pages/categoriesPage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { Locator, Page } from "@playwright/test";

export class CategoriesPage {
readonly page: Page;
readonly createCategoryButton: Locator;

constructor(page: Page) {
this.page = page;
this.createCategoryButton = page.getByTestId("create-category");
}
}
Loading

0 comments on commit 7329f2c

Please sign in to comment.