Skip to content

Commit

Permalink
fix(core): update register customer test (#1419)
Browse files Browse the repository at this point in the history
  • Loading branch information
chanceaclark authored Oct 3, 2024
1 parent ac9832f commit a463093
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ export const registerCustomer = async ({ formData, reCaptchaToken }: RegisterCus
input: parsedData,
...(reCaptchaToken && { reCaptchaV2: { token: reCaptchaToken } }),
},
fetchOptions: {
cache: 'no-store',
},
});

const result = response.data.customer.registerCustomer;
Expand Down
1 change: 1 addition & 0 deletions core/tests/fixtures/utils/account/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export async function createAccount() {
postal_code,
},
],
origin_channel_id: process.env.BIGCOMMERCE_CHANNEL_ID,
},
]),
},
Expand Down
14 changes: 7 additions & 7 deletions core/tests/ui/e2e/register.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { faker } from '@faker-js/faker';

import { expect, test } from '~/tests/fixtures';

// Prefix is added to ensure that the password requirements are met
const password = faker.internet.password({ pattern: /[a-zA-Z0-9]/, prefix: '1At', length: 10 });

test('Account register', async ({ page }) => {
// Prefix is added to ensure that the password requirements are met
const password = faker.internet.password({ pattern: /[a-zA-Z0-9]/, prefix: '1At', length: 10 });

await page.goto('/register');

await page.getByRole('heading', { name: 'New account' }).waitFor();
Expand All @@ -32,10 +32,10 @@ test('Account is not created if email is already in use', async ({ page, account
await page.goto('/register');

await page.getByLabel('Email Address').fill(customer.email);
await page.getByLabel('PasswordRequired', { exact: true }).fill(password);
await page.getByLabel('Confirm PasswordRequired').fill(password);
await page.getByLabel('First NameRequired').fill(faker.person.firstName());
await page.getByLabel('Last NameRequired').fill(faker.person.lastName());
await page.getByLabel('PasswordRequired', { exact: true }).fill(customer.password);
await page.getByLabel('Confirm PasswordRequired').fill(customer.password);
await page.getByLabel('First NameRequired').fill(customer.firstName);
await page.getByLabel('Last NameRequired').fill(customer.lastName);
await page.getByLabel('Address Line 1Required').fill(faker.location.streetAddress());
await page.getByLabel('Suburb/CityRequired').fill(faker.location.city());
await page.getByLabel('Zip/PostcodeRequired').fill(faker.location.zipCode());
Expand Down

0 comments on commit a463093

Please sign in to comment.