From f5e2155d4952568427904cade44907a9fe38500a Mon Sep 17 00:00:00 2001 From: Anastasiia Zvierieva <81637332+bc-azvierieva@users.noreply.github.com> Date: Fri, 20 Sep 2024 18:02:41 +0200 Subject: [PATCH] Add account tests and fix typos (#1390) --- core/messages/en.json | 4 ++-- core/messages/ja.json | 2 +- core/tests/ui/e2e/login.spec.ts | 14 ++++++++++++++ core/tests/ui/e2e/register.spec.ts | 19 +++++++++++++++++++ 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/core/messages/en.json b/core/messages/en.json index a70dca3e9..42b40392c 100644 --- a/core/messages/en.json +++ b/core/messages/en.json @@ -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 " } }, @@ -363,7 +363,7 @@ "sku": "SKU", "upc": "UPC", "minPurchase": "Minimum purchase", - "maxPurchase": "Maxiumum purchase", + "maxPurchase": "Maximum purchase", "availability": "Availability", "condition": "Condition", "weight": "Weight", diff --git a/core/messages/ja.json b/core/messages/ja.json index 609ceabe5..4aae0cd02 100644 --- a/core/messages/ja.json +++ b/core/messages/ja.json @@ -362,7 +362,7 @@ "sku": "SKU", "upc": "UPC", "minPurchase": "最小購入額", - "maxPurchase": "Maxiumum purchase", + "maxPurchase": "Maximum purchase", "availability": "販売中", "condition": "条件", "weight": "重さ", diff --git a/core/tests/ui/e2e/login.spec.ts b/core/tests/ui/e2e/login.spec.ts index 5652e7d9d..9f9a918fd 100644 --- a/core/tests/ui/e2e/login.spec.ts +++ b/core/tests/ui/e2e/login.spec.ts @@ -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(); +}); diff --git a/core/tests/ui/e2e/register.spec.ts b/core/tests/ui/e2e/register.spec.ts index b99fd6c79..0c6b55efd 100644 --- a/core/tests/ui/e2e/register.spec.ts +++ b/core/tests/ui/e2e/register.spec.ts @@ -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(); +});