const {test, expect} =require('@playwright/test') import { LoginPage } from '../pages/LoginPage'; //For Valid Details. test('TC-LP-01: Login test with correct credentials',async ({page})=>{ //Navigate to login page const login = new LoginPage(page); await login.gotoLoginPage(); await login.login('xpcv2@rustyload.com','7777777777') //Assertion await expect(page).toHaveURL('https://dev.orderbookings.com/merchant/index/index'); //check the expected url is having same url await page.close(); }) //@ Email without @ symbol test('TC-LP-03: Login test Merchant enters email without @ symbol',async ({page})=>{ //Navigate to Login Page const login = new LoginPage(page); await login.gotoLoginPage(); await login.login('rabisundaatramgmail.com','#12345678A') //Assertion await expect(await page.locator("//small[@class='text-danger text-center']")).toBeVisible(); //negative invalid email await page.close(); }) // Email without domain test('TC-Lp-04: Login test Merchant enters email without domain',async ({page})=>{ //Navigate to Login Page const login = new LoginPage(page); await login.gotoLoginPage(); await login.login('rabisundaatram@.com','#12345678A') //Assertion await expect(await page.locator("//small[@class='text-danger text-center']")).toBeVisible(); //negative invalid email await page.close(); }) // Email with excessive Length test('TC-LP-05: Login test Merchant enters Email with excessive Length',async ({page})=>{ //Navigate to Login Page const login = new LoginPage(page); await login.gotoLoginPage(); await login.login('rabisundaatramiuegkdsfyuydklashmnfbdkashnbv@gmail.com','#12345678A') //Assertion await expect(await page.locator("//small[@class='text-danger text-center']")).toBeVisible(); //negative invalid email await page.close(); }) //Email with consecutive dots test('TC-LP-07: Login test Merchant enters Email with consecutive dots',async ({page})=>{ //Navigate to Login Page const login = new LoginPage(page); await login.gotoLoginPage(); await login.login('rabisundaatram@gmail..com','#12345678A') //Assertion await expect(await page.locator("//small[@class='text-danger text-center']")).toBeVisible(); //negative invalid email await page.close(); }) //Empty Username test('TC-LP-08: Login test with Empty Email',async ({page})=>{ //Navigate to Login Page const login = new LoginPage(page); await login.gotoLoginPage(); await login.login('','#12345678A') //Assertion const locator = page.locator("//input[@name='oba_login_emailid']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); await page.close(); }) //Empty Password test('TC-LP-09: Login test with no password',async ({page})=>{ //Navigate to Login Page const login = new LoginPage(page); await login.gotoLoginPage(); await login.login('rabisundaram@gmail.com','') //Assertion const locator = page.locator("//input[@placeholder='Password']"); await expect(locator).toBeFocused(); await expect(locator).toBeVisible(); await page.close(); }) //Invalid Username test('TC-LP-10: Login test with wrong Email',async ({page})=>{ //Navigate to Login Page const login = new LoginPage(page); await login.gotoLoginPage(); await login.login('rabisundaatram@gmail.com','#12345678A') //Assertion await expect(await page.locator("//small[@class='text-danger text-center']")).toBeVisible(); //negative invalid email await page.close(); }) //Invalid Password test('TC-LP-11: Login test with wrong password',async ({page})=>{ //Navigate to login page const login = new LoginPage(page); await login.gotoLoginPage(); await login.login('rabisundaram@gmail.com','#123466678A') //Assertion await expect(await page.locator("//small[@class='text-danger text-center']")).toBeVisible(); //negative invalid email await page.close(); }) //Forgot Password working or not? test('TC-LP-12: ForgotPassword',async ({page})=>{ //Navigate to Login Page const login = new LoginPage(page); await login.gotoLoginPage(); await page.waitForTimeout(3000) await login.forgetPasswordLink() await page.waitForTimeout(3000) //Assertion await expect(await page.locator("//button[normalize-space()='RESET']")).toBeVisible(); }) //Back To Login working? test('TC-LP-13: BacktoLogin',async ({page})=>{ //Navigate to Login Page const login = new LoginPage(page); await login.gotoLoginPage(); await page.waitForTimeout(3000) await login.forgetPasswordLink() await page.waitForTimeout(3000) await login.backToLoginLink() await page.waitForTimeout(3000) //Assertion await expect(await page.locator("//button[normalize-space()='SIGN IN']")).toBeVisible(); }) // test('TC-LP-14: Invalid mail',async ({page})=>{ //Navigate to Login Page const login = new LoginPage(page); await login.gotoLoginPage(); await login.login('midhaja','#12345678A') await page.waitForTimeout(3000) await page.locator("//div[@role='alert']").textContent() //Assertion await expect(await page.locator("//div[@role='alert']")).toBeVisible(); })