-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
106 additions
and
0 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,32 @@ | ||
import { Locator, Page } from '@playwright/test'; | ||
import PlaywrightConfig from '../../../playwright.config'; | ||
|
||
export class ShoppingDelivPage { | ||
readonly page: Page; | ||
readonly nextButton: Locator; | ||
readonly addNewDeliveryAddressButton: Locator; | ||
readonly sendToMultipleButton: Locator; | ||
|
||
constructor(page: Page) { | ||
this.page = page; | ||
this.nextButton = page.locator('input[alt=選択したお届け先に送る]'); | ||
this.addNewDeliveryAddressButton = page.locator('[alt=新しいお届け先を追加する]'); | ||
this.sendToMultipleButton = page.locator('[alt=お届け先を複数指定する]'); | ||
} | ||
|
||
async goto() { | ||
await this.page.goto(`${PlaywrightConfig.use.baseURL}/shopping/deliv.php`); | ||
} | ||
|
||
async gotoNext() { | ||
await this.nextButton.click(); | ||
} | ||
|
||
async gotoAddNewDeliveryAddress() { | ||
await this.addNewDeliveryAddressButton.click(); | ||
} | ||
|
||
async gotoSendToMultiple() { | ||
await this.sendToMultipleButton.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,74 @@ | ||
import { Locator, Page } from '@playwright/test'; | ||
import PlaywrightConfig from '../../../playwright.config'; | ||
|
||
export class ShoppingPaymentPage { | ||
readonly page: Page; | ||
readonly nextButton: Locator; | ||
readonly paymentMethod: Locator; | ||
readonly deliveryDate: Locator; | ||
readonly deliveryTime: Locator; | ||
readonly enablePoint: Locator; | ||
readonly disablePoint: Locator; | ||
readonly usePoint: Locator; | ||
readonly message: Locator; | ||
|
||
constructor(page: Page) { | ||
this.page = page; | ||
this.nextButton = page.locator('[alt=次へ]'); | ||
this.paymentMethod = page.locator('#payment'); | ||
this.deliveryDate = page.locator('#deliv_date0'); | ||
this.deliveryTime = page.locator('#deliv_time_id0'); | ||
this.enablePoint = page.locator('#point_on'); | ||
this.disablePoint = page.locator('#point_off'); | ||
this.usePoint = page.locator('input[name=use_point]'); | ||
this.message = page.locator('textarea[name=message]'); | ||
} | ||
|
||
async goto() { | ||
await this.page.goto(`${PlaywrightConfig.use.baseURL}/shopping/payment.php`); | ||
} | ||
|
||
async gotoNext() { | ||
await this.nextButton.click(); | ||
} | ||
|
||
async selectPaymentMethod(label: string) { | ||
await this.paymentMethod.locator(`text=${label}`).click(); | ||
} | ||
|
||
async selectDeliveryDate(index: number) { | ||
await this.deliveryDate.selectOption({ index: index }); | ||
} | ||
|
||
async selectDeliveryTime(index: number) { | ||
await this.deliveryTime.selectOption({ index: index }); | ||
} | ||
|
||
async chooseToUsePoint() { | ||
await this.enablePoint.check(); | ||
} | ||
|
||
async doNotChooseToUsePoint() { | ||
await this.disablePoint.check(); | ||
} | ||
|
||
async fillUsePoint(point: number) { | ||
await this.usePoint.fill(String(point)); | ||
} | ||
|
||
async fillMessage(message: string) { | ||
await this.message.fill(message); | ||
} | ||
|
||
async fillOut(paymentMethod?: string, deliveryDateIndex?: number, deliveryTimeIndex?:number, message?: string, usePoint?: number) { | ||
await this.selectPaymentMethod(paymentMethod ?? '銀行振込'); | ||
await this.selectDeliveryDate(deliveryDateIndex ?? 1); | ||
await this.selectDeliveryTime(deliveryTimeIndex ?? 1); | ||
await this.fillMessage(message ?? 'お問い合わせ'); | ||
|
||
if (await this.enablePoint.isVisible()) { | ||
await this.chooseToUsePoint(); | ||
await this.fillUsePoint(usePoint ?? 1); | ||
} | ||
} | ||
} |