forked from woocommerce/woocommerce
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[e2e tests] Introduce Faker - update checkout login test to use uniqu…
…e and realistic test data (woocommerce#53385)
- Loading branch information
1 parent
d837888
commit 9239dec
Showing
5 changed files
with
303 additions
and
338 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
plugins/woocommerce/changelog/e2e-improve-checkout-login-unique-test-data
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,4 @@ | ||
Significance: patch | ||
Type: dev | ||
|
||
E2E tests: update checkout-login test to use the existing customer instead of creating a new one |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
const { faker } = require( '@faker-js/faker' ); | ||
|
||
function getFakeUser( role ) { | ||
const firstName = faker.person.firstName(); | ||
const lastName = faker.person.lastName(); | ||
const email = faker.internet.email( { | ||
firstName, | ||
lastName, | ||
provider: 'example.fakerjs.dev', | ||
} ); | ||
|
||
return { | ||
email, | ||
first_name: firstName, | ||
last_name: lastName, | ||
role, | ||
username: faker.internet.username( { firstName, lastName } ), | ||
password: faker.internet.password(), | ||
billing: { | ||
first_name: firstName, | ||
last_name: lastName, | ||
address_1: '969 Market', | ||
address_2: '', | ||
city: 'San Francisco', | ||
state: 'CA', | ||
postcode: '94103', | ||
country: 'US', | ||
email, | ||
phone: '(555) 555-5555', | ||
}, | ||
shipping: { | ||
first_name: firstName, | ||
last_name: lastName, | ||
address_1: '969 Market', | ||
address_2: '', | ||
city: 'San Francisco', | ||
state: 'CA', | ||
postcode: '94103', | ||
country: 'US', | ||
}, | ||
}; | ||
} | ||
|
||
function getFakeCustomer() { | ||
return getFakeUser( 'customer' ); | ||
} | ||
|
||
function getFakeProduct() { | ||
return { | ||
name: `${ faker.commerce.productName() }`, | ||
description: faker.commerce.productDescription(), | ||
regular_price: faker.commerce.price(), | ||
type: 'simple', | ||
}; | ||
} | ||
|
||
module.exports = { | ||
getFakeCustomer, | ||
getFakeProduct, | ||
}; |
Oops, something went wrong.