-
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.
Migrate draft order tests to playwright (#4575)
* change billing and shipping address in orders * Create twenty-games-complain.md * test rename * Draft orders bulk delete & Create draft order tests
- Loading branch information
1 parent
ca73a90
commit bcbed0d
Showing
8 changed files
with
185 additions
and
20 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 | ||
--- | ||
|
||
Draft orders bulk delete & Create draft order tests |
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
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,17 @@ | ||
import type { Locator, Page } from "@playwright/test"; | ||
|
||
export class DeleteDraftOrdersDialog { | ||
readonly page: Page; | ||
|
||
readonly deleteButton: Locator; | ||
|
||
constructor(page: Page) { | ||
this.page = page; | ||
|
||
this.deleteButton = page.getByTestId("submit"); | ||
} | ||
|
||
async clickDeleteButton() { | ||
await this.deleteButton.first().click(); | ||
} | ||
} |
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,28 @@ | ||
import type { Locator, Page } from "@playwright/test"; | ||
|
||
export class DraftOrderCreateDialog { | ||
readonly page: Page; | ||
readonly channelNameInput: Locator; | ||
readonly channelOption: Locator; | ||
readonly confirmButton: Locator; | ||
|
||
constructor(page: Page) { | ||
this.page = page; | ||
this.channelNameInput = page.getByTestId("channel-autocomplete"); | ||
this.confirmButton = page.getByTestId("submit"); | ||
this.channelOption = page.locator("[data-test-id*='select-field-option']"); | ||
} | ||
|
||
async expandChannelsSearchList() { | ||
await this.channelNameInput.click(); | ||
} | ||
async clickConfirmButton() { | ||
await this.confirmButton.click(); | ||
} | ||
|
||
async completeDraftOrderCreateDialogWithFirstChannel() { | ||
await this.expandChannelsSearchList(); | ||
await this.channelOption.first().click(); | ||
await this.clickConfirmButton(); | ||
} | ||
} |
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,61 @@ | ||
import { URL_LIST } from "@data/url"; | ||
import { AddProductsDialog } from "@dialogs/addProductsDialog"; | ||
import { AddressDialog } from "@dialogs/addressDialog"; | ||
import { DeleteDraftOrdersDialog } from "@dialogs/deleteDraftOrdersDialog"; | ||
import { DraftOrderCreateDialog } from "@dialogs/draftOrderCreateDialog"; | ||
import { ShippingAddressDialog } from "@dialogs/shippingMethodDialog"; | ||
import { RightSideDetailsPage } from "@pageElements/rightSideDetailsSection"; | ||
import { BasePage } from "@pages/basePage"; | ||
import type { Page } from "@playwright/test"; | ||
|
||
export class DraftOrdersPage extends BasePage { | ||
readonly page: Page; | ||
readonly deleteDraftOrdersDialog: DeleteDraftOrdersDialog; | ||
readonly draftOrderCreateDialog: DraftOrderCreateDialog; | ||
readonly addProductsDialog: AddProductsDialog; | ||
readonly rightSideDetailsPage: RightSideDetailsPage; | ||
readonly addressDialog: AddressDialog; | ||
readonly shippingAddressDialog: ShippingAddressDialog; | ||
constructor( | ||
page: Page, | ||
readonly createDraftOrderButton = page.getByTestId( | ||
"create-draft-order-button", | ||
), | ||
readonly bulkDeleteButton = page.getByTestId("bulk-delete-button"), | ||
readonly addProducts = page.getByTestId("add-products-button"), | ||
readonly finalizeButton = page.getByTestId("button-bar-confirm"), | ||
readonly addShippingCarrierLink = page.getByTestId("add-shipping-carrier"), | ||
) { | ||
super(page); | ||
this.page = page; | ||
this.deleteDraftOrdersDialog = new DeleteDraftOrdersDialog(page); | ||
this.draftOrderCreateDialog = new DraftOrderCreateDialog(page); | ||
this.addProductsDialog = new AddProductsDialog(page); | ||
this.rightSideDetailsPage = new RightSideDetailsPage(page); | ||
this.addressDialog = new AddressDialog(page); | ||
this.shippingAddressDialog = new ShippingAddressDialog(page); | ||
} | ||
|
||
async clickCreateDraftOrderButton() { | ||
await this.createDraftOrderButton.click(); | ||
} | ||
async goToDraftOrdersListView() { | ||
await this.page.goto(URL_LIST.draftOrders); | ||
} | ||
|
||
async clickBulkDeleteButton() { | ||
await this.bulkDeleteButton.click(); | ||
} | ||
|
||
async clickAddProductsButton() { | ||
await this.addProducts.click(); | ||
} | ||
|
||
async clickAddShippingCarrierButton() { | ||
await this.addShippingCarrierLink.click(); | ||
} | ||
|
||
async clickFinalizeButton() { | ||
await this.finalizeButton.click(); | ||
} | ||
} |
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
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
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