Best JavaScript code snippet using appium-android-driver
partyCtrlSpec.js
Source:partyCtrlSpec.js
1'use strict';2describe("Party Controller", function() {3 var scope, ctrl, user, User, questsService, groups, rootScope, $controller;4 beforeEach(function() {5 user = specHelper.newUser(),6 user._id = "unique-user-id";7 User = {8 user: user,9 sync: sandbox.spy10 }11 module(function($provide) {12 $provide.value('User', User);13 });14 inject(function(_$rootScope_, _$controller_, Groups, Quests){15 rootScope = _$rootScope_;16 scope = _$rootScope_.$new();17 $controller = _$controller_;18 groups = Groups;19 questsService = Quests;20 // Load RootCtrl to ensure shared behaviors are loaded21 $controller('RootCtrl', {$scope: scope, User: User});22 ctrl = $controller('PartyCtrl', {$scope: scope, User: User});23 });24 });25 describe('questAccept', function() {26 beforeEach(function() {27 scope.group = {28 quest: { members: { 'user-id': true } }29 };30 sandbox.stub(questsService, 'sendAction').returns({31 then: sandbox.stub().yields({members: {another: true}})32 });33 });34 it('calls Quests.sendAction', function() {35 scope.questAccept();36 expect(questsService.sendAction).to.be.calledOnce;37 expect(questsService.sendAction).to.be.calledWith('questAccept');38 });39 it('updates quest object with new participants list', function() {40 scope.group.quest = {41 members: { user: true, another: true }42 };43 scope.questAccept();44 expect(scope.group.quest).to.eql({members: { another: true }});45 });46 });47 describe('questReject', function() {48 beforeEach(function() {49 scope.group = {50 quest: { members: { 'user-id': true } }51 };52 sandbox.stub(questsService, 'sendAction').returns({53 then: sandbox.stub().yields({members: {another: true}})54 });55 });56 it('calls Quests.sendAction', function() {57 scope.questReject();58 expect(questsService.sendAction).to.be.calledOnce;59 expect(questsService.sendAction).to.be.calledWith('questReject');60 });61 it('updates quest object with new participants list', function() {62 scope.group.quest = {63 members: { user: true, another: true }64 };65 scope.questReject();66 expect(scope.group.quest).to.eql({members: { another: true }});67 });68 });69 describe('questCancel', function() {70 var party, cancelSpy, windowSpy;71 beforeEach(function() {72 sandbox.stub(questsService, 'sendAction').returns({73 then: sandbox.stub().yields({members: {another: true}})74 });75 });76 it('calls Quests.sendAction when alert box is confirmed', function() {77 sandbox.stub(window, "confirm").returns(true);78 scope.questCancel();79 expect(window.confirm).to.be.calledOnce;80 expect(window.confirm).to.be.calledWith(window.env.t('sureCancel'));81 expect(questsService.sendAction).to.be.calledOnce;82 expect(questsService.sendAction).to.be.calledWith('questCancel');83 });84 it('does not call Quests.sendAction when alert box is not confirmed', function() {85 sandbox.stub(window, "confirm").returns(false);86 scope.questCancel();87 expect(window.confirm).to.be.calledOnce;88 expect(questsService.sendAction).to.not.be.called;89 });90 });91 describe('questAbort', function() {92 beforeEach(function() {93 sandbox.stub(questsService, 'sendAction').returns({94 then: sandbox.stub().yields({members: {another: true}})95 });96 });97 it('calls Quests.sendAction when two alert boxes are confirmed', function() {98 sandbox.stub(window, "confirm", function(){return true});99 scope.questAbort();100 expect(window.confirm).to.be.calledTwice;101 expect(window.confirm).to.be.calledWith(window.env.t('sureAbort'));102 expect(window.confirm).to.be.calledWith(window.env.t('doubleSureAbort'));103 expect(questsService.sendAction).to.be.calledOnce;104 expect(questsService.sendAction).to.be.calledWith('questAbort');105 });106 it('does not call Quests.sendAction when first alert box is not confirmed', function() {107 sandbox.stub(window, "confirm", function(){return false});108 scope.questAbort();109 expect(window.confirm).to.be.calledOnce;110 expect(window.confirm).to.be.calledWith(window.env.t('sureAbort'));111 expect(window.confirm).to.not.be.calledWith(window.env.t('doubleSureAbort'));112 expect(questsService.sendAction).to.not.be.called;113 });114 it('does not call Quests.sendAction when first alert box is confirmed but second one is not', function() {115 // Hack to confirm first window, but not second116 // Should not be necessary when we upgrade sinon117 var shouldReturn = false;118 sandbox.stub(window, 'confirm', function(){119 shouldReturn = !shouldReturn;120 return shouldReturn;121 });122 scope.questAbort();123 expect(window.confirm).to.be.calledTwice;124 expect(window.confirm).to.be.calledWith(window.env.t('sureAbort'));125 expect(window.confirm).to.be.calledWith(window.env.t('doubleSureAbort'));126 expect(questsService.sendAction).to.not.be.called;127 });128 });129 describe('#questLeave', function() {130 beforeEach(function() {131 scope.group = {132 quest: { members: { 'user-id': true } }133 };134 sandbox.stub(questsService, 'sendAction').returns({135 then: sandbox.stub().yields({members: {another: true}})136 });137 });138 it('calls Quests.sendAction when alert box is confirmed', function() {139 sandbox.stub(window, "confirm").returns(true);140 scope.questLeave();141 expect(window.confirm).to.be.calledOnce;142 expect(window.confirm).to.be.calledWith(window.env.t('sureLeave'));143 expect(questsService.sendAction).to.be.calledOnce;144 expect(questsService.sendAction).to.be.calledWith('questLeave');145 });146 it('does not call Quests.sendAction when alert box is not confirmed', function() {147 sandbox.stub(window, "confirm").returns(false);148 scope.questLeave();149 expect(window.confirm).to.be.calledOnce;150 questsService.sendAction.should.not.have.been.calledOnce;151 });152 it('updates quest object with new participants list', function() {153 scope.group.quest = {154 members: { user: true, another: true }155 };156 sandbox.stub(window, "confirm").returns(true);157 scope.questLeave();158 expect(scope.group.quest).to.eql({members: { another: true }});159 });160 });161 describe('clickStartQuest', function() {162 beforeEach(function() {163 sandbox.stub(rootScope, 'openModal');164 sandbox.stub(rootScope.$state, 'go');165 });166 it('opens quest modal if user has a quest', function() {167 user.items.quests = {168 whale: 1169 };170 scope.clickStartQuest();171 expect(rootScope.$state.go).to.not.be.called;172 expect(rootScope.openModal).to.be.calledOnce;173 expect(rootScope.openModal).to.be.calledWith(174 'ownedQuests',175 { controller: 'InventoryCtrl' }176 );177 });178 it('does not open modal if user has no quests', function() {179 user.items.quests = { };180 scope.clickStartQuest();181 expect(rootScope.openModal).to.not.be.called;182 expect(rootScope.$state.go).to.be.calledOnce;183 expect(rootScope.$state.go).to.be.calledWith('options.inventory.quests');184 });185 it('does not open modal if user had quests previously, but does not now', function() {186 user.items.quests = {187 whale: 0,188 atom1: 0189 };190 scope.clickStartQuest();191 expect(rootScope.openModal).to.not.be.called;192 expect(rootScope.$state.go).to.be.calledOnce;193 expect(rootScope.$state.go).to.be.calledWith('options.inventory.quests');194 });195 });196 describe('#leaveOldPartyAndJoinNewParty', function() {197 beforeEach(function() {198 sandbox.stub(scope, 'join');199 sandbox.stub(groups.Group, 'leave').yields();200 sandbox.stub(groups, 'party').returns({201 _id: 'old-party'202 });203 sandbox.stub(window, 'confirm').returns(true);204 });205 it('does nothing if user declines confirmation', function() {206 window.confirm.returns(false);207 scope.leaveOldPartyAndJoinNewParty('some-id', 'some-name');208 expect(groups.Group.leave).to.not.be.called;209 })210 it('leaves user\'s current party', function() {211 scope.leaveOldPartyAndJoinNewParty('some-id', 'some-name');212 expect(groups.Group.leave).to.be.calledOnce;213 expect(groups.Group.leave).to.be.calledWith({214 gid: 'old-party',215 keep: false216 });217 });218 it('joins the new party', function() {219 scope.leaveOldPartyAndJoinNewParty('some-id', 'some-name');220 expect(scope.join).to.be.calledOnce;221 expect(scope.join).to.be.calledWith({222 id: 'some-id',223 name: 'some-name'224 });225 });226 });227 describe('#canEditQuest', function() {228 var party;229 beforeEach(function() {230 party = specHelper.newGroup({231 type: 'party',232 leader: {},233 quest: {}234 });235 });236 it('returns false if user is not the quest leader', function() {237 party.quest.leader = 'another-user';238 expect(scope.canEditQuest(party)).to.eql(false);239 });240 it('returns true if user is quest leader', function() {241 party.quest.leader = 'unique-user-id';242 expect(scope.canEditQuest(party)).to.eql(true);243 });244 });...
main.js
Source:main.js
...41 'about': 'about',42 '*path': 'defaultRoute'43 },44 top: function () {45 this.sendAction('/#');46 this.appView.toTop();47 _gaq.push(['_trackPageview', '/']);48 },49 poplist: function (feelingId) {50 this.sendAction('/#poplist/' + feelingId);51 this.appView.toPopList(feelingId);52 _gaq.push(['_trackPageview', '/#poplist/' + feelingId]);53 },54 musicDetail: function (musicId) {55 this.sendAction('/#music/' + musicId);56 this.appView.toMusicDetail(musicId);57 _gaq.push(['_trackPageview', '/#music/' + musicId]);58 },59 defaultRoute: function () {60 this.top();61 _gaq.push(['_trackPageview', '/']);62 },63 musicSearch: function () {64 this.sendAction('/#music/search');65 this.appView.toMusicSearch();66 _gaq.push(['_trackPageview', '/#music/search']);67 },68 addPop: function (musicId) {69 this.sendAction('/#music/' + musicId + '/pop/add');70 this.appView.toAddPop(musicId);71 _gaq.push(['_trackPageview', '/#music/' + musicId + '/pop/add']);72 },73 login: function () {74 this.sendAction('/#login');75 this.appView.toLogin();76 _gaq.push(['_trackPageview', '/#login']);77 },78 mypage: function () {79 this.sendAction('/#mypage');80 this.appView.toMypage();81 _gaq.push(['_trackPageview', '/#mypage']);82 },83 userPage: function (userId) {84 // ããèªåã®IDã®å ´åã¯ããã¤ãã¼ã¸ã表示ãã85 var user = _.mbStorage.getUser();86 if (user && user.id === parseInt(userId, 10)) {87 mb.router.navigate('#mypage', true);88 return;89 }90 this.sendAction('/#user/' + userId);91 this.appView.toUserPage(userId);92 _gaq.push(['_trackPageview', '/#user/' + userId]);93 },94 registUser: function () {95 this.sendAction('/#user/new');96 this.appView.toRegistUserPage();97 _gaq.push(['_trackPageview', '/#user/new']);98 },99 artist: function (artistId) {100 this.sendAction('/#artist/' + artistId);101 this.appView.toArtist(artistId);102 _gaq.push(['_trackPageview', '/#artist/' + artistId]);103 },104 timeline: function () {105 this.sendAction('/#timeline');106 this.appView.toTimeline();107 _gaq.push(['_trackPageview', '/#timeline']);108 },109 usersetting: function () {110 this.sendAction('/#usersetting');111 this.appView.toUserSetting();112 _gaq.push(['_trackPageview', '/#usersetting']);113 },114 rules: function () {115 this.sendAction('/#rules');116 this.appView.toRules();117 _gaq.push(['_trackPageview', '/#rules']);118 },119 privacy: function () {120 this.sendAction('/#privacy');121 this.appView.toPrivacy();122 _gaq.push(['_trackPageview', '/#privacy']);123 },124 recommended: function () {125 this.sendAction('/#recommended');126 this.appView.toRecommended();127 _gaq.push(['_trackPageview', '/#recommended']);128 },129 about: function () {130 this.sendAction('/#about');131 this.appView.toAbout();132 _gaq.push(['_trackPageview', '/#about']);133 },134 // ãã¼ã¸é·ç§»ãéç¥135 sendAction: function (anUrl) {136 console.log('route: ', anUrl);137 _.sendActionLog(anUrl);138 },139 });140 $(function () {141 mb.router = new AppRouter();142 Backbone.history.start();143 });144});
element.js
Source:element.js
...7 let params = {8 attribute,9 elementId10 };11 return await this.bootstrap.sendAction("element:getAttribute", params);12};13commands.setAttribute = async function (attribute, value, elementId) {14 elementId = this.getAutomationId(elementId);15 let params = {16 attribute,17 value,18 elementId19 };20 return await this.bootstrap.sendAction("element:setAttribute", params);21};22commands.getLocation = async function (elementId) {23 elementId = this.getAutomationId(elementId);24 return await this.bootstrap.sendAction("element:location", { elementId });25};26commands.getLocationInView = async function (elementId) {27 return await this.getLocation(elementId);28};29commands.getLocationValueByElementId = async function (elementId) {30 return await this.getLocation(elementId);31};32commands.getText = async function (elementId) {33 elementId = this.getAutomationId(elementId);34 return await this.bootstrap.sendAction("element:getText", { elementId });35};36commands.elementEnabled = async function (elementId) {37 elementId = this.getAutomationId(elementId);38 return await this.bootstrap.sendAction("element:enabled", { elementId });39};40commands.elementDisplayed = async function (elementId) {41 elementId = this.getAutomationId(elementId);42 return await this.bootstrap.sendAction("element:displayed", { elementId });43};44commands.elementSelected = function () {45 log.info('elementSelected not supported');46 return false;47};48commands.getSize = async function (elementId) {49 elementId = this.getAutomationId(elementId);50 return await this.bootstrap.sendAction("element:size", { elementId });51};52commands.setValue = async function (keys, elementId) {53 let text = keys.join();54 elementId = this.getAutomationId(elementId);55 let params = {56 elementId,57 text,58 replace: false59 };60 return await this.bootstrap.sendAction("element:setText", params);61};62commands.setValueImmediate = async function (keys, elementId) {63 let text = _.isArray(keys) ? keys.join('') : keys;64 elementId = this.getAutomationId(elementId);65 let params = {66 elementId,67 text,68 replace: false69 };70 return await this.bootstrap.sendAction("element:setText", params);71};72commands.clear = async function (elementId) {73 elementId = this.getAutomationId(elementId);74 let params = {75 elementId,76 text: "",77 replace: true78 };79 return await this.bootstrap.sendAction("element:setText", params);80};81commands.replaceValue = async function (value, elementId) {82 elementId = this.getAutomationId(elementId);83 let params = {84 elementId,85 text: value,86 replace: true87 };88 return await this.bootstrap.sendAction("element:setText", params);89};90commands.click = async function (elementId, x = 0, y = 0) {91 if (x === this.sessionId) {92 x = 0;93 }94 if (y === this.sessionId) {95 y = 0;96 }97 if (elementId) {98 elementId = this.getAutomationId(elementId);99 } else {100 elementId = "";101 }102 let params = {103 elementId,104 x,105 y106 };107 return await this.bootstrap.sendAction("element:click", params);108};109commands.touchUp = async function (x = 1, y = 1, elementId = "") {110 if (elementId && elementId !== this.sessionId) {111 elementId = this.getAutomationId(elementId);112 } else {113 elementId = "";114 }115 let params = {116 elementId,117 x,118 y119 };120 return await this.bootstrap.sendAction("element:touchUp", params);121};122commands.touchDown = async function (x, y, elementId = "") {123 if (elementId && elementId !== this.sessionId) {124 elementId = this.getAutomationId(elementId);125 } else {126 elementId = "";127 }128 let params = {129 elementId,130 x,131 y132 };133 return await this.bootstrap.sendAction("element:touchDown", params);134};135commands.touchMove = async function (x, y, elementId = null) {136 if (elementId && elementId !== this.sessionId) {137 elementId = this.getAutomationId(elementId);138 } else {139 elementId = "";140 }141 let params = {142 elementId,143 x,144 y145 };146 return await this.bootstrap.sendAction("element:touchMove", params);147};148commands.touchLongClick = async function (elementId, x, y, duration) {149 await this.touchDown(x, y, elementId);150 await sleep(duration);151 return await this.touchUp(x, y, elementId);152};153commands.tap = async function (elementId, x = 0, y = 0, count = 1) {154 let result = true;155 let tapResult = false;156 for (let i = 0; i < count; i++) {157 tapResult = await this.click(elementId, x, y);158 if (!tapResult) {159 result = false;160 }...
Remote.js
Source:Remote.js
1function sendAction(ip){2 var doc = new XMLHttpRequest();3 doc.onreadystatechange = function() {4 if (doc.readyState === XMLHttpRequest.HEADERS_RECEIVED) {5 }6 else if (doc.readyState === XMLHttpRequest.DONE) {7 var a = doc.responseXML.documentElement;8 for (var ii = 0; ii < a.childNodes.length; ++ii) {9 }10 }11 }12 doc.open("GET", ip);13 doc.send();14}15//Numbers...
handlers.js
Source:handlers.js
...20 'USER_REGISTER': (action, ws, db) => Promise.resolve()21 .then(check.notLoggedIn(ws))22 .then(() => userService.register(db, action.payload.name, action.payload.password))23 .then(user => {24 ws.sendAction("USER_REGISTER_FULFILLED");25 })26 .catch(err => {27 ws.sendAction(rejectionAction("USER_REGISTER_REJECTED", err));28 throw err;29 }),30 'USER_LOGIN': (action, ws, db) => {31 return Promise.resolve()32 .then(check.notLoggedIn(ws))33 // authenticate user34 .then(() => {35 if (action.payload.token)36 return userService.loginByToken(db, action.payload.token);37 else38 return userService.login(db, action.payload.name, action.payload.password);39 })40 // drop parallel sessions41 .then(user => {42 ws.store.currentUser = user;43 sapi.getClients(filter.ws.concurrentById(user._id, ws)).forEach(44 client => {45 delete client.store.currentUser;46 delete client.store.lobbyId;47 client.sendAction("USER_UPDATE", userUpdatePayload(null));48 client.sendAction("USER_KICKED_OUT");49 });50 return user;51 })52 // get user's lobby53 .then(user => {54 // inner promise not to interfere main flow55 return lobbyService.get.byMemberId(db, user._id)56 .then(lobby => {57 ws.store.lobbyId = lobby._id;58 })59 .catch(err => { })60 })61 // send response62 .then(() => {63 ws.sendAction("USER_LOGIN_FULFILLED");64 ws.sendAction("USER_UPDATE", userUpdatePayload(ws.store.currentUser));65 })66 .catch(err => {67 ws.sendAction(rejectionAction("USER_LOGIN_REJECTED", err));68 throw err;69 });70 },71 'USER_LOGOUT': (action, ws, db) => Promise.resolve()72 .then(check.loggedIn(ws))73 .then(() => userService.logout(db, ws.store.currentUser.token))74 .then(user => {75 delete ws.store.currentUser;76 delete ws.store.lobbyId;77 ws.sendAction("USER_LOGOUT_FULFILLED");78 ws.sendAction("USER_UPDATE", userUpdatePayload(null));79 })80 .catch(err => {81 ws.sendAction(rejectionAction("USER_LOGOUT_REJECTED", err));82 throw err;83 }),84 'USER_UPDATE_REQUEST': (action, ws, db) => Promise.resolve()85 .then(check.loggedIn(ws))86 .then(() => userService.get.byToken(db, ws.store.currentUser.token))87 .then(user => {88 ws.store.user = user;89 ws.sendAction("USER_UPDATE", userUpdatePayload(user));90 })91 .catch(err => {92 delete ws.store.currentUser;93 delete ws.store.lobbyId;94 ws.sendAction(rejectionAction("USER_UPDATE_REJECTED", err));95 throw err;96 }),97}...
menu.js
Source:menu.js
2const electron = require('electron');3const config = require('./config');4const { app, BrowserWindow, shell } = electron;5const appName = app.getName();6function sendAction(action) {7 const [win] = BrowserWindow.getAllWindows();8 win.webContents.send(action);9}10const appMenu = [11 { role: 'about' },12 { type: 'separator' },13 {14 label: 'Show Unread Badge',15 type: 'checkbox',16 checked: config.get('showUnreadBadge'),17 click() {18 config.set('showUnreadBadge', !config.get('showUnreadBadge'));19 }20 },21 { type: 'separator' },22 { role: 'services', submenu: [] },23 { type: 'separator' },24 { role: 'hide' },25 { role: 'hideothers' },26 { role: 'unhide' },27 { type: 'separator' },28 { role: 'quit' }29];30const bookmarkMenu = [31 {32 label: 'New',33 accelerator: 'Cmd+N',34 click() {35 sendAction('new');36 }37 },38 {39 label: 'Save',40 accelerator: 'Cmd+S',41 click() {42 sendAction('save');43 }44 },45 {46 label: 'Remove',47 accelerator: 'Cmd+Backspace',48 click() {49 sendAction('remove');50 }51 },52 {53 label: 'Reload',54 accelerator: 'Cmd+Shift+R',55 click() {56 sendAction('reload');57 }58 },59 {60 label: 'Back',61 accelerator: 'Cmd+LeftArrow',62 click() {63 sendAction('back');64 }65 },66 {67 label: 'Forward',68 accelerator: 'Cmd+RightArrow',69 click() {70 sendAction('forward');71 }72 },73 // {label: 'Toggle Hide', accelerator: 'Cmd+Shift+H', click() {74 // sendAction('toggle-hide');75 // }},76 {77 label: 'Toggle Mute',78 accelerator: 'Cmd+Shift+M',79 click() {80 sendAction('toggle-mute');81 }82 }83];84const viewMenu = [85 {86 label: 'Configuraciones',87 accelerator: 'Cmd+Shift+S',88 click() {89 sendAction('toggle-settings');90 }91 },92 {93 label: 'Modo Oscuro',94 accelerator: 'Cmd+D',95 click() {96 sendAction('toggle-dark-mode');97 }98 }99];100const windowMenu = [101 { role: 'minimize' },102 { role: 'close' },103 { type: 'separator' },104 {105 label: 'Seleccionar siguiente marcador',106 accelerator: 'Ctrl+Tab',107 click() {108 sendAction('next');109 }110 },111 {112 label: 'Seleccionar marcador anterior',113 accelerator: 'Ctrl+Shift+Tab',114 click() {115 sendAction('previous');116 }117 },118 { type: 'separator' },119 {120 type: 'checkbox',121 label: 'Always on Top',122 accelerator: 'Cmd+Shift+T',123 checked: config.get('alwaysOnTop'),124 click(item, focusedWindow) {125 config.set('alwaysOnTop', item.checked);126 focusedWindow.setAlwaysOnTop(item.checked);127 }128 }129];130const helpMenu = [131 {132 label: 'Instagram',133 click() {134 shell.openExternal('https://instagram.com/m_maciel7');135 }136 },137 {138 label: 'Codigo fuente',139 click() {140 shell.openExternal('https://github.com/ManuelMaciel');141 }142 },143 { type: 'separator' },144 { role: 'toggledevtools' },145 { type: 'separator' },146 {147 label: 'Reiniciar Marcadores',148 click() {149 sendAction('reset');150 }151 },152 {153 label: 'Abrir Configuraciones',154 click() {155 sendAction('open-config');156 }157 }158];159const menu = [160 {161 label: appName,162 submenu: appMenu163 },164 {165 role: 'editMenu'166 },167 {168 label: 'Marcadores',169 submenu: bookmarkMenu...
ui-sortable.js
Source:ui-sortable.js
...23 _actionBinders () {24 let _self = this;25 return {26 activate: function(event, ui) {27 _self.sendAction(`onActivate`, event, ui, _self);28 },29 beforeStop: function(event, ui) {30 _self.sendAction(`onBeforeStop`, event, ui, _self);31 },32 change: function(event, ui) {33 _self.sendAction(`onChange`, event, ui, _self);34 },35 create: function(event, ui) {36 _self.sendAction(`onCreate`, event, ui, _self);37 },38 deactivate: function (event, ui) {39 _self.sendAction(`onDeactivate`, event, ui, _self);40 },41 out: function (event, ui) {42 _self.sendAction(`onOut`, event, ui, _self);43 },44 over: function (event, ui) {45 _self.sendAction(`onOver`, event, ui, _self);46 },47 receive: function (event, ui) {48 _self.sendAction(`onReceive`, event, ui, _self);49 },50 remove: function (event, ui) {51 _self.sendAction(`onRemove`, event, ui, _self);52 },53 sort: function (event, ui) {54 _self.sendAction(`onSort`, event, ui, _self);55 },56 start: function (event, ui) {57 _self.sendAction(`onStart`, event, ui, _self);58 },59 stop: function (event, ui) {60 _self.sendAction(`onStop`, event, ui, _self);61 },62 update: function (event, ui) {63 _self.sendAction(`onUpdate`, event, ui, _self);64 }65 };66 }...
modal-popup.js
Source:modal-popup.js
2export default Ember.Component.extend({3actions: {4 ok: function() {5 this.$('.modal').modal('hide');6 this.sendAction('ok');7 },8 close: function(){9 this.$('.modal').modal('hide');10 this.sendAction('removeModal');11 },12 submitBudget: function(){13 this.sendAction('submitBudget');14 },15 submit: function(){16 this.$('.modal').modal('hide');17 this.sendAction('submitMsg');18 },19 closeContactModal: function(){20 this.$('.modal').modal('hide');21 this.sendAction('closeContactModal');22 },23 closeBudgetModal: function(){24 this.$('.modal').modal('hide');25 this.sendAction('closeBudgetModal');26 },27 closeTodoModal: function(){28 this.$('.modal').modal('hide');29 this.sendAction('closeTodoModal');30 },31 saveTodo: function(){32 this.sendAction('saveTodo');33 },34 closeGuestModal: function(){35 this.$('.modal').modal('hide');36 this.sendAction('closeGuestModal');37 },38 saveGuest: function(){39 this.sendAction('saveTodo');40 },41 saveValue: function() {42 this.sendAction('saveValue');43 },44 closeEditValue: function() {45 this.$('.modal').modal('hide');46 this.sendAction('closeEditValue');47 },48 captchaComplete: function(data){49 alert("THIS WORKED");50 this.sendAction('captchaComplete');51 },52 closeDate: function(){53 this.$('.modal').modal('hide');54 this.sendAction('closeDate');55 },56 okDate: function(){57 this.sendAction('okDate');58 },59 closeIcon: function(){60 this.$('.modal').modal('hide');61 this.sendAction('closeIcon');62 },63 okIcon: function(){64 this.sendAction('okIcon');65 }66 },67 show: function() {68 this.$('.modal').modal().on('hidden.bs.modal', function() {69 this.sendAction('close');70 }.bind(this));71 }.on('didInsertElement')...
Using AI Code Generation
1var webdriver = require('selenium-webdriver');2var driver = new webdriver.Builder().forBrowser('chrome').build();3driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');4driver.findElement(webdriver.By.name('btnG')).click();5driver.getTitle().then(function(title) {6console.log(title);7driver.quit();8});9var webdriver = require('selenium-webdriver');10var driver = new webdriver.Builder().forBrowser('chrome').build();11driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');12driver.findElement(webdriver.By.name('btnG')).click();13driver.getTitle().then(function(title) {14console.log(title);15driver.quit();16});17var webdriver = require('selenium-webdriver');18var driver = new webdriver.Builder().forBrowser('chrome').build();19driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');20driver.findElement(webdriver.By.name('btnG')).click();21driver.getTitle().then(function(title) {22console.log(title);23driver.quit();24});25var webdriver = require('selenium-webdriver');26var driver = new webdriver.Builder().forBrowser('chrome').build();27driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');28driver.findElement(webdriver.By.name('btnG')).click();29driver.getTitle().then(function(title) {30console.log(title);31driver.quit();32});33var webdriver = require('selenium-webdriver');34var driver = new webdriver.Builder().forBrowser('chrome').build();35driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');36driver.findElement(webdriver.By.name('btnG')).click();37driver.getTitle().then(function(title) {38console.log(title);39driver.quit();40});41var webdriver = require('selenium-webdriver');42var driver = new webdriver.Builder().forBrowser('chrome').build();43driver.findElement(webdriver.By.name('q')).sendKeys('webdriver
Using AI Code Generation
1var wd = require('wd');2var serverConfig = {3};4var desiredCaps = {5};6var driver = wd.promiseChainRemote(serverConfig);7 .init(desiredCaps)8 .elementByName('App')9 .click()10 .elementByName('Activity')11 .click()12 .elementByName('Custom Title')13 .click()14 .elementByName('Custom Title')15 .sendAction('longPress', {x: 100, y: 100})16 .elementByName('Custom Title')17 .sendAction('longPress', {x: 100, y: 100, duration: 2000})18 .quit();19 .elementByName('Custom Title')20 .sendAction('longPress', {x: 100, y: 100, duration: 2000})
Using AI Code Generation
1driver.init({2 }).then(function() {3 driver.elementByClassName("android.widget.Button").then(function(el) {4 el.click().then(function() {5 driver.sendAction("com.example.android.test.ACTION");6 });7 });8 });9driver.init({10 }).then(function() {11 driver.elementByClassName("UIATextField").then(function(el) {12 el.sendKeys("Hello World");13 });14 });
Using AI Code Generation
1var webdriver = require('selenium-webdriver');2 }).build();3driver.findElement(webdriver.By.id('com.mycompany.myapp:id/myButton')).click();4driver.sendAction('tap', {element: 'com.mycompany.myapp:id/myButton'}).then(function() {5 console.log('Tapped on the button');6});7driver.quit();8var webdriver = require('selenium-webdriver');9 }).build();10driver.findElement(webdriver.By.id('com.mycompany.myapp:id/myButton')).click();11driver.findElement(webdriver.By.id('com.mycompany.myapp:id/myButton')).click();12driver.quit();
Using AI Code Generation
1driver.sendAction("mobile:scroll", {direction: 'down'});2driver.sendAction("mobile:scroll", {direction: 'down'});3driver.sendAction("mobile:scroll", {direction: 'down'});4driver.sendAction("mobile:scroll", {direction: 'down'});5driver.sendAction("mobile:scroll", {direction: 'down'});6driver.sendAction("mobile:scroll", {direction: 'down'});7driver.sendAction("mobile:scroll", {direction: 'down'});8driver.sendAction("mobile:scroll", {direction: 'down'});9driver.sendAction("mobile:scroll", {direction: 'down'});10driver.sendAction("mobile:scroll", {direction: 'down'});11driver.sendAction("mobile:scroll", {direction: 'down'});12driver.sendAction("mobile:scroll", {direction: 'down'});13driver.sendAction("mobile:scroll", {direction: 'down'});14driver.sendAction("mobile:scroll", {direction: 'down'});15driver.sendAction("mobile:scroll", {direction: 'down'});16driver.sendAction("mobile:scroll", {direction: 'down'});17driver.sendAction("mobile:scroll", {direction: 'down'});18driver.sendAction("mobile:scroll",
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!