Guest User

Untitled

a guest
Nov 10th, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. 'use strict';
  2. var mysql = require('mysql');
  3. var HomePage = require('../pages/homePage.js');
  4. var X = '111111';
  5. global.otp = X;
  6.  
  7. function connect(err) {
  8. console.log("otp function invoked");
  9. var con = mysql.createConnection({
  10. host: "myhost",
  11. user: "root",
  12. password: "mypassword",
  13. database: "mydb"
  14. });
  15. if (err) throw err;
  16. console.log("otp exception 1 called");
  17. con.query("SELECT otp FROM site_page order by createdat desc limit 1", function (err, result, fields) {
  18. if (err) throw err;
  19. console.log("otp exception 2 called");
  20. //console.log(result);
  21. console.log(result[0].otp);
  22. global.otp=result[0].otp
  23. console.log(otp);
  24. });
  25. };
  26.  
  27. describe('Home Cases', function() {
  28. var homePage= new HomePage();
  29.  
  30. beforeEach(function() {
  31. //browser.driver.manage().window().maximize();
  32. browser.get(browser.baseUrl);
  33. browser.sleep(2000);
  34. });
  35.  
  36. it('Checking main text of Login popup', function() {
  37. homePage.loginLinkClick();
  38. browser.sleep(2000);
  39. expect(homePage.loginPopupMainText).toEqual('Login');
  40. });
  41. fit('Checking successful login', function() {
  42. homePage.loginLinkClick();
  43. browser.sleep(2000);
  44. homePage.loginPopupEmailEnter('9953554431');
  45. browser.sleep(2000);
  46. homePage.loginPopupSendOtpButtonClick();
  47. browser.sleep(20000);
  48. //homePage.loginPopupOtpEnter('112222');
  49. //browser.sleep(2000);
  50. //homePage.loginPopupSubmitClick();
  51. console.log('lets invoke otp function');
  52. connect();
  53. browser.sleep(20000);
  54. console.log('printing otp');
  55. console.log(global.otp);
  56. homePage.loginPopupOtpEnter(global.otp);
  57. browser.sleep(2000);
  58. homePage.loginPopupSubmitClick();
  59. browser.sleep(20000);
  60. });
  61. });
  62.  
  63. lets invoke otp function
  64. otp function invoked
  65. otp exception 1 called
  66. printing otp
  67. 111111
  68. otp executed 2 called
  69. 181460
  70. 181460
  71.  
  72. lets invoke otp function
  73. otp function invoked
  74. otp exception 1 called
  75. otp executed 2 called
  76. 181460
  77. 181460
  78. printing otp
  79. 181460
Add Comment
Please, Sign In to add comment