mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Extract pw common functions
This commit is contained in:
parent
9b15b70e63
commit
87ac3f1650
6 changed files with 137 additions and 155 deletions
26
tests/playwright/utils/user.js
Normal file
26
tests/playwright/utils/user.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
const {
|
||||
WP_MERCHANT_USER,
|
||||
WP_MERCHANT_PASSWORD,
|
||||
WP_CUSTOMER_USER,
|
||||
WP_CUSTOMER_PASSWORD,
|
||||
} = process.env;
|
||||
|
||||
export const loginAsAdmin = async (page) => {
|
||||
await page.goto('/wp-admin');
|
||||
await page.locator('input[name="log"]').fill(WP_MERCHANT_USER);
|
||||
await page.locator('input[name="pwd"]').fill(WP_MERCHANT_PASSWORD);
|
||||
await Promise.all([
|
||||
page.waitForNavigation(),
|
||||
page.locator('text=Log In').click()
|
||||
]);
|
||||
}
|
||||
|
||||
export const loginAsCustomer = async (page) => {
|
||||
await page.goto('/wp-admin');
|
||||
await page.locator('input[name="log"]').fill(WP_CUSTOMER_USER);
|
||||
await page.locator('input[name="pwd"]').fill(WP_CUSTOMER_PASSWORD);
|
||||
await Promise.all([
|
||||
page.waitForNavigation(),
|
||||
page.locator('text=Log In').click()
|
||||
]);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue