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
5.1 KiB

const {test, expect} =require('@playwright/test')
import { LoginPage } from '../pages/LoginPage';
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')
// await expect(await page.locator("//p[contains(text(),'Micheal Rabi')]")).toBeVisible();
await page.close();
})
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();
//const errorMessage=await page.locator("//small[@class='text-danger text-center']").textContent()
// console.log(errorMessage);
await page.close();
})
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();
//const errorMessage=await page.locator("//small[@class='text-danger text-center']").textContent()
// console.log(errorMessage);
await page.close();
})
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();
//const errorMessage=await page.locator("//small[@class='text-danger text-center']").textContent()
// console.log(errorMessage);
await page.close();
})
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();
//const errorMessage=await page.locator("//small[@class='text-danger text-center']").textContent()
// console.log(errorMessage);
await page.close();
})
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();
//const errorMessage=await page.locator("//small[@class='text-danger text-center']").textContent()
// console.log(errorMessage);
await page.close();
})
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();
//const errorMessage=await page.locator("//small[@class='text-danger text-center']").textContent()
// console.log(errorMessage);
await page.close();
})
test('Login test with Empty Email',async ({page})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
await login.login('','#12345678A')
// await expect(await page.locator("//p[contains(text(),'Micheal Rabi')]")).toBeVisible();
await page.close();
})
test('Login test with no password',async ({page})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
await login.login('rabisundaram@gmail.com','')
// const msg=await page.locator("//input[@placeholder='Password']").getAttribute("ariaHasPopup");
// console.log(msg);
await page.close();
})
test('Login test with no Email',async ({page})=>{
const login = new LoginPage(page);
await login.gotoLoginPage();
await login.login('','#12345678A')
//document.querySelector('input').value = 'New Value';
// await page.waitForTimeout(3000)
// await expect(await this.page.getByLabel('rabisundaram@gmail.com')).toBeVisible();
await page.close();
})
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();
})
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();
})