Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Use the existing "customer" test data
Browse files Browse the repository at this point in the history
  • Loading branch information
tarhi-saad committed Aug 15, 2023
1 parent 4653f9a commit b057fa7
Showing 1 changed file with 6 additions and 41 deletions.
47 changes: 6 additions & 41 deletions tests/e2e/utils/frontend/frontend-utils.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,50 +5,15 @@ import { Page } from '@playwright/test';
import { RequestUtils } from '@wordpress/e2e-test-utils-playwright';
import { expect } from '@woocommerce/e2e-playwright-utils';

const {
CUSTOMER_USER,
CUSTOMER_PASSWORD,
CUSTOMER_USER_EMAIL,
CUSTOMER_FIRST_NAME,
CUSTOMER_LAST_NAME,
} = process.env;
/**
* Internal dependencies
*/
import { customer } from '../../test-data/data/data';

export class FrontendUtils {
page: Page;
requestUtils: RequestUtils;

private customer = {
username: CUSTOMER_USER ?? 'customer',
password: CUSTOMER_PASSWORD ?? 'password',
email:
CUSTOMER_USER_EMAIL ?? 'customer@woocommercecoree2etestsuite.com',
first_name: CUSTOMER_FIRST_NAME ?? 'Jane',
last_name: CUSTOMER_LAST_NAME ?? 'Smith',
billing: {
us: {
first_name: 'Maggie',
last_name: 'Simpson',
address: '123 Evergreen Terrace',
city: 'Springfield',
country: 'US',
state: 'OR',
zip: '97403',
phone: '555 555-5555',
email: 'customer@example.com',
},
malta: {
first_name: 'Maggie',
last_name: 'Simpson',
address: '123 Evergreen Terrace',
city: 'Valletta',
country: 'MT',
zip: 'VT 1011',
phone: '555 555-5555',
email: 'vt-customer@example.com',
},
},
};

constructor( page: Page, requestUtils: RequestUtils ) {
this.page = page;
this.requestUtils = requestUtils;
Expand Down Expand Up @@ -172,10 +137,10 @@ export class FrontendUtils {
await expect( this.page ).toHaveTitle( /My account/ );
await this.page
.locator( 'input[name="username"]' )
.fill( this.customer.username );
.fill( customer.username );
await this.page
.locator( 'input[name="password"]' )
.fill( this.customer.password );
.fill( customer.password );
await this.page.locator( 'text=Log In' ).click();
// eslint-disable-next-line playwright/no-networkidle
await this.page.waitForLoadState( 'networkidle' );
Expand Down

0 comments on commit b057fa7

Please sign in to comment.