Advertisement
Guest User

Untitled

a guest
Aug 10th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var questions = require('../data/questions.json');
  2.  
  3. let textFieldCommands = {
  4.   verifyQuestionText: function(qid){
  5.     let question = questions[qid];
  6.     let questionXPath = `//div[@class='flow-question-header-title'][text()=` + question + `]`;
  7.  
  8.     this
  9.       .waitForElementPresent(questionXPath, this.api.globals.waitTime)
  10.       .expect.element(questionXPath).text.to.contain(question);
  11.  
  12.     return this;
  13.   },
  14.  
  15.   fillZipCode: function(code) {
  16.     this
  17.       .waitForElementPresent('@zipCodeField', this.api.globals.waitTime)
  18.       .setValue('@zipCodeField', code);
  19.  
  20.     return this;
  21.   },
  22.  
  23.   fillDOB: function(date) {
  24.     this
  25.       .waitForElementPresent('@dobField', this.api.globals.waitTime)
  26.       .setValue('@dobField', date);
  27.  
  28.     return this;
  29.   },
  30.  
  31.   fillEmail: function(email){
  32.     this
  33.       .waitForElementPresent('@standardField', this.api.globals.waitTime)
  34.       .setValue('@standardField', email)
  35.       .waitForElementPresent('@continueButton', this.api.globals.waitTime)
  36.       .click('@continueButton');
  37.  
  38.     return this;
  39.   }
  40.  
  41. };
  42.  
  43. module.exports = {
  44.   commands: [textFieldCommands],
  45.   elements: {
  46.     zipCodeField: '#id_chat_quesiton_whats_your_zip_code',
  47.     dobField: '#id_chat_quesiton_whats_your_birthdate',
  48.     standardField: '.flow-question-text_field-input',
  49.     continueButton: {
  50.       selector: '//button[text()="Continue"]',
  51.       locateStrategy: 'xpath'
  52.     }
  53.   }
  54. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement