Skip to content

Commit

Permalink
Add account tests and fix typos (bigcommerce#1390)
Browse files Browse the repository at this point in the history
  • Loading branch information
bc-azvierieva authored Sep 20, 2024
1 parent a309a4d commit f5e2155
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 3 deletions.
4 changes: 2 additions & 2 deletions core/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"multipleAddresses": "Save multiple shipping addresses",
"ordersHistory": "Access your order history",
"ordersTracking": "Track new orders",
"wishlists": "Save items to your Wish List",
"wishlists": "Save items to your Wishlist",
"createLink": "Create Account "
}
},
Expand Down Expand Up @@ -363,7 +363,7 @@
"sku": "SKU",
"upc": "UPC",
"minPurchase": "Minimum purchase",
"maxPurchase": "Maxiumum purchase",
"maxPurchase": "Maximum purchase",
"availability": "Availability",
"condition": "Condition",
"weight": "Weight",
Expand Down
2 changes: 1 addition & 1 deletion core/messages/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@
"sku": "SKU",
"upc": "UPC",
"minPurchase": "最小購入額",
"maxPurchase": "Maxiumum purchase",
"maxPurchase": "Maximum purchase",
"availability": "販売中",
"condition": "条件",
"weight": "重さ",
Expand Down
14 changes: 14 additions & 0 deletions core/tests/ui/e2e/login.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,17 @@ test('Account login and logout', async ({ page, account }) => {

await expect(page.getByRole('heading', { name: 'Log in' })).toBeVisible();
});

test('Login fails with invalid credentials', async ({ page }) => {
await page.goto('/login');

await page.getByLabel('Email').fill('email@address.com');
await page.getByLabel('Password').fill('1QwpO8b');
await page.getByRole('button', { name: 'Log in' }).click();

await expect(
page.getByText(
'Your email address or password is incorrect. Try signing in again or reset your password',
),
).toBeVisible();
});
19 changes: 19 additions & 0 deletions core/tests/ui/e2e/register.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,22 @@ test('Account register', async ({ page }) => {
await expect(page).toHaveURL('/en/account/');
await expect(page.getByText('Your account has been successfully created')).toBeVisible();
});

test('Account is not created if email is already in use', async ({ page, account }) => {
const customer = await account.create();

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('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());

await page.getByRole('button', { name: 'Create account' }).click();

await expect(page.getByText('The email address is already in use.')).toBeVisible();
});

0 comments on commit f5e2155

Please sign in to comment.