Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate navigation tests to playwright #4294

Merged
merged 6 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
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
Loading