How to use el.sendKeys method in Appium Xcuitest Driver

Best JavaScript code snippet using appium-xcuitest-driver

Run Appium Xcuitest Driver automation tests on LambdaTest cloud grid

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

Sign up Free
_

resursi.materijali.test.js

Source: resursi.materijali.test.js Github

copy
1
2//Auth: Maja
3
4
5'use strict';
6var webdriver = require('selenium-webdriver');
7//var chai = require('chai');
8//var expect = require('chai');
9var assert = require('assert');
10var sinon = require ('sinon');
11var {Builder, By, until} = require('selenium-webdriver');
12var test = require('selenium-webdriver/testing');
13
14 
15 
16var driver = new webdriver.Builder().forBrowser('chrome').build();
17/*--------------------------------------------------------------------------*/
18
19 test.describe('AgroLife: prijavljivanje na sistem\n', function() {
20
21   test.it('prijavna forma ispravno popunjena', function() {
22		driver.get('http://localhost:3000')
23		//driver.get('http://agrolife.greensoft.co:3000')
24		.then(_ => driver.findElement(By.id("textfield-1011-inputEl")).sendKeys("Miodrag"))
25		.then(_ => driver.findElement(By.id("textfield-1012-inputEl")).sendKeys("Miodrag"))
26		.then(_ => driver.findElement(By.id("textfield-1013-inputEl")).sendKeys("1243!"))
27		.then(_ => driver.wait(until.elementLocated(By.id('button-1015-btnIconEl')), 2000).click())	
28		});
29		
30	test.it('Prijava na sistem uspesna', function(){
31		driver.wait(until.elementLocated(By.id('button-1230-btnIconEl')), 90000);
32		});
33    
34	});
35
36/* -------------------------------------------------------------------------- */
37
38 test.describe('Materijali-window', function() {
39     
40	 test.it('Otvaranje prozora materijali', function() {
41		driver.wait(until.elementLocated(By.id('button-1243-btnIconEl')), 1000)
42        .then(_ => driver.findElement(By.id('button-1243-btnIconEl')).click())
43		.then(_ => driver.findElement(By.id('menuitem-1247-itemEl')).click())
44    
45     });
46 });
47
48
49 test.describe('Unos grupe/podgrupe/materijal', function(){
50	 
51     test.it('Ispravni podaci grupe', function(){
52        
53		//Materijali grupa
54		
55		driver.wait(until.elementLocated(By.id('tab-1466-btnEl')), 10000).click()
56		
57        // Materijali-grupa/forma
58
59        .then(_ => driver.findElement(By.id('textfield-1417-inputEl')).sendKeys('Maja grupa'))
60        .then(_ => driver.findElement(By.id('textfield-1418-inputEl')).sendKeys('Maja ikonica'))
61        .then(_ => driver.findElement(By.id('textfield-1419-inputEl')).sendKeys('Maja priotitet'))
62        //.then(_ => driver.findElement(By.id('ext-gen5431')).click())
63		
64		 test.it('Korisnik dodao grupu materijala', function(){
65		   driver.wait(until.elementLocated(By.id('button-1424-btnInnerEl')), 5000).click();
66	   });
67	  
68
69     });
70
71    test.it('Ispravni podaci podgrupe', function(){
72
73        //Materijali-podgrupa/forma
74		
75		driver.wait(until.elementLocated(By.id('tab-1467-btnIconEl')),10000).click()
76      
77       .then(_ => driver.findElement(By.id('combo-1453-inputEl')).sendKeys('Maja grupa'))
78       .then(_ => driver.findElement(By.id('textfield-1454-inputEl')).sendKeys('maja podgrupa'))
79       .then(_ => driver.findElement(By.id('textfield-1455-inputEl')).sendKeys('majina ikona'))
80       .then(_ => driver.findElement(By.id('textfield-1456-inputEl')).sendKeys('5'))
81       .then(_ => driver.findElement(By.id('ext-gen5343')).click())
82       
83       //Dodaj
84
85       test.it('Korisnik dodao podgrupu materijala', function(){
86		   driver.wait(until.elementLocated(By.id('button-1461-btnIconEl')), 5000).click();
87	   });
88	  
89       
90	   //Sacuvaj izmene
91
92       //Brisanje
93
94     });
95
96     test.it('Ispravni podaci materijal', function(){
97
98        driver.wait(until.elementLocated(By.id('tab-1465-btnIconEl')),10000).click()
99
100        // Materijali-forma
101
102        .then(_ => driver.findElement(By.id('textfield-1374-inputEl')).sendKeys('789456'))
103        .then(_ => driver.findElement(By.id('textfield-1375-inputEl')).sendKeys('maja materijal'))
104        .then(_ => driver.findElement(By.id('numberfield-1376-inputEl')).sendKeys('100'))
105		.then(_ => driver.findElement(By.id('combo-1377-inputEl')).sendKeys('Goriva i maziva'))
106		.then(_ => driver.findElement(By.id('combo-1378-inputEl')).sendKeys('Gorivo'))
107		.then(_ => driver.findElement(By.id('combo-1379-inputEl')).sendKeys('Kelj'))
108		.then(_ => driver.findElement(By.id('textfield-1380-inputEl')).sendKeys('L'))
109		
110		test.it('Korisnik dodao materijal', function(){
111		   driver.wait(until.elementLocated(By.id('button-1385-btnIconEl')), 5000).click();
112        
113     });
114 });
115 
116});
117
118
119test.describe('Odjavljivanje iz aplikacije', function(){
120		
121		test.it('odjavljivanje uspesno', function(){
122			
123		// Odjava iz aplikacije
124		driver.findElement(By.id("button-1354-btnIconEl")).click()
125		.then(_ => driver.findElement(By.id("button-1005-btnIconEl")).click())
126		})
127		
128		test.it('Izlazak iz browsera', function(){
129			
130		// Zatvaranje browsera 
131		driver.quit();
132		})
133		
134	})
Full Screen

index.test.js

Source: index.test.js Github

copy
1/* global describe, before, beforeEach, afterEach, it, browser, element, by, protractor */
2import { expect, config } from './globals';
3
4const EC = protractor.ExpectedConditions;
5browser.ignoreSynchronization = true;
6
7describe('Index page', () => {
8  const videoContainer = '.video-container';
9  const greenBtnClass = '.btn.btn-green';
10  const contactPopupEl = element(by.id('modal-contact'));
11  const contactPopupCloseEl = contactPopupEl.element(by.css('.close-modal'));
12
13  before(() => {
14    browser.get('');
15  });
16
17  it('should have title as \'Tactical Mastery Flashlights\'', () => {
18    expect(browser.getTitle()).to.eventually.equal('Tactical Mastery Flashlights');
19  });
20
21  describe('Contact modal - open', () => {
22    afterEach(() => {
23      contactPopupCloseEl.click();
24      browser.wait(EC.invisibilityOf(contactPopupEl), 1000);
25    });
26
27    it('should open contact popup when click on \'Yes! I want 75% Off!\' green button.', () => {
28      const buttonEl = element(by.cssContainingText(greenBtnClass, 'Yes! I want 75% Off!'));
29      browser.wait(EC.visibilityOf(buttonEl));
30      buttonEl.click();
31      browser.sleep(1000);
32      expect(contactPopupEl.isDisplayed()).to.eventually.equal(true);
33    });
34
35    if (config.capabilities.browserName === 'phantomjs') {
36      // console.warn('It can\'t test video on phantomjs.');
37    } else {
38      it('should open contact popup when click on \'Click Here\' of hero video', () => {
39        const buttonId = 'wistia_22_midrollLink_link';
40        const buttonEl = element(by.css(videoContainer)).element(by.id(buttonId));
41        browser.wait(EC.visibilityOf(buttonEl), 300000);
42        buttonEl.click();
43        browser.sleep(1000);
44        expect(contactPopupEl.isDisplayed()).to.eventually.equal(true);
45      });
46
47      it.skip('should open contact popup when the hero video ends', () => 'pending');
48    }
49  });
50
51  describe('Contact modal - validate', () => {
52    const buttonYesEl = element(by.cssContainingText('.btn.btn-danger', 'YES!'));
53    const nameEl = element(by.name('contactModalName'));
54    const emailEl = element(by.name('email'));
55    const phoneEl = element(by.name('phoneNumber'));
56    const nameGroupEl = element(by.css('.form-group-name'));
57    const emailGroupEl = element(by.css('.form-group-email'));
58    const phoneGroupEl = element(by.css('.form-group-phone'));
59
60    before(() => {
61      const buttonEl = element(by.cssContainingText(greenBtnClass, 'Yes! I want 75% Off!'));
62
63      browser.wait(EC.elementToBeClickable(buttonEl), 1000);
64      buttonEl.click();
65
66      browser.wait(EC.visibilityOf(contactPopupEl), 1000);
67    });
68
69    describe('Name field', () => {
70      const emptyValidator = nameGroupEl.element(by.cssContainingText('.form-control-feedback', 'Please enter your name.'));
71      const lengthValidator = nameGroupEl.element(by.cssContainingText('.form-control-feedback', 'The name must be more than 1 and less than 100'));
72      const rightValidator = nameGroupEl.element(by.cssContainingText('.valid-message.text-success', 'Nice to meet you!'));
73
74      beforeEach(() => {
75        nameEl.clear();
76      });
77
78      it('should validate name when input \'\'', () => {
79        nameEl.sendKeys('');
80        buttonYesEl.click();
81        browser.sleep(1000);
82        expect(emptyValidator.isDisplayed()).to.eventually.equal(true);
83      });
84
85      it('should validate name when input long length string greater than 100', () => {
86        let longName = '0';
87        for (let i = 0, end = 100; i < end; i += 1) {
88          longName = `0${longName}`;
89        }
90        nameEl.sendKeys(longName);
91        expect(lengthValidator.isDisplayed()).to.eventually.equal(true);
92      });
93
94      it('should validate name when input \'OK\'', () => {
95        nameEl.sendKeys('OK');
96        expect(rightValidator.isDisplayed()).to.eventually.equal(true);
97      });
98    });
99
100    describe('Email field', () => {
101      const emptyValidator = emailGroupEl.element(by.cssContainingText('.form-control-feedback', 'The email address is required.'));
102      const formatValidator = emailGroupEl.element(by.cssContainingText('.form-control-feedback', 'The email address is not valid.'));
103      const lengthValidator = emailGroupEl.element(by.cssContainingText('.form-control-feedback', 'The email address must be more than 6 and less than 30'));
104      const rightValidator = emailGroupEl.element(by.cssContainingText('.valid-message.text-success', 'Great!'));
105
106      beforeEach(() => {
107        emailEl.clear();
108      });
109
110      it('should validate email when input \'\'', () => {
111        emailEl.sendKeys('');
112        buttonYesEl.click();
113        browser.sleep(1000);
114        expect(emptyValidator.isDisplayed()).to.eventually.equal(true);
115      });
116
117      it('should validate email when input \'wrong\'', () => {
118        emailEl.sendKeys('wrong');
119        expect(formatValidator.isDisplayed()).to.eventually.equal(true);
120      });
121
122      it.skip('should validate email when input \'[email protected]\'', () => {
123        emailEl.sendKeys('[email protected]');
124        expect(formatValidator.isDisplayed()).to.eventually.equal(true);
125      });
126
127      it('should validate email when input \'[email protected]\'', () => {
128        emailEl.sendKeys('[email protected]');
129        expect(formatValidator.isDisplayed()).to.eventually.equal(true);
130      });
131
132      it('should validate email when input \'[email protected]\'', () => {
133        emailEl.sendKeys('[email protected]');
134        expect(lengthValidator.isDisplayed()).to.eventually.equal(true);
135      });
136
137      it('should validate email when input long \'[email protected]\'', () => {
138        emailEl.sendKeys('[email protected]');
139        expect(lengthValidator.isDisplayed()).to.eventually.equal(true);
140      });
141
142      it('should validate email when input \'[email protected]\'', () => {
143        emailEl.sendKeys('[email protected]');
144        expect(rightValidator.isDisplayed()).to.eventually.equal(true);
145      });
146    });
147
148    describe('Phone field', () => {
149      const emptyValidator = phoneGroupEl.element(by.cssContainingText('.form-control-feedback', 'Please supply a phone number'));
150      const formatValidator = phoneGroupEl.element(by.cssContainingText('.form-control-feedback', 'Not a valid 10-digit US phone number'));
151      const rightValidator = phoneGroupEl.element(by.cssContainingText('.valid-message.text-success', 'Success!'));
152
153      beforeEach(() => {
154        phoneEl.clear();
155      });
156
157      it('should validate phone number when input \'\'', () => {
158        phoneEl.sendKeys('');
159        buttonYesEl.click();
160        browser.sleep(1000);
161        expect(emptyValidator.isDisplayed()).to.eventually.equal(true);
162      });
163
164      it('should validate phone number when input single letter \'a\'', () => {
165        phoneEl.sendKeys('a');
166        expect(emptyValidator.isDisplayed()).to.eventually.equal(true);
167      });
168
169      it('should validate phone number when input letters \'test phone number\'', () => {
170        phoneEl.sendKeys('test phone number');
171        expect(emptyValidator.isDisplayed()).to.eventually.equal(true);
172      });
173
174      it('should validate phone number when input short digits \'12345\'', () => {
175        phoneEl.sendKeys('12345');
176        expect(formatValidator.isDisplayed()).to.eventually.equal(true);
177      });
178
179      it('should trim 10 digits and validate phone number when input long digits \'00001111222233334444\'', () => {
180        phoneEl.sendKeys('00001111222233334444');
181        expect(rightValidator.isDisplayed()).to.eventually.equal(true);
182      });
183
184      it('should filter digits and validate phone number when input complex string \'000 a111 222b cc333\'', () => {
185        phoneEl.sendKeys('000 a111 222b cc333');
186        expect(rightValidator.isDisplayed()).to.eventually.equal(true);
187      });
188    });
189  });
190});
191
Full Screen

caretware.scenario.js

Source: caretware.scenario.js Github

copy
1'use strict';
2
3/* global browser, element, expect */
4
5var params = browser.params.scenarios;
6// Iterate through available test parameters
7for (var p in params) {
8  if (params.hasOwnProperty(p)) {
9    var param = params[p];
10
11    // IIFE needed because the async nature of e2e protractor tests
12    (function(param) {
13      // E2E tests // START
14      describe('caret aware ' + param.type, function() {
15        var el,
16            attrVal = 'cursor',
17            UP_KEY = param.type === 'input' ?
18                protractor.Key.UP :
19                protractor.Key.PAGE_UP,
20            DOWN_KEY = param.type === 'input' ?
21                protractor.Key.DOWN :
22                protractor.Key.PAGE_DOWN;
23
24        beforeEach(function() {
25          browser.get(param.page);
26          el = element(by.id(param.id));
27        });
28
29        it('should have directive attribute with "' + attrVal + '" value', function() {
30          el.getAttribute('data-caret-aware').then(function(attr) {
31            expect(typeof attr).toBe('string');
32            expect(attr).toEqual(attrVal);
33          });
34        });
35
36        it('should caret have to be initialized to 0 and not movable', function() {
37          el.evaluate(attrVal).then(function(pos) {
38            expect(pos).toEqual(0);
39            el.sendKeys(protractor.Key.END);
40
41            el.evaluate(attrVal).then(function(pos) {
42              expect(pos).toEqual(0);
43              el.sendKeys(protractor.Key.UP);
44
45              el.evaluate(attrVal).then(function(pos) {
46                expect(pos).toEqual(0);
47              });
48            });
49          });
50        });
51
52        describe('should track caret position when movement keys are used', function() {
53          var text;
54          beforeEach(function() {
55            text = param.text;
56            el.sendKeys(text);
57          });
58
59          it('should move caret to the start when UP KEY is used', function() {
60            if (browser.name === 'firefox' && param.type === 'input') {
61              // NOTE: skipped // FIXME: what firefox want?
62            } else {
63              el.sendKeys(UP_KEY);
64              el.evaluate(attrVal).then(function(pos) {
65                expect(pos).toEqual(0);
66              });
67            }
68          });
69
70          it('should move caret to the end when DOWN KEY is used', function() {
71            el.sendKeys(UP_KEY);
72            el.sendKeys(DOWN_KEY);
73            el.evaluate(attrVal).then(function(pos) {
74              expect(pos).toEqual(text.length);
75            });
76          });
77
78          it('should decrement caret when ARROW LEFT is used', function() {
79            el.sendKeys(protractor.Key.ARROW_LEFT);
80            el.evaluate(attrVal).then(function(pos) {
81              expect(pos).toEqual(text.length - 1);
82            });
83          });
84
85          it('should decrement caret when LEFT is used', function() {
86            el.sendKeys(protractor.Key.LEFT);
87            el.evaluate(attrVal).then(function(pos) {
88              expect(pos).toEqual(text.length - 1);
89            });
90          });
91
92          it('should decrement caret when ARROW RIGHT is used', function() {
93            el.sendKeys(protractor.Key.ARROW_LEFT);
94            el.sendKeys(protractor.Key.ARROW_RIGHT);
95            el.evaluate(attrVal).then(function(pos) {
96              expect(pos).toEqual(text.length);
97            });
98          });
99
100          it('should decrement caret when RIGHT is used', function() {
101            el.sendKeys(protractor.Key.LEFT);
102            el.sendKeys(protractor.Key.RIGHT);
103            el.evaluate(attrVal).then(function(pos) {
104              expect(pos).toEqual(text.length);
105            });
106          });
107
108          it('should stop caret when at maximum right position', function() {
109            el.sendKeys(DOWN_KEY);
110            el.evaluate(attrVal).then(function(pos) {
111              expect(pos).toEqual(text.length);
112              el.sendKeys(DOWN_KEY);
113              el.evaluate(attrVal).then(function(pos) {
114                expect(pos).toEqual(text.length);
115              });
116            });
117          });
118
119          it('should stop caret when at minimum left position', function() {
120            if (browser.name === 'firefox' && param.type === 'input') {
121              // NOTE: skipped // FIXME: what firefox want?
122            } else {
123              el.sendKeys(UP_KEY);
124              el.evaluate(attrVal).then(function(pos) {
125                expect(pos).toEqual(0);
126                el.sendKeys(UP_KEY);
127                el.evaluate(attrVal).then(function(pos) {
128                  expect(pos).toEqual(0);
129                });
130              });
131            }
132          });
133        });
134
135        describe('should track caret position when input changes', function() {
136          var text;
137          beforeEach(function() {
138            text = param.text;
139            el.sendKeys(text);
140          });
141
142          it('should move caret forward when text is inserted', function() {
143            el.evaluate(attrVal).then(function(pos) {
144              expect(pos).toEqual(text.length);
145            });
146          });
147
148          it('should move caret backward when text is deleted with backspace', function() {
149            var numToCancel = 2,
150                i = numToCancel;
151            while (i-- > 0) {
152              el.sendKeys(protractor.Key.BACK_SPACE);
153            }
154            el.evaluate(attrVal).then(function(pos) {
155              expect(pos).toEqual(text.length - numToCancel);
156            });
157          });
158
159          it('should keep the caret fixed when text is deleted with canc', function() {
160            if (browser.name === 'firefox' && param.type === 'input') {
161              // NOTE: skipped // FIXME: what firefox want?
162            } else {
163              el.sendKeys(UP_KEY);
164              el.sendKeys(protractor.Key.DELETE);
165              el.evaluate(attrVal).then(function(pos) {
166                expect(pos).toEqual(0);
167              });
168            }
169          });
170
171          it('should move caret forwar when text is prepended', function() {
172            if (browser.name === 'firefox' && param.type === 'input') {
173              // NOTE: skipped // FIXME: what firefox want?
174            } else {
175              var pre = 'pre';
176              el.sendKeys(UP_KEY);
177              el.sendKeys(pre);
178              el.evaluate(attrVal).then(function(pos) {
179                expect(pos).toEqual(pre.length);
180              });
181            }
182          });
183        });
184
185        describe('should track caret positions when the text of the element is selected', function() {
186          var text,
187              selectionBtn,
188              selectionRes;
189          beforeEach(function() {
190            selectionBtn = element(by.buttonText('print selection'));
191            selectionRes = element(by.id('selection'));
192            text = param.text;
193            el.sendKeys(text);
194          });
195
196          it('should correctly retrieve selection info when text is selected through SHIFT + ARROW LEFT', function() {
197            var arrows = 4,
198                resultingStart = text.length - arrows;
199            // Cursor is at the end, select RTL: KEYDOWN W/ SHIFT + ARROW_LEFT(s) + KEYUP W/ SHIFT
200            browser
201                .actions()
202                .keyDown(protractor.Key.SHIFT)
203                .sendKeys(Array(arrows + 1).join(protractor.Key.ARROW_LEFT))
204                .keyUp(protractor.Key.SHIFT)
205                .perform();
206            // Check resulting start pos
207            el.evaluate(attrVal).then(function(pos) {
208              expect(pos).toEqual(resultingStart);
209            });
210            // Check selection info
211            browser.actions().click(selectionBtn).perform();
212            selectionRes.getText().then(function(content) {
213              expect(JSON.parse(content)).toEqual({
214                start: resultingStart,
215                end: text.length,
216                length: arrows,
217                text: text.substr(resultingStart, arrows)
218              });
219            });
220          });
221
222          it('should correctly retrieve selection info when text is selected through SHIFT + ARROW RIGHT', function() {
223            if (browser.name === 'firefox' && param.type === 'input') {
224              // NOTE: skipped // FIXME: what firefox want?
225            } else {
226              var arrows = 4,
227                  resultingEnd = arrows;
228              el.sendKeys(UP_KEY);
229              // Cursor is at the 0, select LTR: KEYDOWN W/ SHIFT + ARROW_RIGHT(s) + KEYUP W/ SHIFT
230              browser
231                  .actions()
232                  .keyDown(protractor.Key.SHIFT)
233                  .sendKeys(Array(arrows + 1).join(protractor.Key.ARROW_RIGHT))
234                  .keyUp(protractor.Key.SHIFT)
235                  .perform();
236              // Check start pos
237              el.evaluate(attrVal).then(function(pos) {
238                expect(pos).toEqual(0);
239              });
240              // Check selection info
241              browser.actions().click(selectionBtn).perform();
242              selectionRes.getText().then(function(content) {
243                expect(JSON.parse(content)).toEqual({
244                  start: 0,
245                  end: resultingEnd,
246                  length: arrows,
247                  text: text.substr(0, resultingEnd)
248                });
249              });
250            }
251          });
252
253          it('should correctly handle CTRL + A', function() {
254            el.sendKeys(protractor.Key.chord(protractor.Key.CONTROL, 'a'));
255            el.evaluate(attrVal).then(function(pos) {
256              expect(pos).toEqual(0);
257            });
258            // Check selection info
259            browser.actions().click(selectionBtn).perform();
260            selectionRes.getText().then(function(content) {
261              expect(JSON.parse(content)).toEqual({
262                start: 0,
263                end: text.length,
264                length: text.length,
265                text: text
266              });
267            });
268          });
269
270          it('should allow to click when content is selected and update caret position', function() {
271            if (browser.name === 'firefox') {
272              // NOTE: skipped // FIXME: what firefox want?
273            } else {
274              var wantedPos = 1;
275              var factor = param.type === 'input' ? 7.5 : 10;
276              browser
277                  .actions()
278                  .keyDown(protractor.Key.SHIFT)
279                  .sendKeys(Array(text.length + 1).join(protractor.Key.ARROW_LEFT))
280                  .keyUp(protractor.Key.SHIFT)
281                  .perform();
282              //
283              el.evaluate(attrVal).then(function(pos) {
284                expect(pos).toEqual(0);
285                // Now click at (factor * wantedPos, 15) pixels offset from top left
286                // (i.e., aproximately after third character)
287                browser
288                    .actions()
289                    .mouseMove(el, { x: factor * wantedPos, y: 15 })
290                    .click()
291                    .perform();
292                // Verify
293                el.evaluate(attrVal).then(function(pos) {
294                  expect(pos).toEqual(wantedPos);
295                });
296                browser.actions().click(selectionBtn).perform();
297                selectionRes.getText().then(function(content) {
298                  expect(JSON.parse(content)).toEqual({
299                    start: wantedPos,
300                    end: wantedPos,
301                    length: 0,
302                    text: ''
303                  });
304                });
305              });
306            }
307          });
308        });
309
310        describe('should track caret position when element is clicked', function() {
311          var text,
312              factor = param.type === 'input' ? 7.5 : 10;
313          beforeEach(function() {
314            text = param.text;
315            el.sendKeys(text);
316          });
317
318          it('should work when element is clicked at the start', function() {
319            if (browser.name === 'firefox') {
320              // NOTE: skipped // FIXME: what firefox want?
321            } else {
322              var startPos = 0;
323              browser
324                  .actions()
325                  .mouseMove(el, { x: factor * startPos, y: 15})
326                  .click()
327                  .perform();
328              el.evaluate(attrVal).then(function(pos) {
329                expect(pos).toEqual(0);
330              });
331            }
332          });
333
334          it('should work when element is clicked at the end', function() {
335            var endPos = text.length;
336            var nlines = text.split(/\n/).length;
337            var y = nlines > 0 ? nlines * 15 : 15;
338            browser
339                .actions()
340                .mouseMove(el, { x: factor * endPos, y: y})
341                .click()
342                .perform();
343            el.evaluate(attrVal).then(function(pos) {
344              expect(pos).toEqual(endPos);
345            });
346          });
347        });
348      });
349      // E2E tests // END
350    })(param);
351
352  }
353}
354
355
356
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Run JavaScript Tests on LambdaTest Cloud Grid

Execute automation tests with Appium Xcuitest Driver on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)