Best JavaScript code snippet using appium
select-multiple.js
Source:select-multiple.js
1"use strict";2require("../helpers/setup");3let wd = require("wd"),4 Q = require('q'),5 dateTime = require('../helpers/datetime'),6 actions = require('../helpers/actions');7wd.addPromiseChainMethod('swipe', actions.swipe);8wd.addPromiseChainMethod('scrollTo', actions.scrollTo);9wd.addPromiseChainMethod('scrollDown', actions.scrollDown);10wd.addPromiseChainMethod('scrollUp', actions.scrollUp);11wd.addPromiseChainMethod('draw', actions.draw);12describe("Test AIO - Appearance (G4 v1712141604) Form", function () {13 this.timeout(2400000);14 var driver;15 var allPassed = true;16 before(function () {17 driver = wd.promiseChainRemote({host: 'localhost', port: 4723});18 var desired = {19 browserName: '',20 platformName: 'Android',21 platformVersion: '6.0.1',22 deviceName: 'Nexus 7',23 udid: '07d9024f',24 noReset: true,25 appActivity: 'vn.rta.cpms.activities.SplashScreenActivity',26 appPackage: 'vn.rta.rtsurvey'27 };28 return driver29 .init(desired)30 .setImplicitWaitTimeout(3000);31 });32 after(function () {33 console.log(allPassed ? '[PASSED]' : '[FAILED]');34 });35 afterEach(function () {36 allPassed = allPassed && this.currentTest.state === 'passed';37 });38 it("Enter pin number", function () {39 return driver40 .elementById('vn.rta.rtsurvey:id/pin_input')41 .setImmediateValue('1234')42 .sleep(5000);43 });44 it("Fill new form", function () {45 return driver46 .elementByAccessibilityId("menu_item_form_fillnew")47 .tap();48 });49 it("Open form", function () {50 return driver51 .elementByXPath('//android.widget.TextView[contains(@text, "AIO - Appearance")]')52 .catch(function(){53 return driver54 .elementById('vn.rta.rtsurvey:id/recycler')55 .getLocation()56 .then(function (loc) {57 var action = new wd.TouchAction();58 action59 .press({x: loc.x, y: loc.y + 1000})60 .wait(1000)61 .moveTo({x: loc.x, y: loc.y})62 .release();63 return driver.performTouchAction(action).sleep(1000)64 })65 .elementByXPath('//android.widget.TextView[contains(@text, "AIO - Appearance")]')66 })67 .tap()68 .sleep(5000);69 });70 it("Next Question", function () {71 return driver72 .elementById('vn.rta.rtsurvey:id/questionholder')73 .flick(-500, 1, 500)74 .elementByAccessibilityId('sections_select')75 .should.eventually.exist76 });77 it("sections_select : 2,16", function () {78 return driver79 .elementByAccessibilityId('sections_select')80 .then(function (el) {81 return el82 .elementsByClassName('android.widget.CheckBox')83 .then(function (els) {84 return Q.all([els[2].tap(), els[16].tap()])85 })86 })87 });88 it("Next Question", function () {89 return driver90 .elementById('vn.rta.rtsurvey:id/questionholder')91 .flick(-500, 1, 500)92 .elementByAccessibilityId('se_mul_c1')93 .should.eventually.exist94 });95 it("se_mul_c1 : 3,0", function () {96 return driver97 .elementByAccessibilityId('se_mul_c1')98 .then(function (el) {99 return el100 .elementsByClassName('android.widget.CheckBox')101 .then(function (els) {102 return Q.all([els[3].tap(), els[0].tap()])103 })104 })105 });106 it("Scroll To Specific Question", function () {107 return driver.scrollTo('//*[@content-desc="se_mul_c3"]');108 });109 it("se_mul_c3 : 1,2", function () {110 return driver111 .elementByAccessibilityId('se_mul_c3')112 .then(function (el) {113 return el114 .elementsByClassName('android.widget.CheckBox')115 .then(function (els) {116 return Q.all([els[1].tap(), els[2].tap()])117 })118 })119 });120 it("Scroll To Specific Question", function () {121 return driver.scrollTo('//*[@content-desc="se_mul_c4"]');122 });123 it("se_mul_c4 : 4,4", function () {124 return driver125 .elementByAccessibilityId('se_mul_c4')126 .then(function (el) {127 return el128 .elementsByClassName('android.widget.CheckBox')129 .then(function (els) {130 return Q.all([els[4].tap(), els[4].tap()])131 })132 })133 });134 it("Scroll To Specific Question", function () {135 return driver.scrollTo('//*[@content-desc="se_mul_c5"]');136 });137 it("se_mul_c5 : 2,4", function () {138 return driver139 .elementByAccessibilityId('se_mul_c5')140 .then(function (el) {141 return el142 .elementsByClassName('android.widget.CheckBox')143 .then(function (els) {144 return Q.all([els[2].tap(), els[4].tap()])145 })146 })147 });148 it("Scroll To Specific Question", function () {149 return driver.scrollTo('//*[@content-desc="se_mul_c6"]//android.widget.LinearLayout[2]//android.widget.TextView');150 });151 it("se_mul_c6 : 1,2", function () {152 return driver153 .elementByAccessibilityId('se_mul_c6')154 .then(function (el) {155 return el156 .elementByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')157 .tap()158 .elementsByClassName('android.widget.CheckedTextView')159 .then(function (els) {160 return Q.all([els[1].tap(), els[2].tap()])161 })162 .elementByClassName('android.widget.Button')163 .tap()164 })165 });166 it("Scroll To Specific Question", function () {167 return driver.scrollTo('//*[@content-desc="se_mul_c7"]//android.widget.LinearLayout[2]//android.widget.TextView');168 });169 it("se_mul_c7 : 3,3", function () {170 return driver171 .elementByAccessibilityId('se_mul_c7')172 .then(function (el) {173 return el174 .elementByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')175 .tap()176 .elementsByClassName('android.widget.CheckedTextView')177 .then(function (els) {178 return Q.all([els[3].tap(), els[3].tap()])179 })180 .elementByClassName('android.widget.Button')181 .tap()182 })183 });184 it("Scroll To Specific Question", function () {185 return driver.scrollTo('//*[@content-desc="se_mul_c8"]//android.widget.LinearLayout[2]//android.widget.TextView');186 });187 it("se_mul_c8 : 2,1", function () {188 return driver189 .elementByAccessibilityId('se_mul_c8')190 .then(function (el) {191 return el192 .elementByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')193 .tap()194 .elementsByClassName('android.widget.CheckedTextView')195 .then(function (els) {196 return Q.all([els[2].tap(), els[1].tap()])197 })198 .elementByClassName('android.widget.Button')199 .tap()200 })201 });202 it("Scroll To Specific Question", function () {203 return driver.scrollTo('//*[@content-desc="se_mul_c9"]//android.widget.GridView//android.widget.TextView');204 });205 it("se_mul_c9 : 3,1", function () {206 return driver207 .elementByAccessibilityId('se_mul_c9')208 .then(function (el) {209 return el210 .elementsByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')211 .then(function (els) {212 return Q.all([els[3].tap(), els[1].tap()])213 })214 })215 });216 it("Scroll To Specific Question", function () {217 return driver.scrollTo('//*[@content-desc="se_mul_c10"]//android.widget.GridView//android.widget.TextView');218 });219 it("se_mul_c10 : 3,4", function () {220 return driver221 .elementByAccessibilityId('se_mul_c10')222 .then(function (el) {223 return el224 .elementsByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')225 .then(function (els) {226 return Q.all([els[3].tap(), els[4].tap()])227 })228 })229 });230 it("Scroll To Specific Question", function () {231 return driver.scrollTo('//*[@content-desc="se_mul_c11"]//android.widget.GridView//android.widget.TextView');232 });233 it("se_mul_c11 : 2,0", function () {234 return driver235 .elementByAccessibilityId('se_mul_c11')236 .then(function (el) {237 return el238 .elementsByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')239 .then(function (els) {240 return Q.all([els[2].tap(), els[0].tap()])241 })242 })243 });244 it("Scroll To Specific Question", function () {245 return driver.scrollTo('//*[@content-desc="se_mul_c12"]//android.widget.GridView//android.widget.TextView');246 });247 it("se_mul_c12 : 3,2", function () {248 return driver249 .elementByAccessibilityId('se_mul_c12')250 .then(function (el) {251 return el252 .elementsByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')253 .then(function (els) {254 return Q.all([els[3].tap(), els[2].tap()])255 })256 })257 });258 it("Scroll To Specific Question", function () {259 return driver.scrollTo('//*[@content-desc="se_mul_c13"]//android.widget.GridView//android.widget.TextView');260 });261 it("se_mul_c13 : 4,2", function () {262 return driver263 .elementByAccessibilityId('se_mul_c13')264 .then(function (el) {265 return el266 .elementsByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')267 .then(function (els) {268 return Q.all([els[4].tap(), els[2].tap()])269 })270 })271 });272 it("Scroll To Specific Question", function () {273 return driver.scrollTo('//*[@content-desc="se_mul_c14"]//android.widget.GridView//android.widget.TextView');274 });275 it("se_mul_c14 : 0,0", function () {276 return driver277 .elementByAccessibilityId('se_mul_c14')278 .then(function (el) {279 return el280 .elementsByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')281 .then(function (els) {282 return Q.all([els[0].tap(), els[0].tap()])283 })284 })285 });286 it("Scroll To Specific Question", function () {287 return driver.scrollTo('//*[@content-desc="se_mul_c15"]//android.widget.GridView//android.widget.TextView');288 });289 it("se_mul_c15 : 0,4", function () {290 return driver291 .elementByAccessibilityId('se_mul_c15')292 .then(function (el) {293 return el294 .elementsByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')295 .then(function (els) {296 return Q.all([els[0].tap(), els[4].tap()])297 })298 })299 });300 it("Scroll To Specific Question", function () {301 return driver.scrollTo('//*[@content-desc="se_mul_c16"]//android.widget.GridView//android.widget.TextView');302 });303 it("se_mul_c16 : 4,2", function () {304 return driver305 .elementByAccessibilityId('se_mul_c16')306 .then(function (el) {307 return el308 .elementsByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')309 .then(function (els) {310 return Q.all([els[4].tap(), els[2].tap()])311 })312 })313 });314 it("Scroll To Specific Question", function () {315 return driver.scrollTo('//*[@content-desc="se_mul_c17"]//android.widget.LinearLayout[2]//android.widget.TextView');316 });317 it("se_mul_c17 : 0,2", function () {318 return driver319 .elementByAccessibilityId('se_mul_c17')320 .then(function (el) {321 return el322 .elementsByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')323 .then(function (els) {324 return Q.all([els[0].tap(), els[2].tap()])325 })326 })327 });328 it("Scroll To Specific Question", function () {329 return driver.scrollTo('//*[@content-desc="se_mul_c18"]//android.widget.LinearLayout[2]//android.widget.TextView');330 });331 it("se_mul_c18 : 2,0", function () {332 return driver333 .elementByAccessibilityId('se_mul_c18')334 .then(function (el) {335 return el336 .elementsByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')337 .then(function (els) {338 return Q.all([els[2].tap(), els[0].tap()])339 })340 })341 });342 it("Scroll To Specific Question", function () {343 return driver.scrollTo('//*[@content-desc="se_mul_c19"]//android.widget.LinearLayout[2]//android.widget.TextView');344 });345 it("se_mul_c19 : 1,3", function () {346 return driver347 .elementByAccessibilityId('se_mul_c19')348 .then(function (el) {349 return el350 .elementsByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')351 .then(function (els) {352 return Q.all([els[1].tap(), els[3].tap()])353 })354 })355 });356 it("Scroll To Specific Question", function () {357 return driver.scrollTo('//*[@content-desc="se_mul_c20"]//android.widget.LinearLayout[2]//android.widget.TextView');358 });359 it("se_mul_c20 : 0,2", function () {360 return driver361 .elementByAccessibilityId('se_mul_c20')362 .then(function (el) {363 return el364 .elementsByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')365 .then(function (els) {366 return Q.all([els[0].tap(), els[2].tap()])367 })368 })369 });370 it("Scroll To Specific Question", function () {371 return driver.scrollTo('//*[@content-desc="se_mul_c21"]//android.widget.LinearLayout[2]//android.widget.TextView');372 });373 it("se_mul_c21 : 2,2", function () {374 return driver375 .elementByAccessibilityId('se_mul_c21')376 .then(function (el) {377 return el378 .elementsByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')379 .then(function (els) {380 return Q.all([els[2].tap(), els[2].tap()])381 })382 })383 });384 it("Scroll To Specific Question", function () {385 return driver.scrollTo('//*[@content-desc="se_mul_c22"]//android.widget.LinearLayout[2]//android.widget.TextView');386 });387 it("se_mul_c22 : 0,4", function () {388 return driver389 .elementByAccessibilityId('se_mul_c22')390 .then(function (el) {391 return el392 .elementsByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')393 .then(function (els) {394 return Q.all([els[0].tap(), els[4].tap()])395 })396 })397 });398 it("Scroll To Specific Question", function () {399 return driver.scrollTo('//*[@content-desc="se_mul_c23"]//android.widget.LinearLayout[2]//android.widget.TextView');400 });401 it("se_mul_c23 : 2,4", function () {402 return driver403 .elementByAccessibilityId('se_mul_c23')404 .then(function (el) {405 return el406 .elementsByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')407 .then(function (els) {408 return Q.all([els[2].tap(), els[4].tap()])409 })410 })411 });412 it("Scroll To Specific Question", function () {413 return driver.scrollTo('//*[@content-desc="se_mul_c24"]//android.widget.LinearLayout[2]//android.widget.TextView');414 });415 it("se_mul_c24 : 4,4", function () {416 return driver417 .elementByAccessibilityId('se_mul_c24')418 .then(function (el) {419 return el420 .elementsByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')421 .then(function (els) {422 return Q.all([els[4].tap(), els[4].tap()])423 })424 })425 });426 it("Scroll To Specific Question", function () {427 return driver.scrollTo('//*[@content-desc="se_mul_c25"]//android.widget.LinearLayout[2]//android.widget.TextView');428 });429 it("se_mul_c25 : 4,0", function () {430 return driver431 .elementByAccessibilityId('se_mul_c25')432 .then(function (el) {433 return el434 .elementsByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')435 .then(function (els) {436 return Q.all([els[4].tap(), els[0].tap()])437 })438 })439 });440 it("Scroll To Specific Question", function () {441 return driver.scrollTo('//*[@content-desc="se_mul_c26"]//android.widget.LinearLayout[2]//android.widget.TextView');442 });443 it("se_mul_c26 : 2,4", function () {444 return driver445 .elementByAccessibilityId('se_mul_c26')446 .then(function (el) {447 return el448 .elementsByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')449 .then(function (els) {450 return Q.all([els[2].tap(), els[4].tap()])451 })452 })453 });454 it("Scroll To Specific Question", function () {455 return driver.scrollTo('//*[@content-desc="se_mul_c27"]//android.widget.LinearLayout[2]//android.widget.TextView');456 });457 it("se_mul_c27 : 2,3", function () {458 return driver459 .elementByAccessibilityId('se_mul_c27')460 .then(function (el) {461 return el462 .elementsByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')463 .then(function (els) {464 return Q.all([els[2].tap(), els[3].tap()])465 })466 })467 });468 it("Scroll To Specific Question", function () {469 return driver.scrollTo('//*[@content-desc="se_mul_c28"]//android.widget.LinearLayout[2]//android.widget.TextView');470 });471 it("se_mul_c28 : 3,1", function () {472 return driver473 .elementByAccessibilityId('se_mul_c28')474 .then(function (el) {475 return el476 .elementsByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')477 .then(function (els) {478 return Q.all([els[3].tap(), els[1].tap()])479 })480 })481 });482 it("Scroll To Specific Question", function () {483 return driver.scrollTo('//*[@content-desc="se_mul_c29"]//android.widget.MultiAutoCompleteTextView');484 });485 it("se_mul_c29 : 2,1", function () {486 return driver487 .elementByAccessibilityId('se_mul_c29')488 .then(el => el.elementById('vn.rta.rtsurvey:id/selection_view').setImmediateValue('h'))489 .sleep(1000)490 .elementById('vn.rta.rtsurvey:id/selection_view')491 .getLocation()492 .then(function (loc) {493 var ma = new wd.MultiAction(driver);494 var action_2 = new wd.TouchAction(driver);495 action_2.tap({x: loc.x + 100, y: loc.y + 324}).release();496 ma.add(action_2)497 var action_1 = new wd.TouchAction(driver);498 action_1.tap({x: loc.x + 100, y: loc.y + 227}).release();499 ma.add(action_1)500 return driver.performMultiAction(ma).sleep(3000);501 })502 .back().back().back();503 });504 it("Scroll To Specific Question", function () {505 return driver.scrollTo('//*[@content-desc="se_mul_c30"]//android.widget.MultiAutoCompleteTextView');506 });507 it("se_mul_c30 : 3,1", function () {508 return driver509 .elementByAccessibilityId('se_mul_c30')510 .then(el => el.elementById('vn.rta.rtsurvey:id/selection_view').setImmediateValue('h'))511 .sleep(1000)512 .elementById('vn.rta.rtsurvey:id/selection_view')513 .getLocation()514 .then(function (loc) {515 var ma = new wd.MultiAction(driver);516 var action_3 = new wd.TouchAction(driver);517 action_3.tap({x: loc.x + 100, y: loc.y + 324}).release();518 ma.add(action_3)519 var action_1 = new wd.TouchAction(driver);520 action_1.tap({x: loc.x + 100, y: loc.y + 227}).release();521 ma.add(action_1)522 return driver.performMultiAction(ma).sleep(3000);523 })524 .back().back().back();525 });526 it("Scroll To Specific Question", function () {527 return driver.scrollTo('//*[@content-desc="se_mul_c31"]//android.widget.MultiAutoCompleteTextView');528 });529 it("se_mul_c31 : 2,2", function () {530 return driver531 .elementByAccessibilityId('se_mul_c31')532 .then(el => el.elementById('vn.rta.rtsurvey:id/selection_view').setImmediateValue('h'))533 .sleep(1000)534 .elementById('vn.rta.rtsurvey:id/selection_view')535 .getLocation()536 .then(function (loc) {537 var ma = new wd.MultiAction(driver);538 var action_2 = new wd.TouchAction(driver);539 action_2.tap({x: loc.x + 100, y: loc.y + 324}).release();540 ma.add(action_2)541 var action_2 = new wd.TouchAction(driver);542 action_2.tap({x: loc.x + 100, y: loc.y + 324}).release();543 ma.add(action_2)544 return driver.performMultiAction(ma).sleep(3000);545 })546 .back().back().back();547 });548 it("Scroll To Specific Question", function () {549 return driver.scrollTo('//*[@content-desc="se_mul_c32"]//android.widget.MultiAutoCompleteTextView');550 });551 it("se_mul_c32 : 3,2", function () {552 return driver553 .elementByAccessibilityId('se_mul_c32')554 .then(el => el.elementById('vn.rta.rtsurvey:id/selection_view').setImmediateValue('h'))555 .sleep(1000)556 .elementById('vn.rta.rtsurvey:id/selection_view')557 .getLocation()558 .then(function (loc) {559 var ma = new wd.MultiAction(driver);560 var action_3 = new wd.TouchAction(driver);561 action_3.tap({x: loc.x + 100, y: loc.y + 324}).release();562 ma.add(action_3)563 var action_2 = new wd.TouchAction(driver);564 action_2.tap({x: loc.x + 100, y: loc.y + 324}).release();565 ma.add(action_2)566 return driver.performMultiAction(ma).sleep(3000);567 })568 .back().back().back();569 });570 it("Scroll To Specific Question", function () {571 return driver.scrollTo('//*[@content-desc="se_mul_c33"]//android.widget.MultiAutoCompleteTextView');572 });573 it("se_mul_c33 : 1,3", function () {574 return driver575 .elementByAccessibilityId('se_mul_c33')576 .then(el => el.elementById('vn.rta.rtsurvey:id/selection_view').setImmediateValue('h'))577 .sleep(1000)578 .elementById('vn.rta.rtsurvey:id/selection_view')579 .getLocation()580 .then(function (loc) {581 var ma = new wd.MultiAction(driver);582 var action_1 = new wd.TouchAction(driver);583 action_1.tap({x: loc.x + 100, y: loc.y + 227}).release();584 ma.add(action_1)585 var action_3 = new wd.TouchAction(driver);586 action_3.tap({x: loc.x + 100, y: loc.y + 324}).release();587 ma.add(action_3)588 return driver.performMultiAction(ma).sleep(3000);589 })590 .back().back().back();591 });592 it("Scroll To Specific Question", function () {593 return driver.scrollTo('//*[@content-desc="se_mul_c34"]//android.widget.MultiAutoCompleteTextView');594 });595 it("se_mul_c34 : 1,3", function () {596 return driver597 .elementByAccessibilityId('se_mul_c34')598 .then(el => el.elementById('vn.rta.rtsurvey:id/selection_view').setImmediateValue('h'))599 .sleep(1000)600 .elementById('vn.rta.rtsurvey:id/selection_view')601 .getLocation()602 .then(function (loc) {603 var ma = new wd.MultiAction(driver);604 var action_1 = new wd.TouchAction(driver);605 action_1.tap({x: loc.x + 100, y: loc.y + 227}).release();606 ma.add(action_1)607 var action_3 = new wd.TouchAction(driver);608 action_3.tap({x: loc.x + 100, y: loc.y + 324}).release();609 ma.add(action_3)610 return driver.performMultiAction(ma).sleep(3000);611 })612 .back().back().back();613 });614 it("Scroll To Specific Question", function () {615 return driver.scrollTo('//*[@content-desc="se_mul_c35"]//android.widget.EditText');616 });617 it("se_mul_c35 : 0,0", function () {618 return driver619 .elementByAccessibilityId('se_mul_c35')620 .then(el => el.elementByClassName('android.widget.EditText').setImmediateValue('h'))621 .sleep(1000)622 .elementById('vn.rta.rtsurvey:id/recycler_view')623 .then(el => el.elementByXPath('//android.widget.RelativeLayout[1]//android.widget.TextView').tap())624 .elementByAccessibilityId('se_mul_c35')625 .then(el => el.elementByClassName('android.widget.EditText').setImmediateValue('h'))626 .sleep(1000)627 .elementById('vn.rta.rtsurvey:id/recycler_view')628 .then(el => el.elementByXPath('//android.widget.RelativeLayout[1]//android.widget.TextView').tap())629 });630 it("Scroll To Specific Question", function () {631 return driver.scrollTo('//*[@content-desc="se_mul_c36"]//android.widget.EditText');632 });633 it("se_mul_c36 : 2,1", function () {634 return driver635 .elementByAccessibilityId('se_mul_c36')636 .then(el => el.elementByClassName('android.widget.EditText').setImmediateValue('h'))637 .sleep(1000)638 .elementById('vn.rta.rtsurvey:id/recycler_view')639 .then(el => el.elementByXPath('//android.widget.RelativeLayout[3]//android.widget.TextView').tap())640 .elementByAccessibilityId('se_mul_c36')641 .then(el => el.elementByClassName('android.widget.EditText').setImmediateValue('h'))642 .sleep(1000)643 .elementById('vn.rta.rtsurvey:id/recycler_view')644 .then(el => el.elementByXPath('//android.widget.RelativeLayout[2]//android.widget.TextView').tap())645 });646 it("Scroll To Specific Question", function () {647 return driver.scrollTo('//*[@content-desc="se_mul_c37"]//android.widget.EditText');648 });649 it("se_mul_c37 : 3,0", function () {650 return driver651 .elementByAccessibilityId('se_mul_c37')652 .then(el => el.elementByClassName('android.widget.EditText').setImmediateValue('h'))653 .sleep(1000)654 .elementById('vn.rta.rtsurvey:id/recycler_view')655 .then(el => el.elementByXPath('//android.widget.RelativeLayout[4]//android.widget.TextView').tap())656 .elementByAccessibilityId('se_mul_c37')657 .then(el => el.elementByClassName('android.widget.EditText').setImmediateValue('h'))658 .sleep(1000)659 .elementById('vn.rta.rtsurvey:id/recycler_view')660 .then(el => el.elementByXPath('//android.widget.RelativeLayout[1]//android.widget.TextView').tap())661 });662 it("Scroll To Specific Question", function () {663 return driver.scrollTo('//*[@content-desc="se_mul_c38"]//android.widget.EditText');664 });665 it("se_mul_c38 : 3,1", function () {666 return driver667 .elementByAccessibilityId('se_mul_c38')668 .then(el => el.elementByClassName('android.widget.EditText').setImmediateValue('h'))669 .sleep(1000)670 .elementById('vn.rta.rtsurvey:id/recycler_view')671 .then(el => el.elementByXPath('//android.widget.RelativeLayout[4]//android.widget.TextView').tap())672 .elementByAccessibilityId('se_mul_c38')673 .then(el => el.elementByClassName('android.widget.EditText').setImmediateValue('h'))674 .sleep(1000)675 .elementById('vn.rta.rtsurvey:id/recycler_view')676 .then(el => el.elementByXPath('//android.widget.RelativeLayout[2]//android.widget.TextView').tap())677 });678 it("Scroll To Specific Question", function () {679 return driver.scrollTo('//*[@content-desc="se_mul_c39"]//android.widget.LinearLayout[2]//android.widget.TextView');680 });681 it("se_mul_c39 : 1,4", function () {682 return driver683 .elementByAccessibilityId('se_mul_c39')684 .then(function (el) {685 return el686 .elementsByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')687 .then(function (els) {688 return Q.all([els[1].tap(), els[4].tap()])689 })690 })691 });692 it("Scroll To Specific Question", function () {693 return driver.scrollTo('//*[@content-desc="se_mul_c40"]//android.widget.LinearLayout[2]//android.widget.TextView');694 });695 it("se_mul_c40 : 2,4", function () {696 return driver697 .elementByAccessibilityId('se_mul_c40')698 .then(function (el) {699 return el700 .elementsByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')701 .then(function (els) {702 return Q.all([els[2].tap(), els[4].tap()])703 })704 })705 });706 it("Scroll To Specific Question", function () {707 return driver.scrollTo('//*[@content-desc="se_mul_c41"]//android.widget.LinearLayout[2]//android.widget.TextView');708 });709 it("se_mul_c41 : 0,0", function () {710 return driver711 .elementByAccessibilityId('se_mul_c41')712 .then(function (el) {713 return el714 .elementsByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')715 .then(function (els) {716 return Q.all([els[0].tap(), els[0].tap()])717 })718 })719 });720 it("Scroll To Specific Question", function () {721 return driver.scrollTo('//*[@content-desc="se_mul_c42"]//android.widget.LinearLayout[2]//android.widget.TextView');722 });723 it("se_mul_c42 : 0,3", function () {724 return driver725 .elementByAccessibilityId('se_mul_c42')726 .then(function (el) {727 return el728 .elementsByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')729 .then(function (els) {730 return Q.all([els[0].tap(), els[3].tap()])731 })732 })733 });734 it("Scroll To Specific Question", function () {735 return driver.scrollTo('//*[@content-desc="se_mul_c43"]//android.widget.LinearLayout[2]//android.widget.TextView');736 });737 it("se_mul_c43 : 4,3", function () {738 return driver739 .elementByAccessibilityId('se_mul_c43')740 .then(function (el) {741 return el742 .elementsByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')743 .then(function (els) {744 return Q.all([els[4].tap(), els[3].tap()])745 })746 })747 });748 it("Scroll To Specific Question", function () {749 return driver.scrollTo('//*[@content-desc="se_mul_c44"]//android.widget.LinearLayout[2]//android.widget.TextView');750 });751 it("se_mul_c44 : 2,3", function () {752 return driver753 .elementByAccessibilityId('se_mul_c44')754 .then(function (el) {755 return el756 .elementsByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')757 .then(function (els) {758 return Q.all([els[2].tap(), els[3].tap()])759 })760 })761 });762 it("Scroll To Specific Question", function () {763 return driver.scrollTo('//*[@content-desc="se_mul_c45"]//android.widget.LinearLayout[2]//android.widget.TextView');764 });765 it("se_mul_c45 : 0,4", function () {766 return driver767 .elementByAccessibilityId('se_mul_c45')768 .then(function (el) {769 return el770 .elementsByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')771 .then(function (els) {772 return Q.all([els[0].tap(), els[4].tap()])773 })774 })775 });776 it("Scroll To Specific Question", function () {777 return driver.scrollTo('//*[@content-desc="se_mul_c46"]//android.widget.LinearLayout[2]//android.widget.TextView');778 });779 it("se_mul_c46 : 3,1", function () {780 return driver781 .elementByAccessibilityId('se_mul_c46')782 .then(function (el) {783 return el784 .elementsByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')785 .then(function (els) {786 return Q.all([els[3].tap(), els[1].tap()])787 })788 })789 });790 it("Scroll To Specific Question", function () {791 return driver.scrollTo('//*[@content-desc="se_mul_c47"]//android.widget.LinearLayout[2]//android.widget.TextView');792 });793 it("se_mul_c47 : 0,0", function () {794 return driver795 .elementByAccessibilityId('se_mul_c47')796 .then(function (el) {797 return el798 .elementsByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')799 .then(function (els) {800 return Q.all([els[0].tap(), els[0].tap()])801 })802 })803 });804 it("Scroll To Specific Question", function () {805 return driver.scrollTo('//*[@content-desc="se_mul_c48"]//android.widget.LinearLayout[2]//android.widget.TextView');806 });807 it("se_mul_c48 : 1,4", function () {808 return driver809 .elementByAccessibilityId('se_mul_c48')810 .then(function (el) {811 return el812 .elementsByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')813 .then(function (els) {814 return Q.all([els[1].tap(), els[4].tap()])815 })816 })817 });818 it("Scroll To Specific Question", function () {819 return driver.scrollTo('//*[@content-desc="se_mul_c49"]//android.widget.LinearLayout[2]//android.widget.TextView');820 });821 it("se_mul_c49 : 3,0", function () {822 return driver823 .elementByAccessibilityId('se_mul_c49')824 .then(function (el) {825 return el826 .elementsByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')827 .then(function (els) {828 return Q.all([els[3].tap(), els[0].tap()])829 })830 })831 });832 it("Scroll To Specific Question", function () {833 return driver.scrollTo('//*[@content-desc="se_mul_c50"]//android.widget.LinearLayout[2]//android.widget.TextView');834 });835 it("se_mul_c50 : 0,0", function () {836 return driver837 .elementByAccessibilityId('se_mul_c50')838 .then(function (el) {839 return el840 .elementsByXPath('//android.widget.LinearLayout[2]//android.widget.TextView')841 .then(function (els) {842 return Q.all([els[0].tap(), els[0].tap()])843 })844 })845 });846 it("Scroll To Specific Question", function () {847 return driver.scrollTo('//*[@content-desc="se_mul_c51"]//android.widget.MultiAutoCompleteTextView');848 });849 it("se_mul_c51 : 1,2", function () {850 return driver851 .elementByAccessibilityId('se_mul_c51')852 .then(el => el.elementById('vn.rta.rtsurvey:id/selection_view').setImmediateValue('h'))853 .sleep(1000)854 .elementById('vn.rta.rtsurvey:id/selection_view')855 .getLocation()856 .then(function (loc) {857 var ma = new wd.MultiAction(driver);858 var action_1 = new wd.TouchAction(driver);859 action_1.tap({x: loc.x + 100, y: loc.y + 227}).release();860 ma.add(action_1)861 var action_2 = new wd.TouchAction(driver);862 action_2.tap({x: loc.x + 100, y: loc.y + 324}).release();863 ma.add(action_2)864 return driver.performMultiAction(ma).sleep(3000);865 })866 .back().back().back();867 });868 it("Scroll To Specific Question", function () {869 return driver.scrollTo('//*[@content-desc="se_mul_c52"]//android.widget.MultiAutoCompleteTextView');870 });871 it("se_mul_c52 : 3,4", function () {872 return driver873 .elementByAccessibilityId('se_mul_c52')874 .then(el => el.elementById('vn.rta.rtsurvey:id/selection_view').setImmediateValue('h'))875 .sleep(1000)876 .elementById('vn.rta.rtsurvey:id/selection_view')877 .getLocation()878 .then(function (loc) {879 var ma = new wd.MultiAction(driver);880 var action_3 = new wd.TouchAction(driver);881 action_3.tap({x: loc.x + 100, y: loc.y + 324}).release();882 ma.add(action_3)883 var action_4 = new wd.TouchAction(driver);884 action_4.tap({x: loc.x + 100, y: loc.y + 324}).release();885 ma.add(action_4)886 return driver.performMultiAction(ma).sleep(3000);887 })888 .back().back().back();889 });890 it("Scroll To Specific Question", function () {891 return driver.scrollTo('//*[@content-desc="se_mul_c53"]//android.widget.MultiAutoCompleteTextView');892 });893 it("se_mul_c53 : 1,3", function () {894 return driver895 .elementByAccessibilityId('se_mul_c53')896 .then(el => el.elementById('vn.rta.rtsurvey:id/selection_view').setImmediateValue('h'))897 .sleep(1000)898 .elementById('vn.rta.rtsurvey:id/selection_view')899 .getLocation()900 .then(function (loc) {901 var ma = new wd.MultiAction(driver);902 var action_1 = new wd.TouchAction(driver);903 action_1.tap({x: loc.x + 100, y: loc.y + 227}).release();904 ma.add(action_1)905 var action_3 = new wd.TouchAction(driver);906 action_3.tap({x: loc.x + 100, y: loc.y + 324}).release();907 ma.add(action_3)908 return driver.performMultiAction(ma).sleep(3000);909 })910 .back().back().back();911 });912 it("Scroll To Specific Question", function () {913 return driver.scrollTo('//*[@content-desc="se_mul_c54"]//android.widget.MultiAutoCompleteTextView');914 });915 it("se_mul_c54 : 4,0", function () {916 return driver917 .elementByAccessibilityId('se_mul_c54')918 .then(el => el.elementById('vn.rta.rtsurvey:id/selection_view').setImmediateValue('h'))919 .sleep(1000)920 .elementById('vn.rta.rtsurvey:id/selection_view')921 .getLocation()922 .then(function (loc) {923 var ma = new wd.MultiAction(driver);924 var action_4 = new wd.TouchAction(driver);925 action_4.tap({x: loc.x + 100, y: loc.y + 324}).release();926 ma.add(action_4)927 var action_0 = new wd.TouchAction(driver);928 action_0.tap({x: loc.x + 100, y: loc.y + 132}).release();929 ma.add(action_0)930 return driver.performMultiAction(ma).sleep(3000);931 })932 .back().back().back();933 });934 it("Scroll To Specific Question", function () {935 return driver.scrollTo('//*[@content-desc="se_mul_c55"]//android.widget.MultiAutoCompleteTextView');936 });937 it("se_mul_c55 : 3,0", function () {938 return driver939 .elementByAccessibilityId('se_mul_c55')940 .then(el => el.elementById('vn.rta.rtsurvey:id/selection_view').setImmediateValue('h'))941 .sleep(1000)942 .elementById('vn.rta.rtsurvey:id/selection_view')943 .getLocation()944 .then(function (loc) {945 var ma = new wd.MultiAction(driver);946 var action_3 = new wd.TouchAction(driver);947 action_3.tap({x: loc.x + 100, y: loc.y + 324}).release();948 ma.add(action_3)949 var action_0 = new wd.TouchAction(driver);950 action_0.tap({x: loc.x + 100, y: loc.y + 132}).release();951 ma.add(action_0)952 return driver.performMultiAction(ma).sleep(3000);953 })954 .back().back().back();955 });956 it("Scroll To Specific Question", function () {957 return driver.scrollTo('//*[@content-desc="se_mul_c56"]//android.widget.MultiAutoCompleteTextView');958 });959 it("se_mul_c56 : 3,1", function () {960 return driver961 .elementByAccessibilityId('se_mul_c56')962 .then(el => el.elementById('vn.rta.rtsurvey:id/selection_view').setImmediateValue('h'))963 .sleep(1000)964 .elementById('vn.rta.rtsurvey:id/selection_view')965 .getLocation()966 .then(function (loc) {967 var ma = new wd.MultiAction(driver);968 var action_3 = new wd.TouchAction(driver);969 action_3.tap({x: loc.x + 100, y: loc.y + 324}).release();970 ma.add(action_3)971 var action_1 = new wd.TouchAction(driver);972 action_1.tap({x: loc.x + 100, y: loc.y + 227}).release();973 ma.add(action_1)974 return driver.performMultiAction(ma).sleep(3000);975 })976 .back().back().back();977 });978 it("Scroll To Specific Question", function () {979 return driver.scrollTo('//*[@content-desc="se_mul_c57"]//android.widget.EditText');980 });981 it("se_mul_c57 : 4,2", function () {982 return driver983 .elementByAccessibilityId('se_mul_c57')984 .then(el => el.elementByClassName('android.widget.EditText').setImmediateValue('h'))985 .sleep(1000)986 .elementById('vn.rta.rtsurvey:id/recycler_view')987 .then(el => el.elementByXPath('//android.widget.RelativeLayout[5]//android.widget.TextView').tap())988 .elementByAccessibilityId('se_mul_c57')989 .then(el => el.elementByClassName('android.widget.EditText').setImmediateValue('h'))990 .sleep(1000)991 .elementById('vn.rta.rtsurvey:id/recycler_view')992 .then(el => el.elementByXPath('//android.widget.RelativeLayout[3]//android.widget.TextView').tap())993 });994 it("Scroll To Specific Question", function () {995 return driver.scrollTo('//*[@content-desc="se_mul_c58"]//android.widget.EditText');996 });997 it("se_mul_c58 : 4,3", function () {998 return driver999 .elementByAccessibilityId('se_mul_c58')1000 .then(el => el.elementByClassName('android.widget.EditText').setImmediateValue('h'))1001 .sleep(1000)1002 .elementById('vn.rta.rtsurvey:id/recycler_view')1003 .then(el => el.elementByXPath('//android.widget.RelativeLayout[5]//android.widget.TextView').tap())1004 .elementByAccessibilityId('se_mul_c58')1005 .then(el => el.elementByClassName('android.widget.EditText').setImmediateValue('h'))1006 .sleep(1000)1007 .elementById('vn.rta.rtsurvey:id/recycler_view')1008 .then(el => el.elementByXPath('//android.widget.RelativeLayout[4]//android.widget.TextView').tap())1009 });1010 it("Scroll To Specific Question", function () {1011 return driver.scrollTo('//*[@content-desc="se_mul_c59"]//android.widget.EditText');1012 });1013 it("se_mul_c59 : 3,4", function () {1014 return driver1015 .elementByAccessibilityId('se_mul_c59')1016 .then(el => el.elementByClassName('android.widget.EditText').setImmediateValue('h'))1017 .sleep(1000)1018 .elementById('vn.rta.rtsurvey:id/recycler_view')1019 .then(el => el.elementByXPath('//android.widget.RelativeLayout[4]//android.widget.TextView').tap())1020 .elementByAccessibilityId('se_mul_c59')1021 .then(el => el.elementByClassName('android.widget.EditText').setImmediateValue('h'))1022 .sleep(1000)1023 .elementById('vn.rta.rtsurvey:id/recycler_view')1024 .then(el => el.elementByXPath('//android.widget.RelativeLayout[5]//android.widget.TextView').tap())1025 });1026 it("se_mul_c60 : 3,0", function () {1027 return driver1028 .elementByAccessibilityId('se_mul_c60')1029 .then(el => el.elementByClassName('android.widget.EditText').setImmediateValue('h'))1030 .sleep(1000)1031 .elementById('vn.rta.rtsurvey:id/recycler_view')1032 .then(el => el.elementByXPath('//android.widget.RelativeLayout[4]//android.widget.TextView').tap())1033 .elementByAccessibilityId('se_mul_c60')1034 .then(el => el.elementByClassName('android.widget.EditText').setImmediateValue('h'))1035 .sleep(1000)1036 .elementById('vn.rta.rtsurvey:id/recycler_view')1037 .then(el => el.elementByXPath('//android.widget.RelativeLayout[1]//android.widget.TextView').tap())1038 });1039 it("Next Question", function () {1040 return driver1041 .elementById('vn.rta.rtsurvey:id/questionholder')1042 .flick(-500, 1, 500)1043 .elementByAccessibilityId('se_mul_c61')1044 .should.eventually.exist1045 });1046 it("se_mul_c61 : 4,1", function () {1047 return driver1048 .elementByAccessibilityId('se_mul_c61')1049 .then(function (el) {1050 return el1051 .elementsByClassName('android.widget.CheckBox')1052 .then(function (els) {1053 return Q.all([els[4].tap(), els[1].tap()])1054 })1055 })1056 });1057 it("se_mul_c62 : 3,0", function () {1058 return driver1059 .elementByAccessibilityId('se_mul_c62')1060 .then(function (el) {1061 return el1062 .elementsByClassName('android.widget.CheckBox')1063 .then(function (els) {1064 return Q.all([els[3].tap(), els[0].tap()])1065 })1066 })1067 });1068 it("Next Question", function () {1069 return driver1070 .elementById('vn.rta.rtsurvey:id/questionholder')1071 .flick(-500, 1, 500)1072 .elementByAccessibilityId('exit1')1073 .should.eventually.exist1074 });1075 it("exit1 : 1", function () {1076 return driver1077 .elementByAccessibilityId('exit1')1078 .then(el => el.elementByXPath('//android.widget.RelativeLayout[1]//android.widget.RadioButton').tap())1079 });1080 it("Next Question", function () {1081 return driver1082 .elementById('vn.rta.rtsurvey:id/questionholder')1083 .flick(-500, 1, 500)1084 .elementByAccessibilityId('text_q2')1085 .should.eventually.exist1086 });1087 it("text_q2 : ", function () {1088 return driver1089 .elementByAccessibilityId('text_q2')1090 .then(function (el) {1091 return el1092 .elementByClassName('android.widget.TextView')1093 .tap();1094 })1095 });...
select-one.js
Source:select-one.js
1"use strict";2require("./../helpers/setup");3var wd = require("wd"),4 Q = require('q'),5 actions = require('./../helpers/actions');6wd.addPromiseChainMethod('swipe', actions.swipe);7wd.addPromiseChainMethod('scrollTo', actions.scrollTo);8wd.addPromiseChainMethod('scrollUp', actions.scrollUp);9wd.addPromiseChainMethod('scrollDown', actions.scrollDown);10describe("Test AIO - Appearance (G4 v1712141604) Form", function () {11 this.timeout(2400000);12 var driver;13 before(function () {14 driver = wd.promiseChainRemote({host: 'localhost', port: 4723});15 require("./../helpers/logging").configure(driver);16 var desired = {17 browserName: '',18 platformName: 'Android',19 platformVersion: '5.1',20 deviceName: 'Nexus 7',21 udid: '072161f6',22 noReset: true,23 appActivity: 'vn.rta.cpms.activities.SplashScreenActivity',24 appPackage: 'vn.rta.rtsurvey'25 };26 return driver27 .init(desired)28 .setImplicitWaitTimeout(3000);29 });30 31 it("Enter pin number", function () {32 return driver33 .elementById('vn.rta.rtsurvey:id/pin_input')34 .setImmediateValue('1234')35 .sleep(5000);36 });37 it("Fill new form", function () {38 return driver39 .elementByAccessibilityId("menu_item_form_fillnew")40 .tap();41 });42 it("Open form", function () {43 return driver44 .elementByXPath('//android.widget.TextView[contains(@text, "AIO - Appearance")]')45 .tap()46 .sleep(5000);47 });48 it("Next Question", function () {49 return driver50 .elementById('vn.rta.rtsurvey:id/questionholder')51 .flick(-500, 1, 500)52 .elementByAccessibilityId('sections_select')53 .should.eventually.exist54 });55 it("sections_select : 1,16", function () {56 return driver57 .elementByAccessibilityId('sections_select')58 .then(function (el) {59 return el60 .elementsByClassName('android.widget.CheckBox')61 .then(function (els) {62 return Q.all([els[1].tap(), els[16].tap()])63 })64 })65 });66 it("Next Question", function () {67 return driver68 .elementById('vn.rta.rtsurvey:id/questionholder')69 .flick(-500, 1, 500)70 .elementByAccessibilityId('se_one_b2')71 .should.eventually.exist72 });73 it("se_one_b2 : 3", function () {74 return driver75 .elementByAccessibilityId('se_one_b2')76 .then(el => el.elementByXPath('//android.widget.RelativeLayout[3]//android.widget.RadioButton').tap())77 });78 it("se_one_b2 : 0", function () {79 return driver80 .elementByAccessibilityId('se_one_b2')81 .then(el => el.elementsByClassName('android.widget.RadioButton'))82 .then(els => els[0].tap())83 });84 it("se_one_b2 : 1", function () {85 return driver86 .elementByAccessibilityId('se_one_b2')87 .then(el => el.elementsByClassName('android.widget.RadioButton'))88 .at(1)89 .tap()90 });91 /*it("se_one_b3 : 3", function () {92 return driver93 .elementByAccessibilityId('se_one_b3')94 .then(function (el) {95 return el96 .elementByClassName('android.widget.RatingBar')97 .then(function (el) {98 return Q.all([99 el.getSize(),100 el.getLocation()101 ])102 .then(function (res) {103 let size = res[0];104 let loc = res[1];105 let yCenter = size.height / 2;106 let starWidth = size.width / 5;107 let action = new wd.TouchAction(driver);108 action.tap({x:loc.x+2*starWidth+yCenter, y:loc.y+yCenter});109 return driver.performTouchAction(action);110 })111 })112 })113 });114 it("se_one_b4 : 5", function () {115 return driver116 .elementByAccessibilityId('se_one_b4')117 .then(function (el) {118 return el119 .elementByClassName('android.widget.RatingBar')120 .then(function (el) {121 return Q.all([122 el.getSize(),123 el.getLocation()124 ])125 .then(function (res) {126 let size = res[0];127 let loc = res[1];128 let yCenter = size.height / 2;129 let starWidth = size.width / 5;130 let action = new wd.TouchAction(driver);131 action.tap({x:loc.x+4*starWidth+yCenter, y:loc.y+yCenter});132 return driver.performTouchAction(action);133 })134 })135 })136 });137 it("se_one_b5 : 1", function () {138 return driver139 .elementByAccessibilityId('se_one_b5')140 .then(function (el) {141 return el142 .elementByClassName('android.widget.RatingBar')143 .then(function (el) {144 return Q.all([145 el.getSize(),146 el.getLocation()147 ])148 .then(function (res) {149 let size = res[0];150 let loc = res[1];151 let yCenter = size.height / 2;152 let starWidth = size.width / 5;153 let action = new wd.TouchAction(driver);154 action.tap({x:loc.x+starWidth+yCenter, y:loc.y+yCenter});155 return driver.performTouchAction(action);156 })157 })158 })159 });160 it("se_one_b6 : 1", function () {161 return driver162 .elementByAccessibilityId('se_one_b6')163 .then(function (el) {164 return el165 .elementByClassName('android.widget.RatingBar')166 .then(function (el) {167 return Q.all([168 el.getSize(),169 el.getLocation()170 ])171 .then(function (res) {172 let size = res[0];173 let loc = res[1];174 let yCenter = size.height / 2;175 let starWidth = size.width / 5;176 let action = new wd.TouchAction(driver);177 action.tap({x:loc.x+starWidth+yCenter, y:loc.y+yCenter});178 return driver.performTouchAction(action);179 })180 })181 })182 });183 it("se_one_b7 : 5", function () {184 return driver185 .elementByAccessibilityId('se_one_b7')186 .then(function (el) {187 return el188 .elementByClassName('android.widget.RatingBar')189 .then(function (el) {190 return Q.all([191 el.getSize(),192 el.getLocation()193 ])194 .then(function (res) {195 let size = res[0];196 let loc = res[1];197 let yCenter = size.height / 2;198 let starWidth = size.width / 5;199 let action = new wd.TouchAction(driver);200 action.tap({x:loc.x+4*starWidth+yCenter, y:loc.y+yCenter});201 return driver.performTouchAction(action);202 })203 })204 })205 });206 it("se_one_b8 : 4", function () {207 return driver208 .elementByAccessibilityId('se_one_b8')209 .then(function (el) {210 return el211 .elementByClassName('android.widget.RatingBar')212 .then(function (el) {213 return Q.all([214 el.getSize(),215 el.getLocation()216 ])217 .then(function (res) {218 let size = res[0];219 let loc = res[1];220 let yCenter = size.height / 2;221 let starWidth = size.width / 5;222 let action = new wd.TouchAction(driver);223 action.tap({x:loc.x+3*starWidth+yCenter, y:loc.y+yCenter});224 return driver.performTouchAction(action);225 })226 })227 })228 });229 it("se_one_b9 : 4", function () {230 return driver231 .elementByAccessibilityId('se_one_b9')232 .then(function (el) {233 return el234 .elementByClassName('android.widget.RatingBar')235 .then(function (el) {236 return Q.all([237 el.getSize(),238 el.getLocation()239 ])240 .then(function (res) {241 let size = res[0];242 let loc = res[1];243 let yCenter = size.height / 2;244 let starWidth = size.width / 5;245 let action = new wd.TouchAction(driver);246 action.tap({x:loc.x+3*starWidth+yCenter, y:loc.y+yCenter});247 return driver.performTouchAction(action);248 })249 })250 })251 });252 it("Scroll To Specific Question", function () {253 return driver.scrollTo('//*[@content-desc="se_one_b10"]//android.widget.RatingBar');254 });255 it("se_one_b10 : 4", function () {256 return driver257 .elementByAccessibilityId('se_one_b10')258 .then(function (el) {259 return el260 .elementByClassName('android.widget.RatingBar')261 .then(function (el) {262 return Q.all([263 el.getSize(),264 el.getLocation()265 ])266 .then(function (res) {267 let size = res[0];268 let loc = res[1];269 let yCenter = size.height / 2;270 let starWidth = size.width / 5;271 let action = new wd.TouchAction(driver);272 action.tap({x:loc.x+3*starWidth+yCenter, y:loc.y+yCenter});273 return driver.performTouchAction(action);274 })275 })276 })277 });278 it("Scroll To Specific Question", function () {279 return driver.scrollTo('//*[@content-desc="se_one_b17"]//android.widget.LinearLayout[2]//android.widget.TextView');280 });281 it("se_one_b17 : 3", function () {282 return driver283 .elementByAccessibilityId('se_one_b17')284 .then(el => el.elementByXPath('//android.widget.LinearLayout[2]//android.widget.TextView').tap())285 .elementByXPath('//android.widget.ListView//android.widget.CheckedTextView[3]').tap()286 });287 it("Scroll To Specific Question", function () {288 return driver.scrollTo('//*[@content-desc="se_one_b18"]//android.widget.LinearLayout[2]//android.widget.TextView');289 });290 it("se_one_b18 : 1", function () {291 return driver292 .elementByAccessibilityId('se_one_b18')293 .then(el => el.elementByXPath('//android.widget.LinearLayout[2]//android.widget.TextView').tap())294 .elementByXPath('//android.widget.ListView//android.widget.CheckedTextView[1]').tap()295 });296 it("Scroll To Specific Question", function () {297 return driver.scrollTo('//*[@content-desc="se_one_b19"]//android.widget.LinearLayout[2]//android.widget.TextView');298 });299 it("se_one_b19 : 4", function () {300 return driver301 .elementByAccessibilityId('se_one_b19')302 .then(el => el.elementByXPath('//android.widget.LinearLayout[2]//android.widget.TextView').tap())303 .elementByXPath('//android.widget.ListView//android.widget.CheckedTextView[4]').tap()304 });305 it("Scroll To Specific Question", function () {306 return driver.scrollTo('//*[@content-desc="se_one_b20"]//android.widget.GridView//android.widget.TextView[4]');307 });308 it("se_one_b20 : 4", function () {309 return driver310 .elementByAccessibilityId('se_one_b20')311 .then(el => el.elementByXPath('//android.widget.GridView//android.widget.TextView[4]').tap())312 });313 it("Scroll To Specific Question", function () {314 return driver.scrollTo('//*[@content-desc="se_one_b21"]//android.widget.GridView//android.widget.TextView[4]');315 });316 it("se_one_b21 : 2", function () {317 return driver318 .elementByAccessibilityId('se_one_b21')319 .then(el => el.elementByXPath('//android.widget.GridView//android.widget.TextView[4]').tap())320 });321 it("Scroll To Specific Question", function () {322 return driver.scrollTo('//*[@content-desc="se_one_b22"]//android.widget.GridView//android.widget.TextView[2]');323 });324 it("se_one_b22 : 2", function () {325 return driver326 .elementByAccessibilityId('se_one_b22')327 .then(el => el.elementByXPath('//android.widget.GridView//android.widget.TextView[2]').tap())328 });329 it("Scroll To Specific Question", function () {330 return driver.scrollTo('//*[@content-desc="se_one_b23"]//android.widget.GridView//android.widget.TextView[1]');331 });332 it("se_one_b23 : 1", function () {333 return driver334 .elementByAccessibilityId('se_one_b23')335 .then(el => el.elementByXPath('//android.widget.GridView//android.widget.TextView[1]').tap())336 });337 it("Scroll To Specific Question", function () {338 return driver.scrollTo('//*[@content-desc="se_one_b24"]//android.widget.GridView//android.widget.TextView[1]');339 });340 it("se_one_b24 : 1", function () {341 return driver342 .elementByAccessibilityId('se_one_b24')343 .then(el => el.elementByXPath('//android.widget.GridView//android.widget.TextView[1]').tap())344 });345 it("Scroll To Specific Question", function () {346 return driver.scrollTo('//*[@content-desc="se_one_b25"]//android.widget.GridView//android.widget.TextView[2]');347 });348 it("se_one_b25 : 2", function () {349 return driver350 .elementByAccessibilityId('se_one_b25')351 .then(el => el.elementByXPath('//android.widget.GridView//android.widget.TextView[2]').tap())352 });353 it("Scroll To Specific Question", function () {354 return driver.scrollTo('//*[@content-desc="se_one_b26"]//android.widget.GridView//android.widget.TextView[4]');355 });356 it("se_one_b26 : 4", function () {357 return driver358 .elementByAccessibilityId('se_one_b26')359 .then(el => el.elementByXPath('//android.widget.GridView//android.widget.TextView[4]').tap())360 });361 it("Scroll To Specific Question", function () {362 return driver.scrollTo('//*[@content-desc="se_one_b27"]//android.widget.GridView//android.widget.TextView[1]');363 });364 it("se_one_b27 : 1", function () {365 return driver366 .elementByAccessibilityId('se_one_b27')367 .then(el => el.elementByXPath('//android.widget.GridView//android.widget.TextView[1]').tap())368 });369 it("Scroll To Specific Question", function () {370 return driver.scrollTo('//*[@content-desc="se_one_b28"]//android.widget.LinearLayout[2]//android.widget.TextView[2]');371 });372 it("se_one_b28 : 2", function () {373 return driver374 .elementByAccessibilityId('se_one_b28')375 .then(el => el.elementByXPath('//android.widget.LinearLayout[2]//android.widget.TextView[2]').tap())376 });377 it("Scroll To Specific Question", function () {378 return driver.scrollTo('//*[@content-desc="se_one_b29"]//android.widget.LinearLayout[2]//android.widget.TextView[1]');379 });380 it("se_one_b29 : 1", function () {381 return driver382 .elementByAccessibilityId('se_one_b29')383 .then(el => el.elementByXPath('//android.widget.LinearLayout[2]//android.widget.TextView[1]').tap())384 });385 it("Scroll To Specific Question", function () {386 return driver.scrollTo('//*[@content-desc="se_one_b30"]//android.widget.LinearLayout[2]//android.widget.TextView[4]');387 });388 it("se_one_b30 : 4", function () {389 return driver390 .elementByAccessibilityId('se_one_b30')391 .then(el => el.elementByXPath('//android.widget.LinearLayout[2]//android.widget.TextView[4]').tap())392 });393 it("Scroll To Specific Question", function () {394 return driver.scrollTo('//*[@content-desc="se_one_b31"]//android.widget.LinearLayout[2]//android.widget.TextView[3]');395 });396 it("se_one_b31 : 3", function () {397 return driver398 .elementByAccessibilityId('se_one_b31')399 .then(el => el.elementByXPath('//android.widget.LinearLayout[2]//android.widget.TextView[3]').tap())400 });401 it("Scroll To Specific Question", function () {402 return driver.scrollTo('//*[@content-desc="se_one_b32"]//android.widget.LinearLayout[2]//android.widget.TextView[3]');403 });404 it("se_one_b32 : 3", function () {405 return driver406 .elementByAccessibilityId('se_one_b32')407 .then(el => el.elementByXPath('//android.widget.LinearLayout[2]//android.widget.TextView[3]').tap())408 });409 it("Scroll To Specific Question", function () {410 return driver.scrollTo('//*[@content-desc="se_one_b33"]//android.widget.LinearLayout[2]//android.widget.TextView[2]');411 });412 it("se_one_b33 : 2", function () {413 return driver414 .elementByAccessibilityId('se_one_b33')415 .then(el => el.elementByXPath('//android.widget.LinearLayout[2]//android.widget.TextView[2]').tap())416 });417 it("Scroll To Specific Question", function () {418 return driver.scrollTo('//*[@content-desc="se_one_b34"]//android.widget.LinearLayout[2]//android.widget.TextView[1]');419 });420 // error421 it("se_one_b34 : 1", function () {422 return driver423 .elementByAccessibilityId('se_one_b34')424 .then(el => el.elementByXPath('//android.widget.LinearLayout[2]//android.widget.TextView[1]').tap())425 });426 it("Scroll To Specific Question", function () {427 return driver.scrollTo('//*[@content-desc="se_one_b35"]//android.widget.LinearLayout[2]//android.widget.TextView[2]');428 });429 it("se_one_b35 : 2", function () {430 return driver431 .elementByAccessibilityId('se_one_b35')432 .then(el => el.elementByXPath('//android.widget.LinearLayout[2]//android.widget.TextView[2]').tap())433 });434 it("Scroll To Specific Question", function () {435 return driver.scrollTo('//*[@content-desc="se_one_b36"]//android.widget.LinearLayout[2]//android.widget.TextView[1]');436 });437 it("se_one_b36 : 1", function () {438 return driver439 .elementByAccessibilityId('se_one_b36')440 .then(el => el.elementByXPath('//android.widget.LinearLayout[2]//android.widget.TextView[1]').tap())441 });442 it("Scroll To Specific Question", function () {443 return driver.scrollTo('//*[@content-desc="se_one_b37"]//android.widget.LinearLayout[2]//android.widget.TextView[3]');444 });445 it("se_one_b37 : 3", function () {446 return driver447 .elementByAccessibilityId('se_one_b37')448 .then(el => el.elementByXPath('//android.widget.LinearLayout[2]//android.widget.TextView[3]').tap())449 });450 it("Scroll To Specific Question", function () {451 return driver.scrollTo('//*[@content-desc="se_one_b38"]//android.widget.LinearLayout[2]//android.widget.TextView[1]');452 });453 it("se_one_b38 : 1", function () {454 return driver455 .elementByAccessibilityId('se_one_b38')456 .then(el => el.elementByXPath('//android.widget.LinearLayout[2]//android.widget.TextView[1]').tap())457 });458 it("Scroll To Specific Question", function () {459 return driver.scrollTo('//*[@content-desc="se_one_b39"]//android.widget.LinearLayout[2]//android.widget.TextView[4]');460 });461 it("se_one_b39 : 4", function () {462 return driver463 .elementByAccessibilityId('se_one_b39')464 .then(el => el.elementByXPath('//android.widget.LinearLayout[2]//android.widget.TextView[4]').tap())465 });466 it("Scroll To Specific Question", function () {467 return driver.scrollTo('//*[@content-desc="se_one_b40"]//*[@resource-id="vn.rta.rtsurvey:id/selection_view"]');468 });469 it("se_one_b40 : 2", function () {470 return driver471 .elementByAccessibilityId('se_one_b40')472 .then(el => el.elementById('vn.rta.rtsurvey:id/selection_view').setImmediateValue('h'))473 .sleep(1000)474 .elementById('vn.rta.rtsurvey:id/selection_view')475 .getLocation()476 .then(function (loc) {477 var action = new wd.TouchAction(driver);478 action.tap({x: loc.x + 100, y: loc.y + 290});479 return driver.performTouchAction(action).sleep(1000)480 })481 .back().back().back()482 });483 it("Scroll To Specific Question", function () {484 return driver.scrollTo('//*[@content-desc="se_one_b41"]//*[@resource-id="vn.rta.rtsurvey:id/selection_view"]');485 });486 it("se_one_b41 : 2", function () {487 return driver488 .elementByAccessibilityId('se_one_b41')489 .then(el => el.elementById('vn.rta.rtsurvey:id/selection_view').setImmediateValue('h'))490 .sleep(1000)491 .elementById('vn.rta.rtsurvey:id/selection_view')492 .getLocation()493 .then(function (loc) {494 var action = new wd.TouchAction();495 action.tap({x: loc.x + 100, y: loc.y + 290}).release();496 return driver.performTouchAction(action).sleep(1000)497 })498 .back().back().back()499 });500 it("Scroll To Specific Question", function () {501 return driver.scrollTo('//*[@content-desc="se_one_b42"]//*[@resource-id="vn.rta.rtsurvey:id/selection_view"]');502 });503 it("se_one_b42 : 2", function () {504 return driver505 .elementByAccessibilityId('se_one_b42')506 .then(el => el.elementById('vn.rta.rtsurvey:id/selection_view').setImmediateValue('h'))507 .sleep(1000)508 .elementById('vn.rta.rtsurvey:id/selection_view')509 .getLocation()510 .then(function (loc) {511 var action = new wd.TouchAction();512 action.tap({x: loc.x + 100, y: loc.y + 290}).release();513 return driver.performTouchAction(action).sleep(1000)514 })515 .back().back().back()516 });517 it("Scroll To Specific Question", function () {518 return driver.scrollTo('//*[@content-desc="se_one_b43"]//*[@resource-id="vn.rta.rtsurvey:id/selection_view"]');519 });520 it("se_one_b43 : 1", function () {521 return driver522 .elementByAccessibilityId('se_one_b43')523 .then(el => el.elementById('vn.rta.rtsurvey:id/selection_view').setImmediateValue('h'))524 .sleep(1000)525 .elementById('vn.rta.rtsurvey:id/selection_view')526 .getLocation()527 .then(function (loc) {528 var action = new wd.TouchAction();529 action.tap({x: loc.x + 100, y: loc.y + 205}).release();530 return driver.performTouchAction(action).sleep(1000)531 })532 .back().back().back()533 });534 it("Scroll To Specific Question", function () {535 return driver.scrollTo('//*[@content-desc="se_one_b44"]//*[@resource-id="vn.rta.rtsurvey:id/selection_view"]');536 });537 it("se_one_b44 : 3", function () {538 return driver539 .elementByAccessibilityId('se_one_b44')540 .then(el => el.elementById('vn.rta.rtsurvey:id/selection_view').setImmediateValue('h'))541 .sleep(1000)542 .elementById('vn.rta.rtsurvey:id/selection_view')543 .getLocation()544 .then(function (loc) {545 var action = new wd.TouchAction();546 action.tap({x: loc.x + 100, y: loc.y + 290});547 return driver.performTouchAction(action).sleep(1000)548 })549 .back().back().back()550 });551 it("Scroll To Specific Question", function () {552 return driver.scrollTo('//*[@content-desc="se_one_b45"]//*[@resource-id="vn.rta.rtsurvey:id/selection_view"]');553 });554 it("se_one_b45 : 3", function () {555 return driver556 .elementByAccessibilityId('se_one_b45')557 .then(el => el.elementById('vn.rta.rtsurvey:id/selection_view').setImmediateValue('h'))558 .sleep(1000)559 .elementById('vn.rta.rtsurvey:id/selection_view')560 .getLocation()561 .then(function (loc) {562 var action = new wd.TouchAction();563 action.tap({x: loc.x + 100, y: loc.y + 290});564 return driver.performTouchAction(action).sleep(1000)565 })566 .back().back().back()567 });568 it("Scroll To Specific Question", function () {569 return driver.scrollTo('//*[@content-desc="se_one_b46"]//android.widget.EditText');570 });571 it("se_one_b46 : 1", function () {572 return driver573 .elementByAccessibilityId('se_one_b46')574 .then(el => el.elementByClassName('android.widget.EditText').setImmediateValue('h'))575 .sleep(1000)576 .elementById('vn.rta.rtsurvey:id/recycler_view')577 .then(el => el.elementByXPath('//android.widget.RelativeLayout[1]//android.widget.TextView').tap())578 });579 it("Scroll To Specific Question", function () {580 return driver.scrollTo('//*[@content-desc="se_one_b47"]//android.widget.EditText');581 });582 it("se_one_b47 : 2", function () {583 return driver584 .elementByAccessibilityId('se_one_b47')585 .then(el => el.elementByClassName('android.widget.EditText').setImmediateValue('h'))586 .sleep(1000)587 .elementById('vn.rta.rtsurvey:id/recycler_view')588 .then(el => el.elementByXPath('//android.widget.RelativeLayout[2]//android.widget.TextView').tap())589 });590 it("Scroll To Specific Question", function () {591 return driver.scrollTo('//*[@content-desc="se_one_b48"]//android.widget.EditText');592 });593 it("se_one_b48 : 3", function () {594 return driver595 .elementByAccessibilityId('se_one_b48')596 .then(el => el.elementByClassName('android.widget.EditText').setImmediateValue('h'))597 .sleep(1000)598 .elementById('vn.rta.rtsurvey:id/recycler_view')599 .then(el => el.elementByXPath('//android.widget.RelativeLayout[3]//android.widget.TextView').tap())600 });601 it("Scroll To Specific Question", function () {602 return driver.scrollTo('//*[@content-desc="se_one_b49"]//android.widget.EditText');603 });604 it("se_one_b49 : 4", function () {605 return driver606 .elementByAccessibilityId('se_one_b49')607 .then(el => el.elementByClassName('android.widget.EditText').setImmediateValue('h'))608 .sleep(1000)609 .elementById('vn.rta.rtsurvey:id/recycler_view')610 .then(el => el.elementByXPath('//android.widget.RelativeLayout[4]//android.widget.TextView').tap())611 });612 it("Scroll To Specific Question", function () {613 return driver.scrollTo('//*[@content-desc="se_one_b50"]//android.widget.LinearLayout[2]//android.widget.TextView[4]');614 });615 it("se_one_b50 : 4", function () {616 return driver617 .elementByAccessibilityId('se_one_b50')618 .then(el => el.elementByXPath('//android.widget.LinearLayout[2]//android.widget.TextView[4]').tap())619 });620 it("Scroll To Specific Question", function () {621 return driver.scrollTo('//*[@content-desc="se_one_b51"]//android.widget.LinearLayout[2]//android.widget.TextView[2]');622 });623 it("se_one_b51 : 2", function () {624 return driver625 .elementByAccessibilityId('se_one_b51')626 .then(el => el.elementByXPath('//android.widget.LinearLayout[2]//android.widget.TextView[2]').tap())627 });628 it("Scroll To Specific Question", function () {629 return driver.scrollTo('//*[@content-desc="se_one_b52"]//android.widget.LinearLayout[2]//android.widget.TextView[2]');630 });631 it("se_one_b52 : 2", function () {632 return driver633 .elementByAccessibilityId('se_one_b52')634 .then(el => el.elementByXPath('//android.widget.LinearLayout[2]//android.widget.TextView[2]').tap())635 });636 it("Scroll To Specific Question", function () {637 return driver.scrollTo('//*[@content-desc="se_one_b53"]//android.widget.LinearLayout[2]//android.widget.TextView[2]');638 });639 it("se_one_b53 : 2", function () {640 return driver641 .elementByAccessibilityId('se_one_b53')642 .then(el => el.elementByXPath('//android.widget.LinearLayout[2]//android.widget.TextView[2]').tap())643 });644 it("Scroll To Specific Question", function () {645 return driver.scrollTo('//*[@content-desc="se_one_b50"]//android.widget.LinearLayout[2]//android.widget.TextView[2]');646 });647 it("se_one_b54 : 2", function () {648 return driver649 .elementByAccessibilityId('se_one_b54')650 .then(el => el.elementByXPath('//android.widget.LinearLayout[2]//android.widget.TextView[2]').tap())651 });652 it("Scroll To Specific Question", function () {653 return driver.scrollTo('//*[@content-desc="se_one_b55"]//android.widget.LinearLayout[2]//android.widget.TextView[2]');654 });655 it("se_one_b55 : 2", function () {656 return driver657 .elementByAccessibilityId('se_one_b55')658 .then(el => el.elementByXPath('//android.widget.LinearLayout[2]//android.widget.TextView[2]').tap())659 });660 it("Scroll To Specific Question", function () {661 return driver.scrollTo('//*[@content-desc="se_one_b56"]//android.widget.LinearLayout[2]//android.widget.TextView[2]');662 });663 it("se_one_b56 : 2", function () {664 return driver665 .elementByAccessibilityId('se_one_b56')666 .then(el => el.elementByXPath('//android.widget.LinearLayout[2]//android.widget.TextView[2]').tap())667 });668 it("Scroll To Specific Question", function () {669 return driver.scrollTo('//*[@content-desc="se_one_b57"]//android.widget.LinearLayout[2]//android.widget.TextView[2]');670 });671 it("se_one_b57 : 2", function () {672 return driver673 .elementByAccessibilityId('se_one_b57')674 .then(el => el.elementByXPath('//android.widget.LinearLayout[2]//android.widget.TextView[2]').tap())675 });676 it("Scroll To Specific Question", function () {677 return driver.scrollTo('//*[@content-desc="se_one_b58"]//android.widget.LinearLayout[2]//android.widget.TextView[2]');678 });679 it("se_one_b58 : 2", function () {680 return driver681 .elementByAccessibilityId('se_one_b58')682 .then(el => el.elementByXPath('//android.widget.LinearLayout[2]//android.widget.TextView[2]').tap())683 });684 it("Scroll To Specific Question", function () {685 return driver.scrollTo('//*[@content-desc="se_one_b59"]//android.widget.LinearLayout[2]//android.widget.TextView[2]');686 });687 it("se_one_b59 : 2", function () {688 return driver689 .elementByAccessibilityId('se_one_b59')690 .then(el => el.elementByXPath('//android.widget.LinearLayout[2]//android.widget.TextView[2]').tap())691 });692 it("Scroll To Specific Question", function () {693 return driver.scrollTo('//*[@content-desc="se_one_b60"]//android.widget.LinearLayout[2]//android.widget.TextView[2]');694 });695 it("se_one_b60 : 2", function () {696 return driver697 .elementByAccessibilityId('se_one_b60')698 .then(el => el.elementByXPath('//android.widget.LinearLayout[2]//android.widget.TextView[2]').tap())699 });700 it("Scroll To Specific Question", function () {701 return driver.scrollTo('//*[@content-desc="se_one_b61"]//android.widget.LinearLayout[2]//android.widget.TextView[2]');702 });703 it("se_one_b61 : 2", function () {704 return driver705 .elementByAccessibilityId('se_one_b61')706 .then(el => el.elementByXPath('//android.widget.LinearLayout[2]//android.widget.TextView[2]').tap())707 });708 it("Scroll To Specific Question", function () {709 return driver.scrollTo('//*[@content-desc="se_one_b62"]//*[@resource-id="vn.rta.rtsurvey:id/selection_view"]');710 });711 it("se_one_b62 : 3", function () {712 return driver713 .elementByAccessibilityId('se_one_b62')714 .then(el => el.elementById('vn.rta.rtsurvey:id/selection_view').setImmediateValue('h'))715 .sleep(1000)716 .elementById('vn.rta.rtsurvey:id/selection_view')717 .getLocation()718 .then(function (loc) {719 var action = new wd.TouchAction();720 action.tap({x: loc.x + 100, y: loc.y + 290});721 return driver.performTouchAction(action).sleep(1000)722 })723 .back().back().back()724 });725 it("Scroll To Specific Question", function () {726 return driver.scrollTo('//*[@content-desc="se_one_b63"]//*[@resource-id="vn.rta.rtsurvey:id/selection_view"]');727 });728 it("se_one_b63 : 3", function () {729 return driver730 .elementByAccessibilityId('se_one_b63')731 .then(el => el.elementById('vn.rta.rtsurvey:id/selection_view').setImmediateValue('h'))732 .sleep(1000)733 .elementById('vn.rta.rtsurvey:id/selection_view')734 .getLocation()735 .then(function (loc) {736 var action = new wd.TouchAction();737 action.tap({x: loc.x + 100, y: loc.y + 290});738 return driver.performTouchAction(action).sleep(1000)739 })740 .back().back().back()741 });742 it("Scroll To Specific Question", function () {743 return driver.scrollTo('//*[@content-desc="se_one_b64"]//*[@resource-id="vn.rta.rtsurvey:id/selection_view"]');744 });745 it("se_one_b64 : 0", function () {746 return driver747 .elementByAccessibilityId('se_one_b64')748 .then(el => el.elementById('vn.rta.rtsurvey:id/selection_view').setImmediateValue('h'))749 .sleep(1000)750 .elementById('vn.rta.rtsurvey:id/selection_view')751 .getLocation()752 .then(function (loc) {753 var action = new wd.TouchAction();754 action.tap({x: loc.x + 100, y: loc.y + 120});755 return driver.performTouchAction(action).sleep(1000)756 })757 .back().back().back()758 });759 it("Scroll To Specific Question", function () {760 return driver.scrollTo('//*[@content-desc="se_one_b65"]//*[@resource-id="vn.rta.rtsurvey:id/selection_view"]');761 });762 it("se_one_b65 : 2", function () {763 return driver764 .elementByAccessibilityId('se_one_b65')765 .then(el => el.elementById('vn.rta.rtsurvey:id/selection_view').setImmediateValue('h'))766 .sleep(1000)767 .elementById('vn.rta.rtsurvey:id/selection_view')768 .getLocation()769 .then(function (loc) {770 var action = new wd.TouchAction();771 action.tap({x: loc.x + 100, y: loc.y + 290});772 return driver.performTouchAction(action).sleep(1000)773 })774 .back().back().back()775 });776 it("Scroll To Specific Question", function () {777 return driver.scrollTo('//*[@content-desc="se_one_b66"]//*[@resource-id="vn.rta.rtsurvey:id/selection_view"]');778 });779 it("se_one_b66 : 2", function () {780 return driver781 .elementByAccessibilityId('se_one_b66')782 .then(el => el.elementById('vn.rta.rtsurvey:id/selection_view').setImmediateValue('h'))783 .sleep(1000)784 .elementById('vn.rta.rtsurvey:id/selection_view')785 .getLocation()786 .then(function (loc) {787 var action = new wd.TouchAction();788 action.tap({x: loc.x + 100, y: loc.y + 290});789 return driver.performTouchAction(action).sleep(1000)790 })791 .back().back().back()792 });793 it("Scroll To Specific Question", function () {794 return driver.scrollTo('//*[@content-desc="se_one_b67"]//*[@resource-id="vn.rta.rtsurvey:id/selection_view"]');795 });796 it("se_one_b67 : 1", function () {797 return driver798 .elementByAccessibilityId('se_one_b67')799 .then(el => el.elementById('vn.rta.rtsurvey:id/selection_view').setImmediateValue('h'))800 .sleep(1000)801 .elementById('vn.rta.rtsurvey:id/selection_view')802 .getLocation()803 .then(function (loc) {804 var action = new wd.TouchAction();805 action.tap({x: loc.x + 100, y: loc.y + 120});806 return driver.performTouchAction(action).sleep(1000)807 })808 .back().back().back()809 });810 it("Scroll To Specific Question", function () {811 return driver.scrollTo('//*[@content-desc="se_one_b68"]//android.widget.EditText');812 });813 it("se_one_b68 : 1", function () {814 return driver815 .elementByAccessibilityId('se_one_b68')816 .then(el => el.elementByClassName('android.widget.EditText').setImmediateValue('h'))817 .sleep(1000)818 .elementById('vn.rta.rtsurvey:id/recycler_view')819 .then(el => el.elementByXPath('//android.widget.RelativeLayout[1]//android.widget.TextView').tap())820 });821 it("Scroll To Specific Question", function () {822 return driver.scrollTo('//*[@content-desc="se_one_b69"]//android.widget.EditText');823 });824 it("se_one_b69 : 2", function () {825 return driver826 .elementByAccessibilityId('se_one_b69')827 .then(el => el.elementByClassName('android.widget.EditText').setImmediateValue('h'))828 .sleep(1000)829 .elementById('vn.rta.rtsurvey:id/recycler_view')830 .then(el => el.elementByXPath('//android.widget.RelativeLayout[2]//android.widget.TextView').tap())831 });832 it("Scroll To Specific Question", function () {833 return driver.scrollTo('//*[@content-desc="se_one_b70"]//android.widget.EditText');834 });835 it("se_one_b70 : 3", function () {836 return driver837 .elementByAccessibilityId('se_one_b70')838 .then(el => el.elementByClassName('android.widget.EditText').setImmediateValue('h'))839 .sleep(1000)840 .elementById('vn.rta.rtsurvey:id/recycler_view')841 .then(el => el.elementByXPath('//android.widget.RelativeLayout[3]//android.widget.TextView').tap())842 });843 it("Scroll To Specific Question", function () {844 return driver.scrollTo('//*[@content-desc="se_one_b71"]//android.widget.EditText');845 });846 it("se_one_b71 : 4", function () {847 return driver848 .elementByAccessibilityId('se_one_b71')849 .then(el => el.elementByClassName('android.widget.EditText').setImmediateValue('h'))850 .sleep(1000)851 .elementById('vn.rta.rtsurvey:id/recycler_view')852 .then(el => el.elementByXPath('//android.widget.RelativeLayout[4]//android.widget.TextView').tap())853 });*/...
table.spec.js
Source:table.spec.js
1const fs = require('fs');2const path = require('path');3const chai = require("chai");4const should = chai.should();5const JWebDriver = require('jwebdriver');6chai.use(JWebDriver.chaiSupportChainPromise);7const resemble = require('resemblejs-node');8resemble.outputSettings({9 errorType: 'flatDifferenceIntensity'10});11const rootPath = getRootPath();12module.exports = function(){13 let driver, testVars;14 before(function(){15 let self = this;16 driver = self.driver;17 testVars = self.testVars;18 });19 it('url: http://0.0.0.0:8686/#!/components/data-display/table', async function(){20 await driver.url(_(`http://0.0.0.0:8686/#!/components/data-display/table`));21 });2223 it('waitBody: ', async function(){24 await driver.sleep(500).wait('body', 30000).html().then(function(code){25 isPageError(code).should.be.false;26 });27 });2829 it('scrollTo: 0, 56', async function(){30 await driver.scrollTo(0, 56);31 });3233 it('click: å
¨é ( //div[text()="å
¨é"], 63, 20, 0 )', async function(){34 await driver.sleep(300).wait('//div[text()="å
¨é"]', 30000)35 .sleep(300).mouseMove(63, 20).click(0);36 });3738 it('click: å
¨ä¸é ( //div[text()="å
¨ä¸é"], 48, 16, 0 )', async function(){39 await driver.sleep(300).wait('//div[text()="å
¨ä¸é"]', 30000)40 .sleep(300).mouseMove(48, 16).click(0);41 });4243 it('scrollTo: 0, 82', async function(){44 await driver.scrollTo(0, 82);45 });4647 it('click: éæ©é¨å ( //div[text()="éæ©é¨å"], 56, 17, 0 )', async function(){48 await driver.sleep(300).wait('//div[text()="éæ©é¨å"]', 30000)49 .sleep(300).mouseMove(56, 17).click(0);50 });5152 it('click: ä¸éæ©é¨å ( //div[text()="ä¸éæ©é¨å"], 69, 17, 0 )', async function(){53 await driver.sleep(300).wait('//div[text()="ä¸éæ©é¨å"]', 30000)54 .sleep(300).mouseMove(69, 17).click(0);55 });5657 it('scrollTo: 0, 189', async function(){58 await driver.scrollTo(0, 189);59 });6061 it('click: table.main-table > tbody.tr-content > tr:nth-child(1) > td:nth-child(1) > div.ng-scope > label[id="ck_"].ng-not-empty > i.ma-checkbox-appearance, 10, 11, 0', async function(){62 await driver.sleep(300).wait('table.main-table > tbody.tr-content > tr:nth-child(1) > td:nth-child(1) > div.ng-scope > label[id="ck_"].ng-not-empty > i.ma-checkbox-appearance', 30000)63 .sleep(300).mouseMove(10, 11).click(0);64 });6566 it('click: table.main-table > tbody.tr-content > tr:nth-child(2) > td:nth-child(1) > div.ng-scope > label[id="ck_"].ng-not-empty > i.ma-checkbox-appearance, 6, 7, 0', async function(){67 await driver.sleep(300).wait('table.main-table > tbody.tr-content > tr:nth-child(2) > td:nth-child(1) > div.ng-scope > label[id="ck_"].ng-not-empty > i.ma-checkbox-appearance', 30000)68 .sleep(300).mouseMove(6, 7).click(0);69 });7071 it('click: table.main-table > tbody.tr-content > tr:nth-child(3) > td:nth-child(1) > div.ng-scope > label[id="ck_"].ng-not-empty > i.ma-checkbox-appearance, 9, 7, 0', async function(){72 await driver.sleep(300).wait('table.main-table > tbody.tr-content > tr:nth-child(3) > td:nth-child(1) > div.ng-scope > label[id="ck_"].ng-not-empty > i.ma-checkbox-appearance', 30000)73 .sleep(300).mouseMove(9, 7).click(0);74 });7576 it('click: label.has-sub > i.ma-checkbox-appearance, 11, 13, 0', async function(){77 await driver.sleep(300).wait('label.has-sub > i.ma-checkbox-appearance', 30000)78 .sleep(300).mouseMove(11, 13).click(0);79 });8081 it('click: div.mb-20 > div.ma-table > div.data-table > div:nth-child(1) > div.main-table-container > table.ng-table > thead:nth-child(1) > tr.ng-table-sort-header > th:nth-child(1) > div > label[id="ck_all"][type="checkbox"].ng-isolate-scope > i.ma-checkbox-appearance, 11, 13, 0', async function(){82 await driver.sleep(300).wait('div.mb-20 > div.ma-table > div.data-table > div:nth-child(1) > div.main-table-container > table.ng-table > thead:nth-child(1) > tr.ng-table-sort-header > th:nth-child(1) > div > label[id="ck_all"][type="checkbox"].ng-isolate-scope > i.ma-checkbox-appearance', 30000)83 .sleep(300).mouseMove(11, 13).click(0);84 });8586 it('scrollTo: 0, 215', async function(){87 await driver.scrollTo(0, 215);88 });8990 it('click: div.mb-20 > div.ma-table > div.data-table > div:nth-child(1) > div.main-table-container > table.ng-table > thead:nth-child(1) > tr.ng-table-sort-header > th:nth-child(1) > div > label[id="ck_all"][type="checkbox"].ng-not-empty > i.ma-checkbox-appearance, 6, 7, 0', async function(){91 await driver.sleep(300).wait('div.mb-20 > div.ma-table > div.data-table > div:nth-child(1) > div.main-table-container > table.ng-table > thead:nth-child(1) > tr.ng-table-sort-header > th:nth-child(1) > div > label[id="ck_all"][type="checkbox"].ng-not-empty > i.ma-checkbox-appearance', 30000)92 .sleep(300).mouseMove(6, 7).click(0);93 });9495 it('click: table.main-table > tbody.tr-content > tr:nth-child(2) > td:nth-child(1) > div.ng-scope > label[id="ck_"].ng-isolate-scope > i.ma-checkbox-appearance, 8, 8, 0', async function(){96 await driver.sleep(300).wait('table.main-table > tbody.tr-content > tr:nth-child(2) > td:nth-child(1) > div.ng-scope > label[id="ck_"].ng-isolate-scope > i.ma-checkbox-appearance', 30000)97 .sleep(300).mouseMove(8, 8).click(0);98 });99100 it('scrollTo: 0, 1010', async function(){101 await driver.scrollTo(0, 1010);102 });103104 it('scrollTo: 0, 1329', async function(){105 await driver.scrollTo(0, 1329);106 });107108 it('scrollElementTo: div:nth-child(6) > div.ma-table > div.data-table > div:nth-child(1) > div.main-table-container, 0, 0', async function(){109 await driver.sleep(300).wait('div:nth-child(6) > div.ma-table > div.data-table > div:nth-child(1) > div.main-table-container', 30000)110 .sleep(300).scrollElementTo(0, 0);111 });112113 it('scrollTo: 0, 1115', async function(){114 await driver.scrollTo(0, 1115);115 });116117 it('scrollTo: 0, 983', async function(){118 await driver.scrollTo(0, 983);119 });120121 it('scrollTo: 0, 774', async function(){122 await driver.scrollTo(0, 774);123 });124125 it('click: div.float-left-table > div > table.ng-table > thead:nth-child(1) > tr.ng-table-sort-header > th:nth-child(1) > div > label[id="ck_all"][type="checkbox"].ng-not-empty > i.ma-checkbox-appearance, 4, 12, 0', async function(){126 await driver.sleep(300).wait('div.float-left-table > div > table.ng-table > thead:nth-child(1) > tr.ng-table-sort-header > th:nth-child(1) > div > label[id="ck_all"][type="checkbox"].ng-not-empty > i.ma-checkbox-appearance', 30000)127 .sleep(300).mouseMove(4, 12).click(0);128 });129130 it('click: 2 ( div.mb-20 > div.ma-table > div.data-table > div:nth-child(1) > div.main-table-container > div:nth-child(2) > div > div.ng-table-pager > ul.ng-table-pagination > li:nth-child(4) > a.ng-scope, 10, 16, 0 )', async function(){131 await driver.sleep(300).wait('div.mb-20 > div.ma-table > div.data-table > div:nth-child(1) > div.main-table-container > div:nth-child(2) > div > div.ng-table-pager > ul.ng-table-pagination > li:nth-child(4) > a.ng-scope', 30000)132 .sleep(300).mouseMove(10, 16).click(0);133 });134135 it('scrollTo: 0, 699', async function(){136 await driver.scrollTo(0, 699);137 });138139 it('click: 1 ( div.mb-20 > div.ma-table > div.data-table > div:nth-child(1) > div.main-table-container > div:nth-child(2) > div > div.ng-table-pager > ul.ng-table-pagination > li:nth-child(3) > a.ng-scope, 9, 16, 0 )', async function(){140 await driver.sleep(300).wait('div.mb-20 > div.ma-table > div.data-table > div:nth-child(1) > div.main-table-container > div:nth-child(2) > div > div.ng-table-pager > ul.ng-table-pagination > li:nth-child(3) > a.ng-scope', 30000)141 .sleep(300).mouseMove(9, 16).click(0);142 });143144 it('click: div.mb-20 > div.ma-table > div.data-table > div:nth-child(1) > form.form-inline > div.page-select-form-group > div[id="pageSizeBinding"].ma-select > div[type="text"].ma-input-arrow-down > input[type="text"]:nth-child(1), 59, 17, 0', async function(){145 await driver.sleep(300).wait('div.mb-20 > div.ma-table > div.data-table > div:nth-child(1) > form.form-inline > div.page-select-form-group > div[id="pageSizeBinding"].ma-select > div[type="text"].ma-input-arrow-down > input[type="text"]:nth-child(1)', 30000)146 .sleep(300).mouseMove(59, 17).click(0);147 });148149 it('click: 30 æ¡ / 页 ( div.show > div.ma-dropdown-container-content > div:nth-child(3) > span, 26, 8, 0 )', async function(){150 await driver.sleep(300).wait('div.show > div.ma-dropdown-container-content > div:nth-child(3) > span', 30000)151 .sleep(300).mouseMove(26, 8).click(0);152 });153154 it('click: input.ng-touched, 40, 15, 0', async function(){155 await driver.sleep(300).wait('input.ng-touched', 30000)156 .sleep(300).mouseMove(40, 15).click(0);157 });158159 it('click: 20 æ¡ / 页 ( div.show > div.ma-dropdown-container-content > div:nth-child(2) > span, 26, 4, 0 )', async function(){160 await driver.sleep(300).wait('div.show > div.ma-dropdown-container-content > div:nth-child(2) > span', 30000)161 .sleep(300).mouseMove(26, 4).click(0);162 });163164 it('click: input.ng-touched, 43, 10, 0', async function(){165 await driver.sleep(300).wait('input.ng-touched', 30000)166 .sleep(300).mouseMove(43, 10).click(0);167 });168169 it('click: 10 æ¡ / 页 ( div.show > div.ma-dropdown-container-content > div:nth-child(1) > span, 24, 12, 0 )', async function(){170 await driver.sleep(300).wait('div.show > div.ma-dropdown-container-content > div:nth-child(1) > span', 30000)171 .sleep(300).mouseMove(24, 12).click(0);172 });173174 it('click: input.ng-touched, 48, 19, 0', async function(){175 await driver.sleep(300).wait('input.ng-touched', 30000)176 .sleep(300).mouseMove(48, 19).click(0);177 });178179 it('click: å·¦å³æ¼æµ®table ( //h4[text()="å·¦å³æ¼æµ®table"], 506, 8, 0 )', async function(){180 await driver.sleep(300).wait('//h4[text()="å·¦å³æ¼æµ®table"]', 30000)181 .sleep(300).mouseMove(506, 8).click(0);182 });183184 it('scrollTo: 0, 0', async function(){185 await driver.scrollTo(0, 0);186 });187 function _(str){188 if(typeof str === 'string'){189 return str.replace(/\{\{(.+?)\}\}/g, function(all, key){190 return testVars[key] || '';191 });192 }193 else{194 return str;195 }196 }197};198if(module.parent && /mocha\.js/.test(module.parent.id)){199 runThisSpec();200}201function runThisSpec(){202 // read config203 let webdriver = process.env['webdriver'] || '';204 let proxy = process.env['wdproxy'] || '';205 let config = require(rootPath + '/config.json');206 let webdriverConfig = Object.assign({},config.webdriver);207 let host = webdriverConfig.host;208 let port = webdriverConfig.port || 4444;209 let match = webdriver.match(/([^\:]+)(?:\:(\d+))?/);210 if(match){211 host = match[1] || host;212 port = match[2] || port;213 }214 let testVars = config.vars;215 let browsers = webdriverConfig.browsers;216 browsers = browsers.replace(/^\s+|\s+$/g, '');217 delete webdriverConfig.host;218 delete webdriverConfig.port;219 delete webdriverConfig.browsers;220 // read hosts221 let hostsPath = rootPath + '/hosts';222 let hosts = '';223 if(fs.existsSync(hostsPath)){224 hosts = fs.readFileSync(hostsPath).toString();225 }226 let specName = path.relative(rootPath, __filename).replace(/\\/g,'/').replace(/\.js$/,'');227 browsers.split(/\s*,\s*/).forEach(function(browserName){228 let caseName = specName + ' : ' + browserName;229 let browserInfo = browserName.split(' ');230 browserName = browserInfo[0];231 let browserVersion = browserInfo[1];232 describe(caseName, function(){233 this.timeout(600000);234 this.slow(1000);235 let driver;236 before(function(){237 let self = this;238 let driver = new JWebDriver({239 'host': host,240 'port': port241 });242 let sessionConfig = Object.assign({}, webdriverConfig, {243 'browserName': browserName,244 'version': browserVersion,245 'ie.ensureCleanSession': true,246 'chromeOptions': {247 'args': ['--enable-automation']248 }249 });250 if(proxy){251 sessionConfig.proxy = {252 'proxyType': 'manual',253 'httpProxy': proxy,254 'sslProxy': proxy255 }256 }257 else if(hosts){258 sessionConfig.hosts = hosts;259 }260 self.driver = driver.session(sessionConfig).windowSize(1366, 768).config({261 pageloadTimeout: 30000, // page onload timeout262 scriptTimeout: 5000, // sync script timeout263 asyncScriptTimeout: 10000 // async script timeout264 });265 self.testVars = testVars;266 let casePath = path.dirname(caseName);267 self.screenshotPath = rootPath + '/screenshots/' + casePath;268 self.diffbasePath = rootPath + '/diffbase/' + casePath;269 self.caseName = caseName.replace(/.*\//g, '').replace(/\s*[:\.\:\-\s]\s*/g, '_');270 mkdirs(self.screenshotPath);271 mkdirs(self.diffbasePath);272 self.stepId = 0;273 return self.driver;274 });275 module.exports();276 beforeEach(function(){277 let self = this;278 self.stepId ++;279 if(self.skipAll){280 self.skip();281 }282 });283 afterEach(async function(){284 let self = this;285 let currentTest = self.currentTest;286 let title = currentTest.title;287 if(currentTest.state === 'failed' && /^(url|waitBody|switchWindow|switchFrame):/.test(title)){288 self.skipAll = true;289 }290 if(!/^(closeWindow):/.test(title)){291 let filepath = self.screenshotPath + '/' + self.caseName + '_' + self.stepId;292 let driver = self.driver;293 try{294 // catch error when get alert msg295 await driver.getScreenshot(filepath + '.png');296 let url = await driver.url();297 let html = await driver.source();298 html = '<!--url: '+url+' -->\n' + html;299 fs.writeFileSync(filepath + '.html', html);300 let cookies = await driver.cookies();301 fs.writeFileSync(filepath + '.cookie', JSON.stringify(cookies));302 }303 catch(e){}304 }305 });306 after(function(){307 return this.driver.close();308 });309 });310 });311}312function getRootPath(){313 let rootPath = path.resolve(__dirname);314 while(rootPath){315 if(fs.existsSync(rootPath + '/config.json')){316 break;317 }318 rootPath = rootPath.substring(0, rootPath.lastIndexOf(path.sep));319 }320 return rootPath;321}322function mkdirs(dirname){323 if(fs.existsSync(dirname)){324 return true;325 }else{326 if(mkdirs(path.dirname(dirname))){327 fs.mkdirSync(dirname);328 return true;329 }330 }331}332function callSpec(name){333 try{334 require(rootPath + '/' + name)();335 }336 catch(e){337 console.log(e)338 process.exit(1);339 }340}341function isPageError(code){342 return code == '' || / jscontent="errorCode" jstcache="\d+"|diagnoseConnectionAndRefresh|dnserror_unavailable_header|id="reportCertificateErrorRetry"|400 Bad Request|403 Forbidden|404 Not Found|500 Internal Server Error|502 Bad Gateway|503 Service Temporarily Unavailable|504 Gateway Time-out/i.test(code);343}344function catchError(error){...
image.js
Source:image.js
1"use strict";2require("./helpers/setup");3var wd = require("wd"),4 Q = require('q'),5 dateTime = require('./helpers/datetime'),6 actions = require('./helpers/actions');7wd.addPromiseChainMethod('swipe', actions.swipe);8wd.addPromiseChainMethod('scrollTo', actions.scrollTo);9wd.addPromiseChainMethod('draw', actions.draw);10describe("Test AIO - Appearance (G4 v1712141604) Form", function () {11 this.timeout(300000);12 var driver;13 before(function () {14 driver = wd.promiseChainRemote({host: 'localhost', port: 4723});15 // require("./helpers/logging").configure(driver);16 var desired = {17 browserName: '',18 platformName: 'Android',19 platformVersion: '6.0.1',20 deviceName: 'Nexus 7',21 udid: '07d9024f',22 noReset: true,23 appActivity: 'vn.rta.cpms.activities.FormSelectionActivity',24 appPackage: 'vn.rta.rtsurvey'25 };26 return driver27 .init(desired)28 .setImplicitWaitTimeout(2000);29 });30 it("Open form", function () {31 return driver32 .elementByXPath('//android.widget.TextView[@text=\'AIO - Appearance (G4 v1712141604)\']')33 .click()34 .sleep(5000);35 });36 it("Start filling form", function () {37 return driver38 .elementById('vn.rta.rtsurvey:id/questionholder')39 .flick(-500, 1, 500);40 });41 it("sections_select", function () {42 return driver43 .elementByAccessibilityId('sections_select')44 .then(function (el) {45 return el46 .elementsByClassName('android.widget.CheckBox')47 .then(function (els) {48 return Q.all([49 els[9].click()50 ])51 });52 })53 });54 it("Next Question", function () {55 return driver56 .elementById('vn.rta.rtsurvey:id/questionholder')57 .flick(-500, 1, 500);58 });59 60 it("image_j1", function () {61 return driver62 .elementByAccessibilityId('image_j1')63 .then(el => el.elementByClassName('android.widget.Button').tap())64 .sleep(3000)65 .elementById('vn.rta.rtsurvey:id/take_photo')66 .tap()67 .sleep(1000);68 });69 it("Scroll To Specific Question", function () {70 return driver.scrollTo('image_j2');71 });72 it("image_j2", function () {73 return driver74 .elementByAccessibilityId('image_j2')75 .then(el => el.elementByClassName('android.widget.Button').tap())76 .sleep(3000)77 .elementById('vn.rta.rtsurvey:id/take_photo')78 .tap()79 .sleep(1000);80 });81 it("Scroll To Specific Question", function () {82 return driver.scrollTo('image_j3');83 });84 it("image_j3", function () {85 return driver86 .elementByAccessibilityId('image_j3')87 .then(el => el.elementByClassName('android.widget.Button').tap())88 .sleep(3000)89 .elementById('vn.rta.rtsurvey:id/take_photo')90 .tap()91 .sleep(1000);92 });93 it("Scroll To Specific Question", function () {94 return driver.scrollTo('image_j4');95 });96 it("image_j4", function () {97 return driver98 .elementByAccessibilityId('image_j4')99 .then(el => el.elementByClassName('android.widget.ImageButton').tap())100 .sleep(3000)101 .elementById('vn.rta.rtsurvey:id/take_photo')102 .tap()103 .sleep(1000);104 });105 it("Scroll To Specific Question", function () {106 return driver.scrollTo('image_j5');107 });108 it("image_j5", function () {109 return driver110 .elementByAccessibilityId('image_j5')111 .then(el => el.elementByClassName('android.widget.ImageButton').tap())112 .sleep(3000)113 .elementById('vn.rta.rtsurvey:id/take_photo')114 .tap()115 .sleep(1000);116 });117 it("image_j6", function () {118 return driver119 .elementByAccessibilityId('image_j6')120 .then(el => el.elementByClassName('android.widget.ImageButton').tap())121 .sleep(3000)122 .elementById('vn.rta.rtsurvey:id/take_photo')123 .tap()124 .sleep(1000);125 });126 it("image_j7", function () {127 return driver128 .elementByAccessibilityId('image_j7')129 .then(el => el.elementByClassName('android.widget.ImageButton').tap())130 .sleep(3000)131 .elementById('vn.rta.rtsurvey:id/take_photo')132 .tap()133 .sleep(1000);134 });135 it("image_j8", function () {136 return driver137 .elementByAccessibilityId('image_j8')138 .then(el => el.elementByClassName('android.widget.ImageButton').tap())139 .sleep(3000)140 .elementById('vn.rta.rtsurvey:id/take_photo')141 .tap()142 .sleep(1000);143 });144 it("image_j9", function () {145 return driver146 .elementByAccessibilityId('image_j9')147 .then(el => el.elementByClassName('android.widget.ImageButton').tap())148 .sleep(3000)149 .elementById('vn.rta.rtsurvey:id/take_photo')150 .tap()151 .sleep(1000);152 });153 it("Scroll To Specific Question", function () {154 return driver.scrollTo('image_j10');155 });156 it("image_j10", function () {157 return driver158 .elementByAccessibilityId('image_j10')159 .then(el => el.elementByClassName('android.widget.ImageButton').tap())160 .sleep(3000)161 .elementById('vn.rta.rtsurvey:id/take_photo')162 .tap()163 .sleep(1000);164 });165 it("Scroll To Specific Question", function () {166 return driver.scrollTo('image_j11');167 });168 it("image_j11", function () {169 return driver170 .elementByAccessibilityId('image_j11')171 .then(el => el.elementByClassName('android.widget.ImageButton').tap())172 .sleep(3000)173 .elementById('vn.rta.rtsurvey:id/take_photo')174 .tap()175 .sleep(1000);176 });177 it("Scroll To Specific Question", function () {178 return driver.scrollTo('image_j12');179 });180 it("image_j12", function () {181 return driver182 .elementByAccessibilityId('image_j12')183 .then(el => el.elementByClassName('android.widget.Button').tap())184 .sleep(1000)185 .draw()186 .elementById('vn.rta.rtsurvey:id/fab_actions')187 .tap()188 .elementById('vn.rta.rtsurvey:id/fab_save_and_close')189 .tap();190 });191 it("Scroll To Specific Question", function () {192 return driver.scrollTo('image_j13');193 });194 it("image_j13", function () {195 return driver196 .elementByAccessibilityId('image_j13')197 .then(el => el.elementByClassName('android.widget.ImageButton').tap())198 .sleep(1000)199 .draw()200 .elementById('vn.rta.rtsurvey:id/fab_actions')201 .tap()202 .elementById('vn.rta.rtsurvey:id/fab_save_and_close')203 .tap();204 });205 it("image_j14", function () {206 return driver207 .elementByAccessibilityId('image_j14')208 .then(el => el.elementByClassName('android.widget.ImageButton').tap())209 .sleep(1000)210 .draw()211 .elementById('vn.rta.rtsurvey:id/fab_actions')212 .tap()213 .elementById('vn.rta.rtsurvey:id/fab_save_and_close')214 .tap();215 });216 it("image_j15", function () {217 return driver218 .elementByAccessibilityId('image_j15')219 .then(el => el.elementByClassName('android.widget.ImageButton').tap())220 .sleep(1000)221 .draw()222 .elementById('vn.rta.rtsurvey:id/fab_actions')223 .tap()224 .elementById('vn.rta.rtsurvey:id/fab_save_and_close')225 .tap();226 });227 it("image_j16", function () {228 return driver229 .elementByAccessibilityId('image_j16')230 .then(el => el.elementByClassName('android.widget.ImageButton').tap())231 .sleep(1000)232 .draw()233 .elementById('vn.rta.rtsurvey:id/fab_actions')234 .tap()235 .elementById('vn.rta.rtsurvey:id/fab_save_and_close')236 .tap();237 });238 it("image_j17", function () {239 return driver240 .elementByAccessibilityId('image_j17')241 .then(el => el.elementByClassName('android.widget.ImageButton').tap())242 .sleep(1000)243 .draw()244 .elementById('vn.rta.rtsurvey:id/fab_actions')245 .tap()246 .elementById('vn.rta.rtsurvey:id/fab_save_and_close')247 .tap();248 });249 it("Scroll To Specific Question", function () {250 return driver.scrollTo('image_j18');251 });252 it("image_j18", function () {253 return driver254 .elementByAccessibilityId('image_j18')255 .then(el => el.elementByClassName('android.widget.Button').tap())256 .sleep(1000)257 .draw()258 .elementById('vn.rta.rtsurvey:id/fab_actions')259 .tap()260 .elementById('vn.rta.rtsurvey:id/fab_save_and_close')261 .tap();262 });263 it("Scroll To Specific Question", function () {264 return driver.scrollTo('image_j19');265 });266 it("image_j19", function () {267 return driver268 .elementByAccessibilityId('image_j19')269 .then(el => el.elementByClassName('android.widget.Button').tap())270 .sleep(3000)271 .elementById('vn.rta.rtsurvey:id/take_photo')272 .click()273 .sleep(1000);274 });275 it("Scroll To Specific Question", function () {276 return driver.scrollTo('image_j20');277 });278 it("image_j20", function () {279 return driver280 .elementByAccessibilityId('image_j20')281 .then(el => el.elementByClassName('android.widget.Button').tap())282 .sleep(3000)283 .elementById('vn.rta.rtsurvey:id/take_photo')284 .click()285 .sleep(1000);286 });287 it("Scroll To Specific Question", function () {288 return driver.scrollTo('image_j21');289 });290 it("image_j21", function () {291 return driver292 .elementByAccessibilityId('image_j21')293 .then(el => el.elementByClassName('android.widget.Button').tap())294 .sleep(3000)295 .elementById('vn.rta.rtsurvey:id/take_photo')296 .click()297 .sleep(1000);298 });299 it("Scroll To Specific Question", function () {300 return driver.scrollTo('image_j22');301 });302 it("image_j22", function () {303 return driver304 .elementByAccessibilityId('image_j22')305 .then(el => el.elementByClassName('android.widget.Button').tap())306 .sleep(3000)307 .elementById('vn.rta.rtsurvey:id/take_photo')308 .click()309 .sleep(1000);310 });311 it("Scroll To Specific Question", function () {312 return driver.scrollTo('image_j23');313 });314 it("image_j23", function () {315 return driver316 .elementByAccessibilityId('image_j23')317 .then(el => el.elementByClassName('android.widget.ImageButton').tap())318 .sleep(3000)319 .elementById('vn.rta.rtsurvey:id/take_photo')320 .click()321 .sleep(1000);322 });323 it("image_j24", function () {324 return driver325 .elementByAccessibilityId('image_j24')326 .then(el => el.elementByClassName('android.widget.ImageButton').tap())327 .sleep(3000)328 .elementById('vn.rta.rtsurvey:id/take_photo')329 .click()330 .sleep(1000);331 });332 it("image_j25", function () {333 return driver334 .elementByAccessibilityId('image_j25')335 .then(el => el.elementByClassName('android.widget.ImageButton').tap())336 .sleep(3000)337 .elementById('vn.rta.rtsurvey:id/take_photo')338 .click()339 .sleep(1000);340 });341 it("image_j26", function () {342 return driver343 .elementByAccessibilityId('image_j26')344 .then(el => el.elementByClassName('android.widget.ImageButton').tap())345 .sleep(3000)346 .elementById('vn.rta.rtsurvey:id/take_photo')347 .click()348 .sleep(1000);349 });350 it("image_j27", function () {351 return driver352 .elementByAccessibilityId('image_j27')353 .then(el => el.elementByClassName('android.widget.ImageButton').tap())354 .sleep(3000)355 .elementById('vn.rta.rtsurvey:id/take_photo')356 .click()357 .sleep(1000);358 });359 it("Scroll To Specific Question", function () {360 return driver.scrollTo('image_j28');361 });362 it("image_j28", function () {363 return driver364 .elementByAccessibilityId('image_j28')365 .then(el => el.elementByClassName('android.widget.Button').tap())366 .sleep(3000)367 .elementById('vn.rta.rtsurvey:id/take_photo')368 .click()369 .sleep(1000);370 });371 it("Scroll To Specific Question", function () {372 return driver.scrollTo('image_j29');373 });374 it("image_j29", function () {375 return driver376 .elementByAccessibilityId('image_j29')377 .then(el => el.elementByClassName('android.widget.Button').tap())378 .sleep(3000)379 .elementById('vn.rta.rtsurvey:id/take_photo')380 .click()381 .sleep(1000);382 });383 it("Scroll To Specific Question", function () {384 return driver.scrollTo('image_j30');385 });386 it("image_j30", function () {387 return driver388 .elementByAccessibilityId('image_j30')389 .then(el => el.elementByClassName('android.widget.ImageButton').tap())390 .sleep(3000)391 .elementById('vn.rta.rtsurvey:id/take_photo')392 .click()393 .sleep(1000);394 });395 it("Scroll To Specific Question", function () {396 return driver.scrollTo('image_j31');397 });398 it("image_j31", function () {399 return driver400 .elementByAccessibilityId('image_j31')401 .then(el => el.elementByClassName('android.widget.ImageButton').tap())402 .sleep(3000)403 .elementById('vn.rta.rtsurvey:id/take_photo')404 .click()405 .sleep(1000);406 });...
ios-image.js
Source:ios-image.js
1"use strict";2require("../helpers/setup");3var wd = require("wd"),4 Q = require('q'),5 dateTime = require('../helpers/datetime'),6 actions = require('../helpers/actions');7wd.addPromiseChainMethod('swipe', actions.swipe);8wd.addPromiseChainMethod('scrollTo', actions.iScrollTo);9wd.addPromiseChainMethod('scrollDown', actions.iScrollDown);10describe("Test AIO - Appearance (G4 v1712141604) Form", function () {11 this.timeout(300000);12 var driver;13 before(function () {14 driver = wd.promiseChainRemote({host: 'localhost', port: 4723});15 // require("../helpers/logging").configure(driver);16 // let desired = {17 // automationName: 'XCUITest', 18 // browserName: '',19 // platformName: 'iOS',20 // platformVersion: '12.1',21 // deviceName: 'iPhone XR',22 // noReset: true,23 // bundleId: 'com.rtsmartsurvey.rtsurvey.ios'24 // };25 let desired = {26 automationName: 'XCUITest',27 browserName: '',28 platformName: 'iOS',29 platformVersion: '10.3.3',30 deviceName: 'QC Team',31 xcodeOrgId: 'C253N945M7',32 udid: 'auto',33 bundleId: 'com.rtsmartsurvey.rtsurvey.ios',34 noReset: true35 };36 37 return driver38 .init(desired)39 .setImplicitWaitTimeout(5000);40 });41 // it("Enter pin number", function () {42 // return driver43 // .elementByAccessibilityId('1')44 // .tap()45 // .elementByAccessibilityId('2')46 // .tap()47 // .elementByAccessibilityId('3')48 // .tap()49 // .elementByAccessibilityId('4')50 // .tap()51 // .sleep(3000)52 // });53 it("Fill new form", function () {54 return driver55 .elementByAccessibilityId('cell_fill_form')56 .tap()57 });58 it("Scroll down", function () {59 return driver.scrollDown();60 });61 it("Open form", function () {62 return driver63 .elementByXPath('//XCUIElementTypeStaticText[contains(@name, "AIO - Appearance")]')64 .tap()65 .sleep(10000)66 });67 it("Next Question", function () {68 return driver.swipe({startX: 200, startY: 100, endX: 100, endY: 100, duration: 1000})69 });70 it("sections_select : 9,16", function () {71 return driver72 .elementByAccessibilityId('sections_select')73 .then(el => el.elementByXPath('//XCUIElementTypeOther[2]//XCUIElementTypeOther[10]//XCUIElementTypeStaticText').tap())74 });75 it("Next Question", function () {76 return driver.swipe({startX: 200, startY: 100, endX: 100, endY: 100, duration: 1000})77 });78 it("image_j1", function () {79 return driver80 .elementByAccessibilityId('image_j1')81 .elementByClassName('>', 'XCUIElementTypeButton').tap()82 .elementByAccessibilityId('FEOverlayCameraView')83 .elementsByClassName('>', 'XCUIElementTypeButton')84 .at(1).tap()85 });86 it("Scroll down", function () {87 return driver.scrollDown();88 });89 it("image_j2", function () {90 return driver91 .elementByAccessibilityId('image_j2')92 .elementByClassName('>', 'XCUIElementTypeButton').tap()93 .elementByAccessibilityId('FEOverlayCameraView')94 .elementsByClassName('>', 'XCUIElementTypeButton')95 .at(1).tap()96 });97 it("Scroll down", function () {98 return driver.scrollDown();99 });100 it("image_j3", function () {101 return driver102 .elementByAccessibilityId('image_j3')103 .elementByClassName('>', 'XCUIElementTypeButton').tap()104 .elementByAccessibilityId('FEOverlayCameraView')105 .elementsByClassName('>', 'XCUIElementTypeButton')106 .at(1).tap()107 });108 it("Scroll To Specific Question", function () {109 return driver.scrollTo('image_j4');110 });111 it("image_j4", function () {112 return driver113 .elementByAccessibilityId('image_j4')114 .elementByClassName('>', 'XCUIElementTypeButton').tap()115 .elementByAccessibilityId('FEOverlayCameraView')116 .elementsByClassName('>', 'XCUIElementTypeButton')117 .at(1).tap()118 });119 it("image_j5", function () {120 return driver121 .elementByAccessibilityId('image_j5')122 .elementByClassName('>', 'XCUIElementTypeButton').tap()123 .elementByAccessibilityId('FEOverlayCameraView')124 .elementsByClassName('>', 'XCUIElementTypeButton')125 .at(1).tap()126 });...
integ-actions-drivers.js
Source:integ-actions-drivers.js
1// This isn't ideal, but native scrolling is never entirely accurate, compared the exact amount we pass in in DP.2// This is an approximation based on experiments (over the current native impl.), AND IS IN NO WAY A MAGIC NUMBER (!!!),3// especially since the inaccuracy is not linear as we assume here.4const SCROLL_ADJ_FACTOR = 1.04;5const scrollingTextsDriver = {6 scrollView: () => element(by.id('integActions.textsScrollView')),7 scrollDown: async (amount) => {8 await scrollingTextsDriver.scrollView().scroll(amount * SCROLL_ADJ_FACTOR, 'down'); // Adjustment is experiments-based, not a magic number!9 },10 tapOnText: async (id) => {11 const elementId = scrollingTextsDriver._elementId(id);12 await element(by.id(elementId)).tap();13 },14 assertTextTappedOnce: async (id) => {15 const elementId = scrollingTextsDriver._elementId(id);16 const expectedText = `${elementId}: 1`;17 await expect(element(by.id(elementId))).toHaveText(expectedText);18 },19 _elementId: (fieldId) => `tappableText-${fieldId}`,20};21const scrollingTextInputsDriver = {22 scrollView: () => element(by.id('integActions.inputsScrollView')),23 scrollDown: async (amount) => {24 await scrollingTextInputsDriver.scrollView().scroll(amount * SCROLL_ADJ_FACTOR, 'down');25 },26 typeInField: async (fieldId) => {27 const elementId = scrollingTextInputsDriver._elementId(fieldId);28 const typedText = elementId;29 await element(by.id(elementId)).typeText(typedText);30 },31 assertFieldText: async (fieldId) => {32 const elementId = scrollingTextInputsDriver._elementId(fieldId);33 const expectedText = elementId;34 await expect(element(by.id(elementId))).toHaveText(expectedText);35 },36 _elementId: (fieldId) => `textInput-${fieldId}`,37};38module.exports = {39 scrollingTextInputsDriver,40 scrollingTextsDriver,...
03.actions.visibility-workaround.test.js
Source:03.actions.visibility-workaround.test.js
1const {scrollViewDriver} = require('./drivers/fs-scroll-driver');2const {expectToThrow} = require('./utils/custom-expects');3/**4 * A mini suite providing an alternative to tests failing due to issues found in RN 58+ on Android (see5 * https://github.com/facebook/react-native/issues/23870).6 * It basically runs similar 'action' use cases -- all of which involve visibility and scrolling, but in a7 * setup where they <i>can</i> pass, so as to assert that the core Detox functionality is valid nevertheless.8 */9describe(':android: Visibility-bug workaround actions', () => {10 beforeEach(async () => {11 await device.reloadReactNative();12 await element(by.text('FS Scroll Actions')).tap();13 });14 it('should scroll for a small amount in direction', async () => {15 await expect(scrollViewDriver.element()).toBeVisible();16 await expect(scrollViewDriver.firstItem()).toBeVisible();17 await expect(scrollViewDriver.lastItem()).not.toBeVisible();18 await scrollViewDriver.scrollBy(60);19 await expect(scrollViewDriver.firstItem()).not.toBeVisible();20 await expect(scrollViewDriver.secondItem()).toBeVisible();21 await scrollViewDriver.scrollBy(-60);22 await expect(scrollViewDriver.firstItem()).toBeVisible();23 await expect(scrollViewDriver.lastItem()).not.toBeVisible();24 });25 it('should scroll for a large amount in direction', async () => {26 await expect(scrollViewDriver.element()).toBeVisible();27 await expect(scrollViewDriver.firstItem()).toBeVisible();28 await expect(scrollViewDriver.lastItem()).not.toBeVisible();29 await expectToThrow(() => scrollViewDriver.scrollBy(1000));30 await expect(scrollViewDriver.firstItem()).not.toBeVisible();31 await expect(scrollViewDriver.lastItem()).toBeVisible();32 });...
Parallax.js
Source:Parallax.js
1import React, { PureComponent } from 'react';2import autoBindReact from 'auto-bind/react';3import { ScrollView } from 'react-native';4import { Parallax, ScrollDriver } from '@shoutem/animation';5import { ImageBackground, Subtitle, Tile, Title } from '@shoutem/ui';6const restaurants = require('./restaurants.json');7export default class ParallaxExample extends PureComponent {8 constructor(props) {9 super(props);10 autoBindReact(this);11 this.driver = new ScrollDriver();12 }13 renderRow(restaurant) {14 return (15 <ImageBackground16 styleName="large-banner"17 source={{ uri: restaurant.image.url }}18 key={restaurant.name}19 >20 <Tile>21 <Parallax driver={this.driver} scrollSpeed={1.2}>22 <Title>{restaurant.name}</Title>23 <Subtitle>{restaurant.address}</Subtitle>24 </Parallax>25 </Tile>26 </ImageBackground>27 );28 }29 render() {30 return (31 <ScrollView {...this.driver.scrollViewProps}>32 {restaurants.map(this.renderRow)}33 </ScrollView>34 );35 }...
Using AI Code Generation
1 build();2driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');3driver.findElement(webdriver.By.name('btnG')).click();4driver.sleep(5000).then(function() {5 driver.getTitle().then(function(title) {6 if(title === 'webdriver - Google Search') {7 console.log('Test passed');8 } else {9 console.log('Test failed');10 }11 driver.quit();12 });13});
Using AI Code Generation
1driver.init({2}).then(function () {3 return driver.elementByClassName('android.widget.EditText');4}).then(function (el) {5 return el.sendKeys('hello world');6}).then(function () {7 return driver.elementByClassName('android.widget.Button');8}).then(function (el) {9 return el.click();10}).then(function () {11 return driver.elementByClassName('android.widget.TextView');12}).then(function (el) {13 return el.text();14}).then(function (text) {15 console.log(text);16 return text.should.include('Hello World');17}).fin(function () {18 return driver.quit();19}).done();20The above code works fine when the app is launched for the first time. However, when the app is already launched, the driver.quit() method is not able to close the app. The app remains open in the emulator. I tried using the driver.closeApp() method as well, but it didn't work. Can anyone please help me with this?21wd.addPromiseChainMethod('startApp', function () {22 var self = this;23 return self.init({24 });25});26wd.addPromiseChainMethod('closeApp', function () {27 var self = this;28 return self.closeApp().then(function () {29 return self.quit();30 });31});
Using AI Code Generation
1var webdriverio = require('webdriverio');2var should = require('should');3var options = {4 desiredCapabilities: {5 }6};7var client = webdriverio.remote(options);8 .init()9 .elements('android=new UiSelector().resourceId("android:id/list")')10 .then(function (els) {11 console.log(els);12 return client.elementIdLocation(els.value[0].ELEMENT);13 })14 .then(function (loc) {15 console.log(loc);16 return client.touchPerform([{17 options: {18 }19 }, {20 options: {21 }22 }, {23 }]);24 })25 .end();26var webdriverio = require('webdriverio');27var should = require('should');28var options = {29 desiredCapabilities: {30 }31};32var client = webdriverio.remote(options);33 .init()34 .scrollTo('new UiSelector().text("Add Contact")')35 .end();36var webdriverio = require('webdriverio');37var should = require('should');38var options = {39 desiredCapabilities: {
Using AI Code Generation
1driver.scroll(el, x, y);2driver.scrollTo(text);3driver.scrollToExact(text);4driver.getOrientation();5driver.setOrientation(orientation);6driver.getGeoLocation();7driver.setGeoLocation(latitude, longitude, altitude);8driver.getPerformanceData(packageName, dataType, dataReadTimeout);9driver.getPerformanceDataTypes();10driver.getAvailableLogTypes();11driver.getLog(logType);12driver.getLogTypes();13driver.getDeviceTime();14driver.getNetworkConnection();15driver.setNetworkConnection(networkConnection);16driver.setBattery(battery);17driver.getBattery();18driver.setPowerCapacity(powerCapacity);19driver.getPowerCapacity();20driver.toggleWiFi();21driver.toggleAirplaneMode();
Using AI Code Generation
1driver.scroll(el, 0, 1000);2driver.scrollTo("text");3driver.scrollToExact("text");4driver.scrollIntoView("text");5driver.scrollIntoView("text");6driver.scrollToExact("text");7driver.scrollTo("text");8driver.scroll(el, 0, 1000);9driver.swipe(100, 100, 100, 400, 1000);10driver.scroll(el, 0, 1000);11driver.scrollTo("text");12driver.scrollToExact("text");13driver.scrollIntoView("text");14driver.scrollIntoView("text");15driver.scrollToExact("text");16driver.scrollTo("text");17driver.scroll(el, 0, 1000);18driver.swipe(100, 100, 100, 400, 1000);19driver.scroll(el, 0, 1000);20driver.scrollTo("text");21driver.scrollToExact("text");22driver.scrollIntoView("text");23driver.scrollIntoView("text");24driver.scrollToExact("text");25driver.scrollTo("text");
Using AI Code Generation
1describe('Test Appium Scroll method', function() {2 it('should scroll to element', function () {3 driver.init({4 });5 driver.sleep(6000);6 driver.elementByAccessibilityId('Views').click();7 driver.elementByAccessibilityId('Date Widgets').click();8 driver.elementByAccessibilityId('2. Inline').click();9 driver.sleep(3000);10 driver.elementByAccessibilityId('9').click();11 driver.sleep(3000);12 driver.elementByAccessibilityId('15').click();13 driver.sleep(3000);14 driver.elementByAccessibilityId('45').click();15 driver.sleep(3000);16 driver.elementByAccessibilityId('AM').click();17 driver.sleep(3000);18 driver.elementByAccessibilityId('2').click();19 driver.sleep(3000);20 driver.elementByAccessibilityId('20').click();21 driver.sleep(3000);22 driver.elementByAccessibilityId('OK').click();23 driver.sleep(3000);24 driver.elementByAccessibilityId('2').click();25 driver.sleep(3000);26 driver.elementByAccessibilityId('20').click();27 driver.sleep(3000);28 driver.elementByAccessibilityId('OK').click();29 driver.sleep(3000);30 driver.elementByAccessibilityId('2').click();31 driver.sleep(3000);32 driver.elementByAccessibilityId('20').click();33 driver.sleep(3000);34 driver.elementByAccessibilityId('OK').click();35 driver.sleep(3000);36 driver.elementByAccessibilityId('2').click();37 driver.sleep(3000);38 driver.elementByAccessibilityId('20').click();39 driver.sleep(3000);40 driver.elementByAccessibilityId('OK').click();41 driver.sleep(3000);42 driver.elementByAccessibilityId('2').click();43 driver.sleep(3000);44 driver.elementByAccessibilityId('20').click();45 driver.sleep(3000);46 driver.elementByAccessibilityId('OK').click();47 driver.sleep(3000);48 driver.elementByAccessibilityId('
Using AI Code Generation
1var wd = require('wd');2var assert = require('assert');3var desired = {4};5var driver = wd.promiseChainRemote('localhost', 4723);6 .init(desired)7 .setImplicitWaitTimeout(5000)8 .elementById('com.example.appiumtest:id/scrollView')9 .then(function (el) {10 return driver.scroll(el, 0, 1000);11 })12 .sleep(2000)13 .quit();
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!!