Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- var mysql = require('mysql');
- var HomePage = require('../pages/homePage.js');
- var X = '111111';
- global.otp = X;
- function connect(err) {
- console.log("otp function invoked");
- var con = mysql.createConnection({
- host: "myhost",
- user: "root",
- password: "mypassword",
- database: "mydb"
- });
- if (err) throw err;
- console.log("otp exception 1 called");
- con.query("SELECT otp FROM site_page order by createdat desc limit 1", function (err, result, fields) {
- if (err) throw err;
- console.log("otp exception 2 called");
- //console.log(result);
- console.log(result[0].otp);
- global.otp=result[0].otp
- console.log(otp);
- });
- };
- describe('Home Cases', function() {
- var homePage= new HomePage();
- beforeEach(function() {
- //browser.driver.manage().window().maximize();
- browser.get(browser.baseUrl);
- browser.sleep(2000);
- });
- it('Checking main text of Login popup', function() {
- homePage.loginLinkClick();
- browser.sleep(2000);
- expect(homePage.loginPopupMainText).toEqual('Login');
- });
- fit('Checking successful login', function() {
- homePage.loginLinkClick();
- browser.sleep(2000);
- homePage.loginPopupEmailEnter('9953554431');
- browser.sleep(2000);
- homePage.loginPopupSendOtpButtonClick();
- browser.sleep(20000);
- //homePage.loginPopupOtpEnter('112222');
- //browser.sleep(2000);
- //homePage.loginPopupSubmitClick();
- console.log('lets invoke otp function');
- connect();
- browser.sleep(20000);
- console.log('printing otp');
- console.log(global.otp);
- homePage.loginPopupOtpEnter(global.otp);
- browser.sleep(2000);
- homePage.loginPopupSubmitClick();
- browser.sleep(20000);
- });
- });
- lets invoke otp function
- otp function invoked
- otp exception 1 called
- printing otp
- 111111
- otp executed 2 called
- 181460
- 181460
- lets invoke otp function
- otp function invoked
- otp exception 1 called
- otp executed 2 called
- 181460
- 181460
- printing otp
- 181460
Add Comment
Please, Sign In to add comment