-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f4e320
commit 72e9eb0
Showing
1 changed file
with
27 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,56 @@ | ||
const { test, expect } = require('@playwright/test'); | ||
|
||
test('Login - Shop',async({page}) => { | ||
await page.goto('https://qa-practice.netlify.app/auth_ecommerce') | ||
// Verify the page title | ||
test('Verify page title: QA Practice | Learn with RV', async ({ page }) => { | ||
await page.goto('https://qa-practice.netlify.app/auth_ecommerce'); | ||
|
||
// Expect a title "to contain" a substring. | ||
await expect(page).toHaveTitle('QA Practice | Learn with RV') | ||
// Verify that the page title matches the expected value | ||
await expect(page).toHaveTitle('QA Practice | Learn with RV'); | ||
}); | ||
|
||
test('check-form-validation', async ({ page }) => { | ||
// Test form submission without entering any fields | ||
test('Verify form validation for empty fields', async ({ page }) => { | ||
await page.goto('https://qa-practice.netlify.app/auth_ecommerce'); | ||
|
||
// Check form validation without entering any fields & click on submit | ||
// Attempt to submit the form without filling in the fields | ||
await page.getByRole('button', { name: 'Submit' }).click(); | ||
|
||
const errorMessage = await page.getByText('Bad credentials! Please try'); | ||
|
||
// Check if the error message is displayed | ||
const errorMessage = page.getByText('Bad credentials! Please try'); | ||
await expect(errorMessage).toBeVisible(); | ||
|
||
await expect(errorMessage).toHaveText("Bad credentials! Please try again! Make sure that you've registered."); | ||
await expect(errorMessage).toHaveText( | ||
"Bad credentials! Please try again! Make sure that you've registered." | ||
); | ||
}); | ||
|
||
test('check-form-validation-for-invalid-user-or-password', async ({ page }) => { | ||
|
||
// Validate the form with invalid credentials | ||
test('Verify form validation for invalid credentials', async ({ page }) => { | ||
await page.goto('https://qa-practice.netlify.app/auth_ecommerce'); | ||
|
||
// Fill the form with invalid email and password | ||
await page.locator('#email').fill('[email protected]'); | ||
|
||
await page.locator('#password').fill('test@123'); | ||
|
||
await page.getByRole('button', { name: 'Submit' }).click(); | ||
|
||
const errorMessage = await page.getByText('Bad credentials! Please try'); | ||
|
||
// Check if the error message is displayed | ||
const errorMessage = page.getByText('Bad credentials! Please try'); | ||
await expect(errorMessage).toBeVisible(); | ||
|
||
await expect(errorMessage).toHaveText("Bad credentials! Please try again! Make sure that you've registered."); | ||
|
||
await expect(errorMessage).toHaveText( | ||
"Bad credentials! Please try again! Make sure that you've registered." | ||
); | ||
}); | ||
|
||
test('check-form-for-valid-user-or-password', async ({ page }) => { | ||
|
||
// Validate login functionality with valid credentials | ||
test('Verify login with valid credentials', async ({ page }) => { | ||
await page.goto('https://qa-practice.netlify.app/auth_ecommerce'); | ||
|
||
// Fill the form with valid email and password | ||
await page.locator('#email').fill('[email protected]'); | ||
|
||
await page.locator('#password').fill('admin123'); | ||
|
||
await page.getByRole('button', { name: 'Submit' }).click(); | ||
|
||
const shoppingCart = await page.locator('text=SHOPPING CART'); | ||
|
||
// Verify the presence of the shopping cart page | ||
const shoppingCart = page.locator('text=SHOPPING CART'); | ||
await expect(shoppingCart).toBeVisible(); | ||
|
||
await expect(shoppingCart).toHaveText("SHOPPING CART"); | ||
|
||
await expect(shoppingCart).toHaveText('SHOPPING CART'); | ||
}); |