Skip to content

Commit 72e9eb0

Browse files
Updated Coding Standard
1 parent 5f4e320 commit 72e9eb0

File tree

1 file changed

+27
-28
lines changed

1 file changed

+27
-28
lines changed

tests/Forms/Login.spec.js

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,56 @@
11
const { test, expect } = require('@playwright/test');
22

3-
test('Login - Shop',async({page}) => {
4-
await page.goto('https://qa-practice.netlify.app/auth_ecommerce')
3+
// Verify the page title
4+
test('Verify page title: QA Practice | Learn with RV', async ({ page }) => {
5+
await page.goto('https://qa-practice.netlify.app/auth_ecommerce');
56

6-
// Expect a title "to contain" a substring.
7-
await expect(page).toHaveTitle('QA Practice | Learn with RV')
7+
// Verify that the page title matches the expected value
8+
await expect(page).toHaveTitle('QA Practice | Learn with RV');
89
});
910

10-
test('check-form-validation', async ({ page }) => {
11+
// Test form submission without entering any fields
12+
test('Verify form validation for empty fields', async ({ page }) => {
1113
await page.goto('https://qa-practice.netlify.app/auth_ecommerce');
1214

13-
// Check form validation without entering any fields & click on submit
15+
// Attempt to submit the form without filling in the fields
1416
await page.getByRole('button', { name: 'Submit' }).click();
1517

16-
const errorMessage = await page.getByText('Bad credentials! Please try');
17-
18+
// Check if the error message is displayed
19+
const errorMessage = page.getByText('Bad credentials! Please try');
1820
await expect(errorMessage).toBeVisible();
19-
20-
await expect(errorMessage).toHaveText("Bad credentials! Please try again! Make sure that you've registered.");
21+
await expect(errorMessage).toHaveText(
22+
"Bad credentials! Please try again! Make sure that you've registered."
23+
);
2124
});
2225

23-
test('check-form-validation-for-invalid-user-or-password', async ({ page }) => {
24-
26+
// Validate the form with invalid credentials
27+
test('Verify form validation for invalid credentials', async ({ page }) => {
2528
await page.goto('https://qa-practice.netlify.app/auth_ecommerce');
2629

30+
// Fill the form with invalid email and password
2731
await page.locator('#email').fill('test@gmail.com');
28-
2932
await page.locator('#password').fill('test@123');
30-
3133
await page.getByRole('button', { name: 'Submit' }).click();
3234

33-
const errorMessage = await page.getByText('Bad credentials! Please try');
34-
35+
// Check if the error message is displayed
36+
const errorMessage = page.getByText('Bad credentials! Please try');
3537
await expect(errorMessage).toBeVisible();
36-
37-
await expect(errorMessage).toHaveText("Bad credentials! Please try again! Make sure that you've registered.");
38-
38+
await expect(errorMessage).toHaveText(
39+
"Bad credentials! Please try again! Make sure that you've registered."
40+
);
3941
});
4042

41-
test('check-form-for-valid-user-or-password', async ({ page }) => {
42-
43+
// Validate login functionality with valid credentials
44+
test('Verify login with valid credentials', async ({ page }) => {
4345
await page.goto('https://qa-practice.netlify.app/auth_ecommerce');
4446

47+
// Fill the form with valid email and password
4548
await page.locator('#email').fill('admin@admin.com');
46-
4749
await page.locator('#password').fill('admin123');
48-
4950
await page.getByRole('button', { name: 'Submit' }).click();
5051

51-
const shoppingCart = await page.locator('text=SHOPPING CART');
52-
52+
// Verify the presence of the shopping cart page
53+
const shoppingCart = page.locator('text=SHOPPING CART');
5354
await expect(shoppingCart).toBeVisible();
54-
55-
await expect(shoppingCart).toHaveText("SHOPPING CART");
56-
55+
await expect(shoppingCart).toHaveText('SHOPPING CART');
5756
});

0 commit comments

Comments
 (0)