-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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 * migrated create basic variant test to playwright * Create full info variant - via edit variant page * Create basic order test * changeset update, removed empty file * playground for grid * Home page critical test migration to playwright
- Loading branch information
1 parent
f39cc69
commit ae0b8da
Showing
3 changed files
with
69 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"saleor-dashboard": minor | ||
--- | ||
|
||
Home page critical test migration to playwright |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,53 @@ | ||
import type { | ||
Locator, | ||
Page, | ||
} from "@playwright/test"; | ||
import { expect, Locator, Page } from "@playwright/test"; | ||
|
||
export class HomePage { | ||
readonly page: Page; | ||
readonly welcomeMessage: Locator; | ||
readonly sales: Locator; | ||
readonly orders: Locator; | ||
readonly activity: Locator; | ||
readonly topProducts: Locator; | ||
readonly ordersReadyToFulfill: Locator; | ||
readonly paymentsWaitingForCapture: Locator; | ||
readonly productsOutOfStock: Locator; | ||
readonly channelSelect: Locator; | ||
readonly channelOptions: Locator; | ||
|
||
constructor(page: Page) { | ||
this.page = page; | ||
this.channelSelect = page.getByTestId("app-channel-select"); | ||
this.channelOptions = page.locator("[data-test-id*='select-field-option']"); | ||
this.welcomeMessage = page.getByTestId("home-header"); | ||
this.sales = page.getByTestId("sales-analytics"); | ||
this.orders = page.getByTestId("orders-analytics"); | ||
this.activity = page.getByTestId("activity-card"); | ||
this.topProducts = page.getByTestId("top-products"); | ||
this.ordersReadyToFulfill = page.getByTestId("orders-to-fulfill"); | ||
this.paymentsWaitingForCapture = page.getByTestId("orders-to-capture"); | ||
this.productsOutOfStock = page.getByTestId("products-out-of-stock"); | ||
} | ||
async goto() { | ||
await this.page.goto("/"); | ||
} | ||
|
||
async clickChannelSelectButton() { | ||
await this.channelSelect.click(); | ||
} | ||
|
||
async selectDifferentChannelThanGiven(defaultChannelName: string) { | ||
await this.channelOptions | ||
.filter({ hasNotText: defaultChannelName }) | ||
.first() | ||
.click(); | ||
} | ||
|
||
async expectHomePageElementsToBeVisible() { | ||
await expect(this.sales).toBeVisible(); | ||
await expect(this.orders).toBeVisible(); | ||
await expect(this.activity).toBeVisible(); | ||
await expect(this.topProducts).toBeVisible(); | ||
await expect(this.ordersReadyToFulfill).toBeVisible(); | ||
await expect(this.paymentsWaitingForCapture).toBeVisible(); | ||
await expect(this.productsOutOfStock).toBeVisible(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { HomePage } from "@pages/homePage"; | ||
import { expect, test } from "@playwright/test"; | ||
|
||
test.use({ storageState: "playwright/.auth/admin.json" }); | ||
|
||
test("TC: SALEOR_29 Correct information on dashboard home page @basic-regression", async ({ | ||
page, | ||
}) => { | ||
const homePage = new HomePage(page); | ||
|
||
await page.goto("/"); | ||
await expect(homePage.channelSelect).toBeVisible({ timeout: 10000 }); | ||
|
||
await homePage.expectHomePageElementsToBeVisible(); | ||
const defaultChannelName = await homePage.channelSelect.innerText(); | ||
|
||
await homePage.clickChannelSelectButton(); | ||
await homePage.selectDifferentChannelThanGiven(defaultChannelName); | ||
const selectedChannelName = await homePage.channelSelect.innerText(); | ||
|
||
await expect(defaultChannelName).not.toEqual(selectedChannelName); | ||
await homePage.expectHomePageElementsToBeVisible(); | ||
}); |