How to use client.findElement method in Appium

Best JavaScript code snippet using appium

keypad_test.js

Source:keypad_test.js Github

copy

Full Screen

...13 actions = client.loader.getActions();14 subject = new Dialer(client);15 subject.launch();16 selectors = Dialer.Selectors;17 var keypad = subject.client.findElement(selectors.keypadView);18 client.waitFor(function() {19 return keypad.displayed();20 });21 reflowHelper = new ReflowHelper(client);22 });23 function typeNumber() {24 var one = subject.client.findElement(selectors.one);25 keypadTap(one);26 var two = subject.client.findElement(selectors.two);27 keypadTap(two);28 var three = subject.client.findElement(selectors.three);29 keypadTap(three);30 }31 // Taps digits in 1, 2, 3 sequence until producing an ellipsis. We make this32 // instead of entering fixed number as the digit at which the ellipsis33 // appears depends on the integration environment.34 function typeLongNumber() {35 var number = subject.client.findElement(selectors.phoneNumber);36 var numberTyped = '';37 var one = subject.client.findElement(selectors.one);38 var two = subject.client.findElement(selectors.two);39 var three = subject.client.findElement(selectors.three);40 var sequence = [one, two, three];41 var length = sequence.length;42 for (var i = 0, digit; (digit = sequence[i]); i = (i+1) % length) {43 keypadTap(digit);44 numberTyped += digit.getAttribute('data-value');45 if (number.getAttribute('value').indexOf('\u2026') === 0) {46 return numberTyped;47 }48 }49 }50 // Avoid "all the same number" patterns like 111111... because, under51 // ellipsis scenaries, the value of the input won't change and the test52 // will timeout.53 function keypadTap(elem, longPress) {54 var number = subject.client.findElement(selectors.phoneNumber);55 var previousValue = number.getAttribute('value');56 if (longPress) {57 actions.longPress(elem, 1).perform();58 } else {59 actions.tap(elem).perform();60 }61 client.waitFor(function () {62 return number.getAttribute('value') !== previousValue;63 });64 }65 function loadSuggestionDOM() {66 typeNumber();67 var del = subject.client.findElement(selectors.del);68 actions.longPress(del, 1).perform();69 var number = subject.client.findElement(selectors.phoneNumber);70 client.waitFor(function() {71 return (number.getAttribute('value') === '');72 });73 }74 test('Entering a 3 digits number with the keypad', function() {75 loadSuggestionDOM();76 reflowHelper.startTracking(Dialer.URL + '/manifest.webapp');77 typeNumber();78 var number = subject.client.findElement(selectors.phoneNumber);79 assert.equal(number.getAttribute('value'), '123');80 var reflowCount = reflowHelper.getCount();81 assert.equal(reflowCount, 3);82 reflowHelper.stopTracking();83 });84 test('Entering a digit in the middle of the number', function() {85 typeNumber();86 var number = subject.client.findElement(selectors.phoneNumber);87 number.scriptWith(function (numberElement) {88 numberElement.selectionStart = numberElement.selectionEnd = 1;89 numberElement.click();90 });91 var zero = subject.client.findElement(selectors.zero);92 keypadTap(zero);93 assert.equal(number.getAttribute('value'), '1023');94 });95 test('Replace a selection in the middle of the number', function() {96 typeNumber();97 var number = subject.client.findElement(selectors.phoneNumber);98 number.scriptWith(function (numberElement) {99 numberElement.selectionStart = 1;100 numberElement.selectionEnd = 2;101 numberElement.click();102 });103 var zero = subject.client.findElement(selectors.zero);104 keypadTap(zero);105 assert.equal(number.getAttribute('value'), '103');106 });107 test('Replace a selection in the middle of the number with a long press',108 function() {109 typeNumber();110 var number = subject.client.findElement(selectors.phoneNumber);111 number.scriptWith(function (numberElement) {112 numberElement.selectionStart = 1;113 numberElement.selectionEnd = 2;114 numberElement.click();115 });116 var zero = subject.client.findElement(selectors.zero);117 keypadTap(zero, true);118 assert.equal(number.getAttribute('value'), '1+3');119 });120 test('Entering a long press in the middle of the number', function() {121 typeNumber();122 var number = subject.client.findElement(selectors.phoneNumber);123 number.scriptWith(function (numberElement) {124 numberElement.selectionStart = numberElement.selectionEnd = 1;125 numberElement.click();126 });127 var zero = subject.client.findElement(selectors.zero);128 keypadTap(zero, true);129 assert.equal(number.getAttribute('value'), '1+23');130 });131 test('Entering a digit in the middle of a long number', function() {132 var insPosition = 3; // index where the cursor would be placed by the user133 var realInsPosition = insPosition + 2; // index inside the complete number134 // +2 for the space of the ellipsis135 var typedNumber = typeLongNumber();136 var numberAfterInsertion =137 typedNumber.substr(0, realInsPosition) + '0' +138 typedNumber.substr(realInsPosition);139 var expectedValueAfterInsertion =140 '\u2026' + numberAfterInsertion.substr(4); // 1 for the overflowing char,141 // 2 for the ellipsis itself,142 // 1 more for the new char.143 var number = subject.client.findElement(selectors.phoneNumber);144 var args = [number, insPosition];145 client.executeScript(function (numberElement, insPosition) {146 numberElement.selectionStart = numberElement.selectionEnd = insPosition;147 numberElement.click();148 }, args);149 var zero = subject.client.findElement(selectors.zero);150 keypadTap(zero);151 assert.equal(number.getAttribute('value'), expectedValueAfterInsertion);152 });153 test('Entering a long press in the middle of a long number', function() {154 var insPosition = 3; // index where the cursor would be placed by the user155 var realInsPosition = insPosition + 2; // index inside the complete number156 // +2 for the space of the ellipsis157 var typedNumber = typeLongNumber();158 var numberAfterInsertion =159 typedNumber.substr(0, realInsPosition) + '+' +160 typedNumber.substr(realInsPosition);161 var expectedValueAfterInsertion =162 '\u2026' + numberAfterInsertion.substr(4); // 1 for the overflowing char,163 // 2 for the ellipsis itself,164 // 1 more for the new char.165 var number = subject.client.findElement(selectors.phoneNumber);166 var args = [number, insPosition];167 client.executeScript(function (numberElement, insPosition) {168 numberElement.selectionStart = numberElement.selectionEnd = insPosition;169 numberElement.click();170 }, args);171 var zero = subject.client.findElement(selectors.zero);172 keypadTap(zero, true);173 assert.equal(number.getAttribute('value'), expectedValueAfterInsertion);174 });175 test('Using the special extention key', function() {176 var zero = subject.client.findElement(selectors.zero);177 var number = subject.client.findElement(selectors.phoneNumber);178 keypadTap(zero, true);179 assert.equal(number.getAttribute('value'), '+');180 keypadTap(zero, false);181 assert.equal(number.getAttribute('value'), '+0');182 });183 test('Deleting a digit', function() {184 typeNumber();185 var del = subject.client.findElement(selectors.del);186 actions.tap(del).perform();187 var number = subject.client.findElement(selectors.phoneNumber);188 client.waitFor(function() {189 return (number.getAttribute('value').length == 2);190 });191 assert.equal(number.getAttribute('value'), '12');192 });193 test('Deleting a digit in the middle of the number', function() {194 typeNumber();195 var number = subject.client.findElement(selectors.phoneNumber);196 number.scriptWith(function (numberElement) {197 numberElement.selectionStart = numberElement.selectionEnd = 2;198 numberElement.click();199 });200 var del = subject.client.findElement(selectors.del);201 actions.tap(del).perform();202 client.waitFor(function() {203 return (number.getAttribute('value').length == 2);204 });205 assert.equal(number.getAttribute('value'), '13');206 });207 test('Deleting a digit in the middle of a long number', function() {208 var delPosition = 3; // index where the cursor would be placed by the user209 var realDelPosition = delPosition + 2; // index inside the complete number210 // +2 for the space of the ellipsis211 var typedNumber = typeLongNumber();212 var expectedNumberAfterDeletion =213 typedNumber.substr(0, realDelPosition - 1) +214 typedNumber.substr(realDelPosition);215 var number = subject.client.findElement(selectors.phoneNumber);216 var args = [number, delPosition];217 client.executeScript(function (numberElement, delPosition) {218 numberElement.selectionStart = numberElement.selectionEnd = delPosition;219 numberElement.click();220 }, args);221 var del = subject.client.findElement(selectors.del);222 actions.tap(del).perform();223 client.waitFor(function() {224 return (number.getAttribute('value') == expectedNumberAfterDeletion);225 });226 assert.ok(true);227 });228 test('Deleting a couple of digits in the middle of the number', function() {229 typeNumber();230 var number = subject.client.findElement(selectors.phoneNumber);231 number.scriptWith(function (numberElement) {232 numberElement.selectionStart = numberElement.selectionEnd = 2;233 numberElement.click();234 });235 var del = subject.client.findElement(selectors.del);236 actions.doubleTap(del).perform();237 assert.equal(number.getAttribute('value'), '3');238 });239 test('Clearing the number partially by long pressing the delete key',240 function() {241 typeNumber();242 var number = subject.client.findElement(selectors.phoneNumber);243 number.scriptWith(function (numberElement) {244 numberElement.selectionStart = numberElement.selectionEnd = 2;245 numberElement.click();246 });247 var del = subject.client.findElement(selectors.del);248 actions.longPress(del, 1).perform();249 client.waitFor(function() {250 return (number.getAttribute('value') === '3');251 });252 assert.ok(true, 'cleaned the phone number view');253 });...

Full Screen

Full Screen

gallery.js

Source:gallery.js Github

copy

Full Screen

...50 /**51 * @return {Marionette.Element} First element of all thumbnail images.52 */53 get thumbnail() {54 return this.client.findElement(Gallery.Selector.thumbnail);55 },56 /**57 * @return {Marionette.Element} List of elements of thumbnail images.58 */59 get thumbnails() {60 return this.client.findElements(Gallery.Selector.thumbnail);61 },62 /**63 * @return {Marionette.Element} Container for fullscreen view of an image.64 */65 get fullscreenView() {66 return this.client.findElement(Gallery.Selector.fullscreenView);67 },68 /**69 * @return {Marionette.Element} Container for thumbnails list view.70 */71 get thumbnailsView() {72 return this.client.findElement(Gallery.Selector.thumbnailsView);73 },74 /**75 * @return {Marionette.Element} Container for different overlay messages.76 */77 get overlayView() {78 return this.client.findElement(Gallery.Selector.overlayView);79 },80 /**81 * @return {Marionette.Element} Element to click to get back to thumbnail view82 */83 get fullscreenBackButton() {84 return this.client.findElement(Gallery.Selector.fullscreenBackButton);85 },86 /**87 * @return {Marionette.Element} Element to click to select thumbnails.88 */89 get thumbnailsSelectButton() {90 return this.client.findElement(Gallery.Selector.thumbnailsSelectButton);91 },92 /**93 * @return {Marionette.Element} Element to click to delete images.94 */95 get thumbnailsDeleteButton() {96 return this.client.findElement(Gallery.Selector.thumbnailsDeleteButton);97 },98 /**99 * @return {Marionette.Element} Element to click to confirm the delete dialog.100 */101 get confirmButton() {102 return this.client.findElement(Gallery.Selector.confirmButton);103 },104 /**105 * @return {Marionette.Element} Element to click for image editing mode.106 */107 get editButton() {108 return this.client.findElement(Gallery.Selector.editButton);109 },110 /**111 * @return {Marionette.Element} Element to click for effects editing mode.112 */113 get editEffectButton() {114 return this.client.findElement(Gallery.Selector.editEffectButton);115 },116 /**117 * @return {Marionette.Element} Element to click for enhance editing mode.118 */119 get editEnhanceButton() {120 return this.client.findElement(Gallery.Selector.editEnhanceButton);121 },122 /**123 * @return {Marionette.Element} Element to click for the exposure editing mode124 */125 get editExposureButton() {126 return this.client.findElement(Gallery.Selector.editExposureButton);127 },128 /**129 * @return {Marionette.Element} Element to click for crop editing mode.130 */131 get editCropButton() {132 return this.client.findElement(Gallery.Selector.editCropButton);133 },134 /**135 * @return {Marionette.Element} Container to host the exposure options' tab.136 */137 get exposureOptions() {138 return this.client.findElement(Gallery.Selector.exposureOptions);139 },140 /**141 * @return {Marionette.Element} Container to host the crop options' tab.142 */143 get cropOptions() {144 return this.client.findElement(Gallery.Selector.cropOptions);145 },146 /**147 * @return {Marionette.Element} Container to host the effect options' tab.148 */149 get effectOptions() {150 return this.client.findElement(Gallery.Selector.effectOptions);151 },152 /**153 * @return {Marionette.Element} Container to host the enhance options' tab.154 */155 get enhanceOptions() {156 return this.client.findElement(Gallery.Selector.enhanceOptions);157 },158 /**159 * @return {Marionette.Element} Element to swipe to change exposure settings.160 */161 get exposureSlider() {162 return this.client.findElement(Gallery.Selector.exposureSlider);163 },164 /**165 * @return {Marionette.Element} Element to click to save changes from editing.166 */167 get editSaveButton() {168 return this.client.findElement(Gallery.Selector.editSaveButton);169 },170 /**171 * @return {Marionette.Element} Element to click to crop an image.172 */173 get editCropAspectPortraitButton() {174 return this.client175 .findElement(Gallery.Selector.editCropAspectPortraitButton);176 },177 /**178 * @return {Marionette.Element} Element to click to apply a sepia affect.179 */180 get editEffectSepiaButton() {181 return this.client.findElement(Gallery.Selector.editEffectSepiaButton);182 },183 /**184 * @return {Marionette.Element} Container element to host fullscreen images.185 */186 get fullscreenFrame2() {187 return this.client.findElement(Gallery.Selector.fullscreenFrame2);188 },189 /**190 * @return {Marionette.Element} Container element to host fullscreen images.191 */192 get fullscreenFrame3() {193 return this.client.findElement(Gallery.Selector.fullscreenFrame3);194 },195 /**196 * @return {boolean} Whether or not the thumbnail view is in list mode.197 */198 isThumbnailListViewVisible: function() {199 var elementClass = this.client200 .findElement('#thumbnails')201 .getAttribute('class');202 return elementClass == 'list';203 },204 /**205 * Read the translateX style and return its integer value.206 */207 getFrameTranslation: function(frame) {...

Full Screen

Full Screen

default_activity_test.js

Source:default_activity_test.js Github

copy

Full Screen

...45 test('Default Activity chosen >', function() {46 client.apps.launch(CALLER_APP);47 // Try to launch CALLEE from CALLER48 client.apps.switchToApp(CALLER_APP);49 client.findElement('#testdefaultactivity').click();50 client.switchToFrame();51 // Check that app choice appear, showing default activity checkbox52 var checkbox = client.findElement(setDefaultSelector);53 assert.ok(checkbox.displayed);54 // Activate 'Use as default' for the future55 checkbox.click();56 // Launch CALLEE from the selection57 var selector = '[data-manifest="' + CALLEE_APP + '/manifest.webapp"]';58 client.findElement(selector).click();59 client.switchToFrame();60 // Check that CALLEE is open61 assert.equal(getDisplayAppOrigin(), CALLEE_APP);62 client.apps.switchToApp(CALLEE_APP);63 assert.ok(client.findElement('#default-test').displayed());64 client.apps.close(CALLEE_APP);65 // Try to launch CALLEE from CALLER again66 client.apps.switchToApp(CALLER_APP);67 client.findElement('#testdefaultactivity').click();68 client.switchToFrame();69 // the app choice doesn't appear this time70 client.findElement(setDefaultSelector, function(err, element) {71 assert.equal(err.name, 'NoSuchElement', 'element not found');72 });73 // Check that CALLEE is open74 client.apps.switchToApp(CALLEE_APP);75 assert.ok(client.findElement('#default-test').displayed());76 });77 test('Default Activity ignored >', function() {78 client.apps.launch(CALLER_APP);79 // Try to launch CALLEE from CALLER80 client.apps.switchToApp(CALLER_APP);81 client.findElement('#testdefaultactivity').click();82 client.switchToFrame();83 // Check that app choice appear, showing default activity checkbox84 var checkbox = client.findElement(setDefaultSelector);85 assert.ok(checkbox.displayed);86 // Don't activate 'Use as default'87 // Launch CALLEE from the selection88 var selector = '[data-manifest="' + CALLEE_APP + '/manifest.webapp"]';89 client.findElement(selector).click();90 // Check that CALLEE is open91 client.apps.switchToApp(CALLEE_APP);92 assert.ok(client.findElement('#default-test').displayed());93 client.apps.close(CALLEE_APP);94 client.switchToFrame();95 // Try to launch CALLEE from CALLER again96 client.apps.switchToApp(CALLER_APP);97 client.findElement('#testdefaultactivity').click();98 client.switchToFrame();99 // the app choice appears again100 checkbox = client.findElement(setDefaultSelector);101 assert.ok(checkbox.displayed);102 });103 test('Reset after new app is installed >', function() {104 client.apps.launch(CALLER_APP);105 // Try to launch CALLEE from CALLER106 client.apps.switchToApp(CALLER_APP);107 client.findElement('#testdefaultactivity').click();108 client.switchToFrame();109 // Check that app choice appear, showing default activity checkbox110 var checkbox = client.findElement(setDefaultSelector);111 assert.ok(checkbox.displayed);112 // Activate 'Use as default' for the future113 checkbox.click();114 // Launch CALLEE from the selection115 var selector = '[data-manifest="' + CALLEE_APP + '/manifest.webapp"]';116 client.findElement(selector).click();117 client.switchToFrame();118 // Check that CALLEE is open119 assert.equal(getDisplayAppOrigin(), CALLEE_APP);120 client.apps.switchToApp(CALLEE_APP);121 assert.ok(client.findElement('#default-test').displayed());122 client.apps.close(CALLEE_APP);123 // Try to launch CALLEE from CALLER again124 client.apps.switchToApp(CALLER_APP);125 client.findElement('#testdefaultactivity').click();126 client.switchToFrame();127 // the app choice doesn't appear this time128 client.findElement(setDefaultSelector, function(err, element) {129 assert.equal(err.name, 'NoSuchElement', 'element not found');130 });131 // Check that CALLEE is open132 client.apps.switchToApp(CALLEE_APP);133 assert.ok(client.findElement('#default-test').displayed());134 client.apps.close(CALLEE_APP);135 client.apps.close(CALLER_APP);136 // Now we install the new app (with same activity receiver)137 var serverManifestURL = server.url('manifest.webapp');138 appInstall.install(serverManifestURL);139 client.apps.launch(CALLER_APP);140 client.apps.switchToApp(CALLER_APP);141 client.findElement('#testdefaultactivity').click();142 client.switchToFrame();143 // Check that app choice appears again144 checkbox = client.findElement(setDefaultSelector);145 assert.ok(checkbox.displayed);146 });147 });...

Full Screen

Full Screen

pocket.js

Source:pocket.js Github

copy

Full Screen

...70 const SUBMIT_TEXT = 'Sign up'71 const PERMISSION_TEXT = 'Request for permission'72 // Wait for page load...73 waitForElement(client, '#fxa-signup-header')74 var headerText = client.findElement('#fxa-signup-header').text()75 var submitText = client.findElement('#submit-btn').text()76 expect(headerText).to.equal(HEADER_TEXT)77 expect(submitText).to.equal(SUBMIT_TEXT)78 client79 .findElement('.email')80 .sendKeys([email])81 client82 .findElement('#password')83 .sendKeys(['password'])84 client85 .findElement('.show-password-label')86 .click()87 client88 .findElement('#fxa-age-year')89 .sendKeys(['1990'])90 client91 .findElement('#submit-btn')92 .click()93 // Wait for page refresh...94 waitForElement(client, '#fxa-permissions-header')95 var permissionText = client.findElement('#fxa-permissions-header').text()96 expect(permissionText).to.equal(PERMISSION_TEXT)97 client98 .findElement('#accept')99 .click()100 // Wait for page refresh...101 waitForElement(client, '.verification-email-message')102 resolve()103 })104}105/**106 * Saves the specified URL to your Pocket list.107 * @param {Object} client Marionette client.108 * @param {String} url The URL to navigate to and save.109 * @return {undefined}110 */111function savePageToPocket (client, url) {112 // Navigate to the specified URL.113 client114 .goUrl(url)115 client116 .setContext('chrome');117 // Click the Pocket button.118 client119 .findElement(':root')120 .findElement('#pocket-button')121 .click()122 client123 .setContext('content')124}125/**126 * Checks your Pocket items for a specific saved URL.127 * @param {Object} client Marionette client.128 * @param {String} url A URL to check for.129 * @return {Boolean} Returns `true` if the specified URL was found, otherwise `false`.130 */131function checkPocketForPage (client, url) {132 client.goUrl(POCKET_QUEUE_URL)133 waitForElement(client, '.item')134 var itemLinks = client.findElements('.item_link')135 console.log('found %d saved item(s)', itemLinks.length)136 var hasLink = itemLinks.some(function (el, idx) {137 console.log('item %d => %s', idx, el.getAttribute('href'))138 return el.getAttribute('href') === url139 })140 expect(hasLink).to.be.true141 return hasLink142}143/**144 * Generates a random email address.145 * @param {String} domain The domain for the email address. Default: "restmail.net".146 * @return {String} A random email address with the format `test0.0000@restmail.net`, where "0.0000" is a random number.147 */148function randomEmail (domain) {149 domain = domain || 'restmail.net'150 return ('test' + Math.random() + '@' + domain).trim()151}152/**153 * Wrapper for `client.waitFor()`.154 * @param {Object} client Marionette client.155 * @param {String} el Selector for element to wait for.156 * @return {Object} The element.157 */158function waitForElement (client, el) {159 client.waitFor(function () {160 try {161 return client.findElement(el)162 } catch (err) {163 return false164 }165 })...

Full Screen

Full Screen

tc_main.js

Source:tc_main.js Github

copy

Full Screen

...22 searchClose:'#tc-appSearch [type="submit"]'23 },24 init: function() {25 this.launch();26 this.client.findElement('#menu-item-tc').tap();27 this.waitForPanelToDissapear(this.selectors.rootPanel);28 },29 // panels & sub-panels30 get appPanel() {31 return this.client.findElement(this.selectors.appPanel);32 },33 get appDetail() {34 return this.client.findElement(this.selectors.appDetail);35 },36 get permPanel() {37 return this.client.findElement(this.selectors.permPanel);38 },39 get permDetail() {40 return this.client.findElement(this.selectors.permDetail);41 },42 // panel transitions43 isAppDisplayed: function() {44 this.waitForPanelToDissapear(this.selectors.tcPanel);45 return this.appPanel.displayed();46 },47 isPermDisplayed: function() {48 this.waitForPanelToDissapear(this.selectors.tcPanel);49 return this.permPanel.displayed();50 },51 isAppDetailDisplayed: function() {52 if (this.appDetail.displayed()) {53 return true;54 }55 this.waitForPanelToDissapear(this.selectors.appPanel);56 return this.appDetail.displayed();57 },58 isPermDetailDisplayed: function() {59 if (this.permDetail.displayed()) {60 return true;61 }62 this.waitForPanelToDissapear(this.selectors.permPanel);63 return this.permDetail.displayed();64 },65 // UI actions66 tapOnAppMenuItem: function() {67 this.client.findElement('a[href="' + this.selectors.appPanel + '"]').tap();68 },69 tapOnPermMenuItem: function() {70 this.client.findElement('a[href="' + this.selectors.permPanel + '"]').tap();71 },72 tapOnAppEntryItem: function() {73 this.client.findElement(this.selectors.appEntry).tap();74 },75 tapOnPermEntryItem: function() {76 this.client.findElement(this.selectors.permEntry).tap();77 },78 tapOnAppDetailBack: function() {79 this.client.findElement(this.selectors.appBack).tap();80 this.waitForPanelToDissapear(this.selectors.appDetail);81 return this.appPanel.displayed();82 },83 sortApps: function(sortKey, selectorToFind) {84 var select = this.client.findElement(this.selectors.sortKey);85 this.tapSelectOption(select, sortKey);86 this.waitForElement(selectorToFind);87 },88 // search mode89 enterSearchMode: function() {90 this.client.findElement(this.selectors.searchInput).tap();91 var sortKey = this.client.findElement(this.selectors.sortKey);92 var closeBtn = this.client.findElement(this.selectors.searchClose);93 this.client.waitFor(function() {94 return closeBtn.displayed() && !sortKey.displayed();95 });96 },97 get searchPattern() {98 return this.client.findElement(this.selectors.searchInput).text();99 },100 sendSearchKeys: function(key) {101 this.client.findElement(this.selectors.searchInput).sendKeys(key);102 },103 clearSearch: function(key) {104 this.client.findElement(this.selectors.searchClear).tap();105 },106 leaveSearchMode: function() {107 this.client.findElement(this.selectors.searchClose).tap();108 var sortKey = this.client.findElement(this.selectors.sortKey);109 var closeBtn = this.client.findElement(this.selectors.searchClose);110 this.client.waitFor(function() {111 return !closeBtn.displayed() && sortKey.displayed();112 });113 },114 isSearchCloseDisplayed: function() {115 return this.client.findElement(this.selectors.searchClose).displayed();116 },117 isSortKeyDisplayed: function() {118 return this.client.findElement(this.selectors.sortKey).displayed();119 }...

Full Screen

Full Screen

rp_features.js

Source:rp_features.js Github

copy

Full Screen

...27 this.loadMainPanel();28 this.registerUser();29 },30 loadMainPanel: function() {31 this.client.findElement('#menu-item-rp').tap();32 this.waitForPanelToDissapear(this.selectors.rootPanel);33 },34 registerUser: function() {35 this.typeNewPassphrase('mypassword');36 this.waitForPanelToDissapear(this.selectors.rpPanel);37 },38 typeNewPassphrase: function(passphrase) {39 this.client.findElement(this.selectors.registerPass1).sendKeys(passphrase);40 this.client.findElement(this.selectors.registerPass2).sendKeys(passphrase);41 this.client.findElement(this.selectors.registerSubmit).tap();42 },43 isFeaturesPanelDisplayed: function() {44 return this.client.findElement(this.selectors.featuresPanel).displayed();45 },46 isAlertDisplayed: function() {47 return this.client.findElement(this.selectors.alert).displayed();48 },49 isLockChecked: function() {50 return this.client.findElement(this.selectors.lockInput)51 .getAttribute('checked');52 },53 isRingChecked: function() {54 return this.client.findElement(this.selectors.ringInput)55 .getAttribute('checked');56 },57 isLocateChecked: function() {58 return this.client.findElement(this.selectors.locateInput)59 .getAttribute('checked');60 },61 isLockEnabled: function() {62 return this.client.settings.get('rp.lock.enabled');63 },64 isRingEnabled: function() {65 return this.client.settings.get('rp.ring.enabled');66 },67 isLocateEnabled: function() {68 return this.client.settings.get('rp.locate.enabled');69 },70 tapBackBtn: function(panel) {71 this.client.findElement(panel + ' header .back').tap();72 this.waitForPanelToDissapear(panel);73 },74 tapOnLock: function() {75 this.client.findElement(this.selectors.lockLabel).tap();76 },77 tapOnRing: function() {78 this.client.findElement(this.selectors.ringLabel).tap();79 },80 tapOnLocate: function() {81 this.client.findElement(this.selectors.locateLabel).tap();82 }...

Full Screen

Full Screen

audio_channel_test_app.js

Source:audio_channel_test_app.js Github

copy

Full Screen

...24});25AudioChannelTestApp.prototype = {26 client: null,27 get normalPlay() {28 return this.client.findElement(AudioChannelTestApp.Selector.normalPlay);29 },30 get normalPause() {31 return this.client.findElement(AudioChannelTestApp.Selector.normalPause);32 },33 get contentPlay() {34 return this.client.findElement(AudioChannelTestApp.Selector.contentPlay);35 },36 get contentPause() {37 return this.client.findElement(AudioChannelTestApp.Selector.contentPause);38 },39 get alarmPlay() {40 return this.client.findElement(AudioChannelTestApp.Selector.alarmPlay);41 },42 get alarmPause() {43 return this.client.findElement(AudioChannelTestApp.Selector.alarmPause);44 },45 get systemPlay() {46 return this.client.findElement(AudioChannelTestApp.Selector.systemPlay);47 },48 get systemPause() {49 return this.client.findElement(AudioChannelTestApp.Selector.systemPause);50 },51 get ringerPlay() {52 return this.client.findElement(AudioChannelTestApp.Selector.ringerPlay);53 },54 get ringerPause() {55 return this.client.findElement(AudioChannelTestApp.Selector.ringerPause);56 },57 get telephonyPlay() {58 return this.client.findElement(AudioChannelTestApp.Selector.telephonyPlay);59 },60 get telephonyPause() {61 return this.client.findElement(AudioChannelTestApp.Selector.telephonyPause);62 },63 get notificationPlay() {64 return this.client65 .findElement(AudioChannelTestApp.Selector.notificationPlay);66 },67 get notificationPause() {68 return this.client69 .findElement(AudioChannelTestApp.Selector.notificationPause);70 },71 get publicnotificationPlay() {72 return this.client73 .findElement(AudioChannelTestApp.Selector.publicnotificationPlay);74 },75 get publicnotificationPause() {...

Full Screen

Full Screen

dormzi-user-registration.test.js

Source:dormzi-user-registration.test.js Github

copy

Full Screen

...13 afterEach(async function () {14 await client.deleteSession();15 });16 it('Should be able to register as a Dormzi', async function () {17 const startLink = await client.findElement('accessibility id', 'start');18 await client.elementClick(startLink.ELEMENT);19 const onboardingEmailLink = await client.findElement('accessibility id', 'onBoardingEmail');20 await client.elementClick(onboardingEmailLink.ELEMENT);21 const onboardingDormer = await client.findElement('accessibility id', 'onBoardingDormzi');22 await client.elementClick(onboardingDormer.ELEMENT);23 const emailInput = await client.findElement('accessibility id', 'typeEmailAddress');24 client.elementSendKeys(emailInput.ELEMENT, "sam+" + shortid.generate() + "@dormzi.com\n");25 const passwordInput = await client.findElement('accessibility id', 'typePassword');26 client.elementSendKeys(passwordInput.ELEMENT, "password\n");27 await client.findElement('accessibility id', 'typeToken').then((tokenInput) => {28 assert.isNotNull(tokenInput.ELEMENT);29 });30 });31 it('Should be able to register as a Dormer', async function () {32 const startLink = await client.findElement('accessibility id', 'start');33 await client.elementClick(startLink.ELEMENT);34 const onboardingEmailLink = await client.findElement('accessibility id', 'onBoardingEmail');35 await client.elementClick(onboardingEmailLink.ELEMENT);36 const onboardingDormer = await client.findElement('accessibility id', 'onBoardingDormer');37 await client.elementClick(onboardingDormer.ELEMENT);38 const emailInput = await client.findElement('accessibility id', 'typeEmailAddress');39 client.elementSendKeys(emailInput.ELEMENT, "sam+" + shortid.generate() + "@dormzi.com\n");40 const passwordInput = await client.findElement('accessibility id', 'typePassword');41 client.elementSendKeys(passwordInput.ELEMENT, "password\n");42 await client.findElement('accessibility id', 'typeToken').then((tokenInput) => {43 assert.isNotNull(tokenInput.ELEMENT);44 });45 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriver = require('selenium-webdriver');2var By = webdriver.By;3var until = webdriver.until;4var driver = new webdriver.Builder()5 .forBrowser('chrome')6 .build();7driver.findElement(By.name('q')).sendKeys('webdriver');8driver.findElement(By.name('btnG')).click();9driver.wait(until.titleIs('webdriver - Google Search'), 1000);10driver.quit();11var webdriver = require('selenium-webdriver');12var By = webdriver.By;13var until = webdriver.until;14var driver = new webdriver.Builder()15 .forBrowser('chrome')16 .build();17driver.findElement(By.name('q')).sendKeys('webdriver');18driver.findElement(By.name('btnG')).click();19driver.wait(until.titleIs('webdriver - Google Search'), 1000);20driver.quit();21var webdriver = require('selenium-webdriver');22var By = webdriver.By;23var until = webdriver.until;24var driver = new webdriver.Builder()25 .forBrowser('chrome')26 .build();27driver.findElement(By.name('q')).sendKeys('webdriver');28driver.findElement(By.name('btnG')).click();29driver.wait(until.titleIs('webdriver - Google Search'), 1000);30driver.quit();31var webdriver = require('selenium-webdriver');32var By = webdriver.By;33var until = webdriver.until;34var driver = new webdriver.Builder()35 .forBrowser('chrome')36 .build();37driver.findElement(By.name('q')).sendKeys('webdriver');38driver.findElement(By.name('btnG')).click();39driver.wait(until.titleIs('webdriver - Google Search'), 1000);40driver.quit();41var webdriver = require('selenium-webdriver');42var By = webdriver.By;43var until = webdriver.until;44var driver = new webdriver.Builder()45 .forBrowser('chrome')46 .build();47driver.findElement(By.name('q')).sendKeys('webdriver');

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriver = require('selenium-webdriver');2var driver = new webdriver.Builder()3 .forBrowser('chrome')4 .build();5driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');6driver.findElement(webdriver.By.name('btnG')).click();7driver.wait(function() {8 return driver.getTitle().then(function(title) {9 return title === 'webdriver - Google Search';10 });11}, 1000);12driver.quit();13var webdriver = require('selenium-webdriver');14var driver = new webdriver.Builder()15 .forBrowser('chrome')16 .build();17driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');18driver.findElement(webdriver.By.name('btnG')).click();19driver.wait(function() {20 return driver.getTitle().then(function(title) {21 return title === 'webdriver - Google Search';22 });23}, 1000);24driver.quit();25var webdriver = require('selenium-webdriver');26var driver = new webdriver.Builder()27 .forBrowser('chrome')28 .build();29driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');30driver.findElement(webdriver.By.name('btnG')).click();31driver.wait(function() {32 return driver.getTitle().then(function(title) {33 return title === 'webdriver - Google Search';34 });35}, 1000);36driver.quit();37var webdriver = require('selenium-webdriver');38var driver = new webdriver.Builder()39 .forBrowser('chrome')40 .build();41driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');42driver.findElement(webdriver.By.name('btnG')).click();43driver.wait(function() {44 return driver.getTitle().then(function(title) {45 return title === 'webdriver - Google Search';46 });47}, 1000);48driver.quit();49var webdriver = require('selenium-webdriver');50var driver = new webdriver.Builder()51 .forBrowser('chrome')52 .build();53driver.findElement(webdriver.By.name

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriver = require('selenium-webdriver');2var By = webdriver.By;3var until = webdriver.until;4var driver = new webdriver.Builder()5 .forBrowser('chrome')6 .build();7driver.findElement(By.name('q')).sendKeys('webdriver');8driver.findElement(By.name('btnK')).click();9driver.wait(until.titleIs('webdriver - Google Search'), 1000);10driver.quit();11var webdriver = require('selenium-webdriver');12var By = webdriver.By;13var until = webdriver.until;14var driver = new webdriver.Builder()15 .forBrowser('chrome')16 .build();17driver.findElement(By.name('q')).sendKeys('webdriver');18driver.findElement(By.name('btnK')).click();19driver.wait(until.titleIs('webdriver - Google Search'), 1000);20driver.quit();21var webdriver = require('selenium-webdriver');22var By = webdriver.By;23var until = webdriver.until;24var driver = new webdriver.Builder()25 .forBrowser('chrome')26 .build();27driver.findElement(By.name('q')).sendKeys('webdriver');28driver.findElement(By.name('btnK')).click();29driver.wait(until.titleIs('webdriver - Google Search'), 1000);30driver.quit();31var webdriver = require('selenium-webdriver');32var By = webdriver.By;33var until = webdriver.until;34var driver = new webdriver.Builder()35 .forBrowser('chrome')36 .build();37driver.findElement(By.name('q')).sendKeys('webdriver');38driver.findElement(By.name('btnK')).click();39driver.wait(until.titleIs('webdriver - Google Search'), 1000);40driver.quit();41var webdriver = require('selenium-webdriver');42var By = webdriver.By;43var until = webdriver.until;44var driver = new webdriver.Builder()45 .forBrowser('chrome')46 .build();47driver.findElement(By.name('q')).sendKeys('webdriver');48driver.findElement(By.name('btnK')).click();49driver.wait(until.title

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriver = require('selenium-webdriver');2var assert = require('chai').assert;3var expect = require('chai').expect;4var should = require('chai').should();5var By = require('selenium-webdriver').By;6var until = require('selenium-webdriver').until;7var driver = new webdriver.Builder().forBrowser('chrome').build();8var path = require('path');9var chromeDriver = require('chromedriver');10var capabilities = {11    'chromeOptions' : {12    }13};14var search = driver.findElement(By.name('q'));15search.sendKeys('webdriver');16search.submit();17driver.wait(until.titleIs('webdriver - Google Search'), 1000);18driver.quit();19at Function.Module._resolveFilename (module.js:547:15)20at Function.Module._load (module.js:474:25)21at Module.require (module.js:596:17)

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var assert = require('assert');3var chai = require('chai');4var chaiAsPromised = require('chai-as-promised');5chai.use(chaiAsPromised);6var client = wd.promiseChainRemote({

Full Screen

Using AI Code Generation

copy

Full Screen

1client.findElement('name', 'myName', function(err, el) {2 client.clickElement(el, function() {3 });4});5client.click('name', 'myName', function() {6});7client.click('name', 'myName', function() {8});9client.click('name', 'myName', function() {10});11client.click('name', 'myName', function() {12});13client.click('name', 'myName', function() {14});15client.click('name', 'myName', function() {16});17client.click('name', 'myName', function() {18});19client.click('name', 'myName', function() {20});21client.click('name', 'myName', function() {22});23client.click('name', 'myName', function() {24});25client.click('name', 'myName', function() {26});27client.click('name', 'myName', function() {28});29client.click('name', 'myName', function() {30});

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 Appium 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