OBA Website automated using playwright
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

124 lines
4.4 KiB

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