How to use checkInitialValues method in wpt

Best JavaScript code snippet using wpt

hrid-handling-test.js

Source:hrid-handling-test.js Github

copy

Full Screen

...47 });48 it('has "Save & close" button at the bottom', () => {49 expect(HRIDHandlingInteractor.submitFormButton.isPresent).to.be.true;50 });51 checkInitialValues();52 describe('when "remove leading zeroes" checkbox', () => {53 describe('is checked', () => {54 beforeEach(async () => {55 await wait();56 await HRIDHandlingInteractor.removeZeroesCheckbox.clickAndBlur();57 });58 it('leading zeroes should be removed for "start with" fields', () => {59 HRIDHandlingInteractor.startWithFields.fields().forEach(field => {60 expect(field.val).to.be.equal('1');61 });62 });63 });64 describe('is unchecked', () => {65 beforeEach(async () => {66 await HRIDHandlingInteractor.removeZeroesCheckbox.clickAndBlur();67 await HRIDHandlingInteractor.removeZeroesCheckbox.clickAndBlur();68 });69 it('leading zeroes should be added for "start with" fields', () => {70 HRIDHandlingInteractor.startWithFields.fields().forEach(field => {71 expect(field.val).to.be.equal('00000000001');72 });73 });74 });75 });76 describe('when is pristine', () => {77 it('the submit button is disabled', () => {78 expect(HRIDHandlingInteractor.submitFormButtonDisabled).to.be.true;79 });80 it('the cancel button is disabled', () => {81 expect(HRIDHandlingInteractor.cancelFormButtonDisabled).to.be.true;82 });83 checkInitialValues();84 });85 describe('when is changed correctly', () => {86 beforeEach(async () => {87 await HRIDHandlingInteractor.startWithFields.fields(0).fillInput('0001');88 await HRIDHandlingInteractor.assignPrefixFields.fields(0).fillInput('it');89 });90 it('the submit button is not disabled', () => {91 expect(HRIDHandlingInteractor.submitFormButtonDisabled).to.be.false;92 });93 it('the cancel button is not disabled', () => {94 expect(HRIDHandlingInteractor.cancelFormButtonDisabled).to.be.false;95 });96 it('applies a changed class to fields', () => {97 expect(HRIDHandlingInteractor.startWithFields.fields(0).hasChangedStyle).to.be.true;98 expect(HRIDHandlingInteractor.assignPrefixFields.fields(0).hasChangedStyle).to.be.true;99 });100 it('startWith field value should be equal to "0001"', () => {101 expect(HRIDHandlingInteractor.startWithFields.fields(0).val).to.be.equal('0001');102 });103 it('assignPrefix field value should be equal to "it"', () => {104 expect(HRIDHandlingInteractor.assignPrefixFields.fields(0).val).to.be.equal('it');105 });106 });107 describe('when is changed', () => {108 beforeEach(async () => {109 await HRIDHandlingInteractor.startWithFields.fields(0).fillInput('0001');110 await HRIDHandlingInteractor.assignPrefixFields.fields(0).fillInput('it');111 });112 describe('and "Cancel" button pressed', () => {113 beforeEach(async () => {114 await HRIDHandlingInteractor.cancelFormButton.click();115 });116 checkInitialValues();117 });118 });119 describe('when input a non numeric value to the startWith field', () => {120 beforeEach(async () => {121 await HRIDHandlingInteractor.startWithFields.fields(0).fillAndBlur('fdg');122 });123 it('renders an error message', () => {124 expect(HRIDHandlingInteractor.startWithFields.fields(0).inputError).to.be.true;125 });126 it('with correct wording', () => {127 expect(HRIDHandlingInteractor.startWithFields.errorMessages(0).text)128 .to.be.equal(translation['hridHandling.validation.startWithField']);129 });130 });131 describe('when input special symbols to the assignPrefix field', () => {132 beforeEach(async () => {133 await HRIDHandlingInteractor.assignPrefixFields.fields(0).fillAndBlur('*');134 });135 it('renders an error message', () => {136 expect(HRIDHandlingInteractor.assignPrefixFields.fields(0).inputError).to.be.true;137 });138 it('with correct wording', () => {139 expect(HRIDHandlingInteractor.assignPrefixFields.errorMessages(0).text)140 .to.be.equal(translation['hridHandling.validation.assignPrefixField']);141 });142 });143 describe('when input a value that exceeds the required length to fields', () => {144 describe('input more then 11 characters to the "Start with" field', () => {145 beforeEach(async () => {146 await HRIDHandlingInteractor.startWithFields.fields(0).fillAndBlur('111111111111');147 });148 it('renders an error message', () => {149 expect(HRIDHandlingInteractor.startWithFields.fields(0).inputError).to.be.true;150 });151 it('with correct wording', () => {152 expect(HRIDHandlingInteractor.startWithFields.errorMessages(0).text)153 .to.be.equal(`Invalid value. Maximum ${START_WITH_MAX_LENGTH} characters allowed`);154 });155 it('value length exceeds allowed length', () => {156 expect(HRIDHandlingInteractor.startWithFields.fields(0).val.length).to.be.above(START_WITH_MAX_LENGTH);157 });158 });159 describe('input more then 10 characters to the "Assign prefix" field', () => {160 beforeEach(async () => {161 await HRIDHandlingInteractor.assignPrefixFields.fields(0).fillAndBlur('111111111aa');162 });163 it('renders an error message', () => {164 expect(HRIDHandlingInteractor.assignPrefixFields.fields(0).inputError).to.be.true;165 });166 it('with correct wording', () => {167 expect(HRIDHandlingInteractor.assignPrefixFields.errorMessages(0).text)168 .to.be.equal(`Invalid value. Maximum ${ASSIGN_PREFIX_MAX_LENGTH} characters allowed`);169 });170 it('value length exceeds allowed length', () => {171 expect(HRIDHandlingInteractor.assignPrefixFields.fields(0).val.length).to.be.above(ASSIGN_PREFIX_MAX_LENGTH);172 });173 });174 });175 describe('when the required startWith field is empty', () => {176 beforeEach(async () => {177 await HRIDHandlingInteractor.startWithFields.fields(0).fillAndBlur('');178 });179 it('renders an error message', () => {180 expect(HRIDHandlingInteractor.startWithFields.fields(0).inputError).to.be.true;181 });182 it('with correct wording', () => {183 expect(HRIDHandlingInteractor.startWithFields.errorMessages(0).text).to.be.equal(translation['hridHandling.validation.enterValue']);184 });185 });186 describe('when form is submitted', () => {187 describe('and settings are updated successfully', () => {188 setupApplication({ scenarios: ['fetch-hrid-settings-success', 'update-hrid-settings-success'] });189 beforeEach(async function () {190 await this.visit('/settings/inventory/hridHandling');191 await HRIDHandlingInteractor.startWithFields.fields(0).fillInput('765');192 await HRIDHandlingInteractor.startWithFields.fields(1).fillInput('001');193 await HRIDHandlingInteractor.startWithFields.fields(2).fillInput('5');194 await HRIDHandlingInteractor.submitFormButton.click();195 });196 describe('confirmation modal', () => {197 it('appears', () => {198 expect(HRIDHandlingInteractor.confirmationModal.isPresent).to.be.true;199 });200 describe('when clicking the confirm button', () => {201 beforeEach(async () => {202 await HRIDHandlingInteractor.confirmationModal.confirmButton.click();203 });204 it('then confirmation modal disappears', () => {205 expect(HRIDHandlingInteractor.confirmationModal.isPresent).to.be.false;206 });207 it('and successful toast appears', () => {208 expect(HRIDHandlingInteractor.callout.successCalloutIsPresent).to.be.true;209 });210 });211 describe('when clicking the cancel button', () => {212 beforeEach(async () => {213 await HRIDHandlingInteractor.confirmationModal.cancelButton.click();214 });215 it('then confirmation modal disappears', () => {216 expect(HRIDHandlingInteractor.confirmationModal.isPresent).to.be.false;217 });218 checkInitialValues();219 });220 });221 });222 describe('and the response contains error message', () => {223 setupApplication({ scenarios: ['fetch-hrid-settings-success', 'update-hrid-settings-error'] });224 beforeEach(async function () {225 await this.visit('/settings/inventory/hridHandling');226 await HRIDHandlingInteractor.startWithFields.fields(0).fillInput('765');227 await HRIDHandlingInteractor.startWithFields.fields(1).fillInput('001');228 await HRIDHandlingInteractor.startWithFields.fields(2).fillInput('5');229 await HRIDHandlingInteractor.submitFormButton.click();230 await HRIDHandlingInteractor.confirmationModal.confirmButton.click();231 });232 it('then error callout appears', () => {...

Full Screen

Full Screen

test.js

Source:test.js Github

copy

Full Screen

...3 browser().navigateTo(mainUrl);4 });5 var s = '[ng-controller="EditableTableCtrl"] > form ';6 //form enabled when data loaded7 function checkInitialValues() {8 expect(element(s+'table tr').count()).toBe(4);9 expect(element(s+'table tr:eq(1) td:eq(0) span[editable-text]').text()).toMatch('user1');10 expect(element(s+'table tr:eq(1) td:eq(1) span[editable-select]').text()).toMatch('status2');11 expect(element(s+'table tr:eq(1) td:eq(2) span[editable-select]').text()).toMatch('admin');12 expect(element(s+'table tr:eq(2) td:eq(0) span[editable-text]').text()).toMatch('user2');13 expect(element(s+'table tr:eq(3) td:eq(0) span[editable-text]').text()).toMatch('user3'); 14 }15 //edit button initially shown, form initially hidden16 function checkClosed() {17 expect(element(s+'table span[editable-text]:visible').count()).toBeGreaterThan(2);18 expect(element(s+'table span[editable-select]:visible').count()).toBeGreaterThan(5);19 expect(element(s+'.btn-edit button:visible').count()).toBe(1);20 expect(element(s+'.btn-form button:visible').count()).toBe(0);21 expect(element(s+'input[type="text"]').count()).toBe(0);22 expect(element(s+'select').count()).toBe(0);23 }24 //form shown in disabled state (loading)25 function checkWaiting() {26 expect(element(s+'table span[editable-text]:visible').count()).toBe(0);27 expect(element(s+'table span[editable-select]:visible').count()).toBe(0);28 expect(element(s+'.btn-edit button:visible').count()).toBe(0);29 expect(element(s+'.btn-form button:visible:disabled').count()).toBe(3);30 expect(element(s+'input[type="text"]:visible:disabled').count()).toBeGreaterThan(2);31 expect(element(s+'select:visible:disabled').count()).toBeGreaterThan(5);32 }33 //form enabled when data loaded34 function checkShown() {35 expect(element(s+'table span[editable-text]:visible').count()).toBe(0);36 expect(element(s+'table span[editable-select]:visible').count()).toBe(0);37 expect(element(s+'.btn-edit button:visible').count()).toBe(0);38 expect(element(s+'.btn-form button:visible:enabled').count()).toBe(3);39 expect(element(s+'input[type="text"]:visible:enabled').count()).toBeGreaterThan(2);40 expect(element(s+'select:visible:enabled').count()).toBeGreaterThan(5);41 }42 it('should show form by `edit` button and save new values', function() {43 //check initial values44 checkInitialValues();45 checkClosed();46 //show form47 element(s+'.btn-edit button').click();48 checkWaiting();49 sleep(delay);50 checkShown();51 //submit incorrect values (they set initially)52 element(s+'.btn-form button[type="submit"]').click();53 checkShown();54 //error shown (row 2)55 expect(element(s+'table tr:eq(2) td:eq(0) .editable-error:visible').count()).toBe(1);56 expect(element(s+'table tr:eq(2) td:eq(0) .editable-error').text()).toMatch('Username 2 should be `awesome`');57 //set correct values58 using(s+'table tr:eq(2) td:eq(0)').input('$data').enter('awesome'); //user2: name = awesome59 using(s+'table tr:eq(1) td:eq(1)').select('$data').option('3'); //user1: status = status460 using(s+'table tr:eq(1) td:eq(2)').select('$data').option('0'); //user1: group = user61 //add 2 new rows62 expect(element(s+'table tr').count()).toBe(4);63 element(s+'.btn-form button.pull-right').click();64 element(s+'.btn-form button.pull-right').click();65 expect(element(s+'table tr').count()).toBe(6);66 //delete row 367 element(s+'table tr:eq(3) td:eq(3) button').click();68 expect(element(s+'table tr').count()).toBe(5);69 //submit70 element(s+'.btn-form button[type="submit"]').click();71 checkWaiting();72 //error hidden73 expect(element(s+'table tr td:eq(2) .editable-error:visible').count()).toBe(0);74 sleep(delay);75 checkClosed();76 //check updated values77 expect(element(s+'table tr:eq(1) td:eq(0) span[editable-text]').text()).toMatch('user1');78 expect(element(s+'table tr:eq(1) td:eq(1) span[editable-select]').text()).toMatch('status4');79 expect(element(s+'table tr:eq(1) td:eq(2) span[editable-select]').text()).toMatch('user');80 expect(element(s+'table tr:eq(2) td:eq(0) span[editable-text]').text()).not().toMatch('user2');81 expect(element(s+'table tr:eq(3) td:eq(0) span[editable-text]').text()).toMatch('empty'); 82 });83 it('should be able to cancel all changes', function() {84 //check initial values85 checkInitialValues();86 checkClosed();87 //show form88 element(s+'.btn-edit button').click();89 sleep(delay);90 checkShown();91 //set correct values92 using(s+'table tr:eq(2) td:eq(0)').input('$data').enter('awesome'); //user2: name = awesome93 using(s+'table tr:eq(1) td:eq(1)').select('$data').option('3'); //user1: status = status494 using(s+'table tr:eq(1) td:eq(2)').select('$data').option('0'); //user1: group = user95 //add 2 new rows96 expect(element(s+'table tr').count()).toBe(4);97 element(s+'.btn-form button.pull-right').click();98 element(s+'.btn-form button.pull-right').click();99 expect(element(s+'table tr').count()).toBe(6);100 //delete row 3101 element(s+'table tr:eq(3) td:eq(3) button').click();102 expect(element(s+'table tr').count()).toBe(5);103 //click cancel 104 element(s+'.btn-form button[ng-click="tableform.$cancel()"]').click();105 //check reset values106 checkInitialValues();107 checkClosed(); 108 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var WebPageTest = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org');3wpt.runTest(url, { location: 'Dulles:Chrome', firstViewOnly: true }, function(err, data) {4 if (err) return console.error(err);5 console.log(data);6});

Full Screen

Using AI Code Generation

copy

Full Screen

1function test(){2 var wpt = new WebPageTest('www.webpagetest.org');3 wpt.checkInitialValues(function(err, data){4 if(err) return console.log(err);5 console.log(data);6 });7}8test();

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('./wpt.js');2wpt.checkInitialValues(function(err, data) {3 if (err) {4 console.log('error in checkInitialValues: ' + err);5 } else {6 console.log(data);7 }8});9var wpt = require('./wpt.js');10wpt.checkLocation(function(err, data) {11 if (err) {12 console.log('error in checkLocation: ' + err);13 } else {14 console.log(data);15 }16});17var wpt = require('./wpt.js');18wpt.checkStatus(function(err, data) {19 if (err) {20 console.log('error in checkStatus: ' + err);21 } else {22 console.log(data);23 }24});25var wpt = require('./wpt.js');26wpt.checkTesters(function(err, data) {27 if (err) {28 console.log('error in checkTesters: ' + err);29 } else {30 console.log(data);31 }32});33var wpt = require('./wpt.js');34wpt.checkVideo(function(err, data) {35 if (err) {36 console.log('error in checkVideo: ' + err);37 } else {38 console.log(data);39 }40});41var wpt = require('./wpt.js');42wpt.getBreakdown(function(err, data) {43 if (err) {44 console.log('error in getBreakdown: ' + err);45 } else {46 console.log(data);47 }48});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptutils = require('./wptutils.js');2var data = {3};4var data2 = {5};6var data3 = {7};8console.log(wptutils.checkInitialValues(data, ["test", "test2"]));9console.log(wptutils.checkInitialValues(data2, ["test", "test2"]));10console.log(wptutils.checkInitialValues(data3, ["test", "test2", "test3", "test4", "test5"]));11exports.checkInitialValues = function (data, keys) {12 var result = true;13 keys.forEach(function (key) {14 if (data[key] === undefined) {15 result = false;16 }17 });18 return result;19};

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('./wpt.js');2var wpt = new wpt('API_KEY');3wpt.checkInitialValues(function(err, data){4 if(err){console.log(err);}5 console.log(data);6});7var wpt = require('./wpt.js');8var wpt = new wpt('API_KEY');9var options = {

Full Screen

Using AI Code Generation

copy

Full Screen

1var tableSetup = new wptbTableSetup();2tableSetup.checkInitialValues( 'wptb-preview-table' );3### checkInitialValues( tableId, callback )4var tableSetup = new wptbTableSetup();5tableSetup.checkInitialValues( 'wptb-preview-table', function( data ) {6 console.log( data );7});8### checkInitialValues( tableId, callback, errorCallback )9var tableSetup = new wptbTableSetup();10tableSetup.checkInitialValues( 'wptb-preview-table', function( data ) {11 console.log( data );12}, function( error ) {13 console.log( error );14});15### checkInitialValues( tableId, callback, errorCallback, useCache )16var tableSetup = new wptbTableSetup();17tableSetup.checkInitialValues( 'wptb-preview-table', function( data ) {18 console.log( data );19}, function( error ) {20 console.log( error );21}, false );22### checkInitialValues( tableId, callback, errorCallback, useCache, checkForChanges )23var tableSetup = new wptbTableSetup();24tableSetup.checkInitialValues( 'wptb-preview-table', function( data ) {25 console.log( data );26}, function( error ) {27 console.log( error );28}, false, true );29### checkInitialValues( tableId, callback, errorCallback, useCache, checkForChanges, checkForChangesOnly )

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful