Fix for cleaning customers function in e2e (#2952)
This commit is contained in:
parent
d695bb9aa6
commit
2b4a819fae
1 changed files with 4 additions and 2 deletions
|
@ -33,11 +33,13 @@ export function createCustomer(email, customerName, address, isActive = false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function deleteCustomersStartsWith(startsWith) {
|
export function deleteCustomersStartsWith(startsWith) {
|
||||||
getCustomers(startsWith).then(resp => {
|
const serverStoredEmail = startsWith.toLowerCase();
|
||||||
|
|
||||||
|
getCustomers(serverStoredEmail).then(resp => {
|
||||||
if (resp.body.data.customers) {
|
if (resp.body.data.customers) {
|
||||||
const customers = resp.body.data.customers.edges;
|
const customers = resp.body.data.customers.edges;
|
||||||
customers.forEach(element => {
|
customers.forEach(element => {
|
||||||
if (element.node.email.includes(startsWith)) {
|
if (element.node.email.includes(serverStoredEmail)) {
|
||||||
deleteCustomer(element.node.id);
|
deleteCustomer(element.node.id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue