Created
February 1, 2018 15:15
-
-
Save rajdeeep2k17/f2559b051a9a3df0da7d0b76ef621de8 to your computer and use it in GitHub Desktop.
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
describe("Dashboard Page", async() => { | |
it("Login as Basic", async() => { | |
await page.goto(baseUrl, {waitUntil: "networkidle0"}) | |
await page.click(".login-btn") | |
await page.waitForSelector('app-login form > input:nth-child(2)') | |
await page.type('app-login form > input:nth-child(2)', process.env.USERNAME) | |
await page.type('app-login form > input:nth-child(4)', process.env.PASSWORD) | |
await page.click('app-login form > button') | |
await page.waitForSelector('div.content-container > swiper') | |
}) | |
describe("Popular Members Carousel Test", async() => { | |
it("Next Arrow Slides Carousel To Right", async() => { | |
const nextIndex = | |
await page.$$eval('div.feature-profiles + swiper app-member', els => | |
Array.from(els).findIndex( e => e.className.indexOf('swiper-slide-active') > -1 )) + 2; | |
const nextName = await page.$eval(`div.feature-profiles + swiper app-member:nth-child(${nextIndex}) span.member-name`, el => el.innerHTML) | |
await page.waitForSelector('div.feature-profiles i.icon-next.slide-one-next') | |
await page.click('div.feature-profiles i.icon-next.slide-one-next') | |
const activeIndex = | |
await page.$$eval('div.feature-profiles + swiper app-member', els => | |
Array.from(els).findIndex( e => e.className.indexOf('swiper-slide-active') > -1 )) + 1; | |
const activeName = await page.$eval(`div.feature-profiles + swiper app-member:nth-child(${activeIndex}) span.member-name`, el => el.innerHTML) | |
expect(nextName).toBe(activeName); | |
}) | |
it("Previous Arrow Slides Carousel To Left", async() => { | |
const nextIndex = | |
await page.$$eval('div.feature-profiles + swiper app-member', els => | |
Array.from(els).findIndex( e => e.className.indexOf('swiper-slide-active') > -1 )) + 2; | |
const nextName = await page.$eval(`div.feature-profiles + swiper app-member:nth-child(${nextIndex}) span.member-name`, el => el.innerHTML) | |
await page.waitForSelector('div.feature-profiles i.icon-back.slide-one-prev') | |
await page.click('div.feature-profiles i.icon-back.slide-one-prev') | |
const activeIndex = | |
await page.$$eval('div.feature-profiles + swiper app-member', els => | |
Array.from(els).findIndex( e => e.className.indexOf('swiper-slide-active') > -1 )) + 3; | |
const activeName = await page.$eval(`div.feature-profiles + swiper app-member:nth-child(${activeIndex}) span.member-name`, el => el.innerHTML) | |
expect(nextName).toBe(activeName); | |
}) | |
}) | |
}) | |
describe("Contact Page", async() => { | |
it("Contact Form Validate Submission without Data", async() => { | |
await page.goto(`${baseUrl}soporte`, {waitUntil: "networkidle0"}) | |
await page.click('app-contact-form div.heading-wrapper') | |
await page.waitForSelector('#form-wrapper > form > div:nth-child(8) > button') | |
await page.click('#form-wrapper > form > div:nth-child(8) > button') | |
await page.waitForSelector('#form-wrapper > form > div:nth-child(1) > div.msg.msg--error') | |
await page.waitForSelector('#form-wrapper > form > div:nth-child(2) > div.msg.msg--error') | |
await page.waitForSelector('#form-wrapper > form > div:nth-child(3) > div.msg.msg--error') | |
await page.waitForSelector('#form-wrapper > form > div:nth-child(4) > div.msg.msg--error') | |
await page.waitForSelector('#form-wrapper > form > div:nth-child(5) > div.msg.msg--error') | |
await page.waitForSelector('#form-wrapper > form > div:nth-child(6) > div.msg.msg--error') | |
await page.waitForSelector('#form-wrapper > form > div:nth-child(6) > div.msg.msg--error') | |
await page.waitForSelector('#form-wrapper > form > div:nth-child(7) > div.msg.msg--error') | |
}) | |
it("Contact Form Submission with Data", async() => { | |
await page.type('#form-wrapper > form > div:nth-child(2) > input', 'rajdeep') | |
await page.type('#form-wrapper > form > div:nth-child(3) > input', 'This Is Test Subject') | |
await page.type('#form-wrapper > form > div:nth-child(4) > input', 'rajdeep@itobuz.com') | |
await page.type('#form-wrapper > form > div:nth-child(5) > input', 'rajdeep@itobuz.com') | |
await page.type('#form-wrapper textarea', 'This is my test message to submit form') | |
await page.click('#form-wrapper > form > div:nth-child(8) > button') | |
await page.waitForSelector('#form-wrapper > form > div:nth-child(7) > div.msg.msg--error') | |
}) | |
}) | |
describe("Login Page - Forgot Password", async() => { | |
it("Validation for submitting without entering email", async() => { | |
await page.goto(`${baseUrl}iniciar-sesion`, {waitUntil: "networkidle0"}) | |
await page.click('app-login form > div > a') | |
await page.waitForSelector('ngb-modal-window form button') | |
await page.click('ngb-modal-window form button') | |
await page.waitForSelector('ngb-modal-window form > div.msg.msg--error') | |
}) | |
it("Validation for submitting with an invalid email", async() => { | |
await page.waitForSelector('ngb-modal-window form > input') | |
await page.type('ngb-modal-window form > input', 'rajib@xyzs.co.qwerty') | |
await page.click('ngb-modal-window form button') | |
await page.waitForSelector('ngb-modal-window form > div.msg.msg--error') | |
}) | |
it("Clicking X closes modal", async() => { | |
await page.click('ngb-modal-window div.heading-wrap > button') | |
try { | |
await page.waitForSelector('ngb-modal-window', {timeout: 5000}) | |
} | |
catch(err) { | |
console.log('Modal Not Found Hence Test Passed') | |
} | |
}) | |
}) | |
describe("Landing Page - Register Focus", async() => { | |
it("Click on Urnime Gratis / Find members section focuses email field", async() => { | |
await page.goto(baseUrl, {waitUntil: "networkidle0"}) | |
await page.click('div.find-members a') | |
await page.focus('app-register-step-one form input') | |
}) | |
it("Click Left Urnime Gratis / Casual Meet section focuses email field", async() => { | |
await page.click('div.casual-meet div.column:nth-child(1) a') | |
await page.focus('app-register-step-one form input') | |
}) | |
it("Click Right Urnime Gratis / Casual Meet section focuses email field", async() => { | |
await page.click('div.casual-meet div.column:nth-child(2) a') | |
await page.focus('app-register-step-one form input') | |
}) | |
}) | |
describe("Landing Page - Member Click", async() => { | |
it("Click on a member redirects to login page", async() => { | |
await page.goto(baseUrl, {waitUntil: "networkidle0"}) | |
await page.click('app-member') | |
await page.waitForSelector('div.login-details') | |
}) | |
}) | |
describe("Registration - Incorrect Email ID", async() => { | |
it("Submit form with incorrect email", async() => { | |
await page.goto(baseUrl, {waitUntil: "networkidle0"}) | |
await page.type('form input', 'testing123@test.co.in') | |
await page.click('#register-form form button') | |
await page.waitForSelector('app-register-step-one p-autocomplete + div.msg.msg--error') | |
}) | |
}) | |
describe("Registration - No Email ID", async() => { | |
it("Submit form with blank email", async() => { | |
await page.goto(baseUrl, {waitUntil: "networkidle0"}) | |
await page.click('#register-form form button') | |
await page.waitForSelector('app-register-step-one p-autocomplete + div.msg--error') | |
}) | |
}) | |
describe("Registration - Email Domain Autocomplete", async() => { | |
it("Type into registration Input", async() => { | |
await page.goto(baseUrl, {waitUntil: "networkidle0"}) | |
await page.type('form input', 'rajdeep@o') | |
await page.waitForSelector('form > div > div:nth-child(2) > div > p-autocomplete > span > div > ul') | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment