Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var index = require('../pages/index');
- var webdriver = require('selenium-webdriver'),
- By = webdriver.By,
- until = webdriver.until;
- var driver = new webdriver.Builder().
- withCapabilities(webdriver.Capabilities.chrome()).
- build();
- const headingTitleExist = async function() {
- const headingTitleElement = await driver.wait(until.elementLocated(By.css('.page-heading__title')));
- return headingTitleElement.isDisplayed();
- }
- //=========Left Panel - Notifications========
- const notificationsTitleExist = async function() {
- const notificationsTitleElement = await driver.wait(until.elementLocated(By.css('.info-list__wrapper h4.brand')));
- return await notificationsTitleElement.getAttribute('innerHTML');
- }
- const subjectEnrolmentsOpenExist = async function() {
- const subjectEnrolmentOpenElement = await driver.wait(until.elementLocated(By.css('.info-list li:first-child')));
- return await subjectEnrolmentOpenElement.getText();
- }
- const youHaveOutstandingActionsExist = async function() {
- const youHaveOutstandingActionsElement = await driver.wait(until.elementLocated(By.css('.info-list li:nth-child(2)')));
- return await youHaveOutstandingActionsElement.getText();
- }
- const enrolByThisDateToAvoidLateFeeExist = async function() {
- const enrolByThisDateToAvoidLateFeeElement = await driver.wait(until.elementLocated(By.css('.info-list li:nth-child(3)')));
- return await enrolByThisDateToAvoidLateFeeElement.getText();
- }
- const subjectEnrolmentsCloseExist = async function() {
- const subjectEnrolmentsCloseElement = await driver.wait(until.elementLocated(By.css('.info-list li:nth-child(4)')));
- return await subjectEnrolmentsCloseElement.getText();
- }
- const startOfTeachingExist = async function() {
- const startOfTeachingElement = await driver.wait(until.elementLocated(By.css('.info-list li:nth-child(5)')));
- return await startOfTeachingElement.getText();
- }
- //========Right Panel - KBS Campus Details===========
- const kbsCampusTitleExist = async function() {
- const kbsCampusTitleElement = await driver.wait(until.elementLocated(By.css('.dashboard__school-details h4.brand')));
- return await kbsCampusTitleElement.getAttribute('innerHTML');
- }
- const telNoExist = async function() {
- const telNoElement = await driver.wait(until.elementLocated(By.css('.dashboard__school-details .tel span')));
- return await telNoElement.getAttribute('innerHTML');
- }
- const mapExist = async function() {
- const mapElement = await driver.wait(until.elementLocated(By.css('.dashboard__school-details .map span')));
- return await mapElement.getAttribute('innerHTML');
- }
- const studentFormTitleExist = async function() {
- const studentFormTitleElement = await driver.wait(until.elementLocated(By.css('.dashboard__student-forms h4')));
- return await studentFormTitleElement.getAttribute('innerHTML');
- }
- const leaveOfAbsenceExist = async function() {
- const leaveOfAbsenceElement = await driver.wait(until.elementLocated(By.css('.student-forms__list li:first-child a')));
- return await leaveOfAbsenceElement.getAttribute('innerHTML');
- }
- const intermissionOfStudiesDeferralRequestExist = async function() {
- const intermissionOfStudiesDeferralRequestElement = await driver.wait(until.elementLocated(By.css('.student-forms__list li:nth-child(2) a')));
- return await intermissionOfStudiesDeferralRequestElement.getAttribute('innerHTML');
- }
- const campusTransferExist = async function() {
- const campusTransferElement = await driver.wait(until.elementLocated(By.css('.student-forms__list li:nth-child(3) a')));
- return await campusTransferElement.getAttribute('innerHTML');
- }
- const viewAllStudentPdfFormsExist = async function() {
- const viewAllStudentPdfFormsElement = await driver.wait(until.elementLocated(By.css('.student-forms__list li:nth-child(4) a.external-link')));
- return await viewAllStudentPdfFormsElement.getAttribute('innerHTML');
- }
- //==========Actions Icons============
- const basketIconExist = async function() {
- const basketIconElement = await driver.wait(until.elementLocated(By.css('.action-icons--item.is-dropdown-submenu-parent.opens-right:first-child')));
- return await basketIconElement.isDisplayed();
- }
- const bellIconExist = async function() {
- const bellIconElement = await driver.wait(until.elementLocated(By.css('.action-icons--item.action')));
- return await bellIconElement.isDisplayed();
- }
- const userIconExist = async function() {
- const userIconElement = await driver.wait(until.elementLocated(By.css('.action-icons--item.is-dropdown-submenu-parent.opens-right:nth-child(3)')));
- return await userIconElement.isDisplayed();
- }
- //=======Common method===========
- const openUrl = function() {
- const username = 'kaplan';
- const password = '7espuy';
- driver.get('https://'+username+':'+password+'@d22au4ni7coabp.cloudfront.net/');
- // https://kaplan:7espuy@d22au4ni7coabp.cloudfront.net/
- }
- const clickSignIn = function() {
- driver.findElement(webdriver.By.css('.button')).click();
- }
- const closeBrowser = function() {
- driver.quit();
- }
- const setUserLogin = async function(username,password) {
- await driver.wait(until.elementLocated(By.id('userNameInput')));
- const setUserName = await driver.findElement(webdriver.By.id('userNameInput')).sendKeys(username);
- const setPassword = await driver.findElement(webdriver.By.id('passwordInput')).sendKeys(password);
- const clickBtn = await driver.findElement(webdriver.By.id('submitButton')).click();
- }
- const enterUserLoginAs = async function(userobj) {
- return setUserLogin(userobj.username, userobj.password);
- }
- module.exports = {
- openUrl : openUrl,
- closeBrowser : closeBrowser,
- clickSignIn : clickSignIn,
- enterUserLoginAs : enterUserLoginAs,
- notificationsTitleExist : notificationsTitleExist,
- subjectEnrolmentsOpenExist : subjectEnrolmentsOpenExist,
- youHaveOutstandingActionsExist : youHaveOutstandingActionsExist,
- enrolByThisDateToAvoidLateFeeExist : enrolByThisDateToAvoidLateFeeExist,
- subjectEnrolmentsCloseExist : subjectEnrolmentsCloseExist,
- startOfTeachingExist : startOfTeachingExist,
- kbsCampusTitleExist : kbsCampusTitleExist,
- telNoExist : telNoExist,
- mapExist : mapExist,
- studentFormTitleExist : studentFormTitleExist,
- leaveOfAbsenceExist : leaveOfAbsenceExist,
- intermissionOfStudiesDeferralRequestExist : intermissionOfStudiesDeferralRequestExist,
- campusTransferExist : campusTransferExist,
- viewAllStudentPdfFormsExist : viewAllStudentPdfFormsExist,
- headingTitleExist : headingTitleExist
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement