How to use getElementText method in Webdriverio

Best JavaScript code snippet using webdriverio-monorepo

indoor.js

Source:indoor.js Github

copy

Full Screen

...18 });19 it('ของใช้ส่วนตัว', async function () {20 this.timeout(300 * 1000);21 categoryTwo = byValueKey("catTwo0");22 expect(await driver.getElementText(categoryTwo)).to.equal('ของใช้ส่วนตัว');23 scrollKey = byValueKey('horiLst0');24 for (j = 0; j < 4; j++) {25 subCategoryTwo = byValueKey("subCatTwoTxt0" + "in" + j.toString());26 switch (j) {27 case 0:28 expect(await driver.getElementText(subCategoryTwo)).to.equal('ผลิตภัณฑ์กำจัดขน');29 break;30 case 1:31 driver.execute('flutter:scrollUntilVisible', scrollKey, {32 item: subCategoryTwo,33 dxScroll: -200,34 dyScroll: 1035 });36 expect(await driver.getElementText(subCategoryTwo)).to.equal('ผลิตภัณฑ์ดูแลส่วนตัว');37 break;38 case 2:39 driver.execute('flutter:scrollUntilVisible', scrollKey, {40 item: subCategoryTwo,41 dxScroll: -200,42 dyScroll: 1043 });44 expect(await driver.getElementText(subCategoryTwo)).to.equal('ผลิตภัณฑ์ดูแลช่องปาก');45 break;46 case 3:47 driver.execute('flutter:scrollUntilVisible', scrollKey, {48 item: subCategoryTwo,49 dxScroll: -200,50 dyScroll: 1051 });52 expect(await driver.getElementText(subCategoryTwo)).to.equal('ผลิตภัณฑ์เกี่ยวกับเท้า');53 break;54 }55 }56 });57 it('ถังขยะและถุงขยะ', async function () {58 this.timeout(300*1000);59 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {60 item: byValueKey("catTwo1"),61 dxScroll: 10,62 dyScroll: -30063 });64 categoryTwo = byValueKey("catTwo1");65 expect(await driver.getElementText(categoryTwo)).to.equal('ถังขยะและถุงขยะ');66 scrollKey = byValueKey('horiLst1');67 for (j = 0; j < 2; j++) {68 subCategoryTwo = byValueKey("subCatTwoTxt1" + "in" + j.toString());69 switch (j) {70 case 0:71 expect(await driver.getElementText(subCategoryTwo)).to.equal('ถังขยะ');72 break;73 case 1:74 driver.execute('flutter:scrollUntilVisible', scrollKey, {75 item: subCategoryTwo,76 dxScroll: -200,77 dyScroll: 1078 });79 expect(await driver.getElementText(subCategoryTwo)).to.equal('ถุงขยะ');80 break;81 }82 }83 });84 it('น้ำยาทำความสะอาด', async function () {85 this.timeout(300 * 1000);86 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {87 item: byValueKey("catTwo2"),88 dxScroll: 10,89 dyScroll: -30090 });91 categoryTwo = byValueKey("catTwo2");92 expect(await driver.getElementText(categoryTwo)).to.equal('น้ำยาทำความสะอาด');93 scrollKey = byValueKey('horiLst2');94 var j;95 for (j = 0; j < 12; j++) {96 subCategoryTwo = byValueKey("subCatTwoTxt2" + "in" + j.toString());97 switch (j) {98 case 0:99 expect(await driver.getElementText(subCategoryTwo)).to.equal('น้ำยากำจัดสิ่งอุดตันและกลิ่น');100 break;101 case 1:102 driver.execute('flutter:scrollUntilVisible', scrollKey, {103 item: subCategoryTwo,104 dxScroll: -200,105 dyScroll: 10106 });107 expect(await driver.getElementText(subCategoryTwo)).to.equal('น้ำยาขจัดกลิ่นสัตว์เลี้ยง');108 break;109 case 2:110 driver.execute('flutter:scrollUntilVisible', scrollKey, {111 item: subCategoryTwo,112 dxScroll: -200,113 dyScroll: 10114 });115 expect(await driver.getElementText(subCategoryTwo)).to.equal('น้ำยาทำความสะอาดเครื่องใช้ไฟฟ้า');116 break;117 case 3:118 driver.execute('flutter:scrollUntilVisible', scrollKey, {119 item: subCategoryTwo,120 dxScroll: -200,121 dyScroll: 10122 });123 expect(await driver.getElementText(subCategoryTwo)).to.equal('น้ำยาทำความสะอาดเฟอร์นิเจอร์');124 break;125 case 4:126 driver.execute('flutter:scrollUntilVisible', scrollKey, {127 item: subCategoryTwo,128 dxScroll: -200,129 dyScroll: 10130 });131 expect(await driver.getElementText(subCategoryTwo)).to.equal('น้ำยาทำความสะอาดกระจก');132 break;133 case 5:134 driver.execute('flutter:scrollUntilVisible', scrollKey, {135 item: subCategoryTwo,136 dxScroll: -200,137 dyScroll: 10138 });139 expect(await driver.getElementText(subCategoryTwo)).to.equal('น้ำยาทำความสะอาดพื้น');140 break;141 case 6:142 driver.execute('flutter:scrollUntilVisible', scrollKey, {143 item: subCategoryTwo,144 dxScroll: -200,145 dyScroll: 10146 });147 expect(await driver.getElementText(subCategoryTwo)).to.equal('น้ำยาทำความสะอาดภาชนะ');148 break;149 case 7:150 driver.execute('flutter:scrollUntilVisible', scrollKey, {151 item: subCategoryTwo,152 dxScroll: -200,153 dyScroll: 10154 });155 expect(await driver.getElementText(subCategoryTwo)).to.equal('น้ำยาทำความสะอาดรถยนต์');156 break;157 case 8:158 driver.execute('flutter:scrollUntilVisible', scrollKey, {159 item: subCategoryTwo,160 dxScroll: -200,161 dyScroll: 10162 });163 expect(await driver.getElementText(subCategoryTwo)).to.equal('น้ำยาทำความสะอาดสุขภัณฑ์');164 break;165 case 9:166 driver.execute('flutter:scrollUntilVisible', scrollKey, {167 item: subCategoryTwo,168 dxScroll: -200,169 dyScroll: 10170 });171 expect(await driver.getElementText(subCategoryTwo)).to.equal('น้ำยาทำความสะอาดอื่นๆ');172 break;173 case 10:174 driver.execute('flutter:scrollUntilVisible', scrollKey, {175 item: subCategoryTwo,176 dxScroll: -200,177 dyScroll: 10178 });179 expect(await driver.getElementText(subCategoryTwo)).to.equal('น้ำยาล้างมือ');180 break;181 case 11:182 driver.execute('flutter:scrollUntilVisible', scrollKey, {183 item: subCategoryTwo,184 dxScroll: -200,185 dyScroll: 10186 });187 expect(await driver.getElementText(subCategoryTwo)).to.equal('น้ำยาล้างผักและผลไม้');188 break;189 }190 }191 });192 it('น้ำหอมปรับอากาศและดูดความชื้น', async function () {193 this.timeout(300 * 1000);194 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {195 item: byValueKey("catTwo3"),196 dxScroll: 10,197 dyScroll: -300198 });199 categoryTwo = byValueKey("catTwo3");200 expect(await driver.getElementText(categoryTwo)).to.equal('น้ำหอมปรับอากาศและดูดความชื้น');201 scrollKey = byValueKey('horiLst3');202 var j;203 for (j = 0; j < 2; j++) {204 subCategoryTwo = byValueKey("subCatTwoTxt3" + "in" + j.toString());205 switch (j) {206 case 0:207 expect(await driver.getElementText(subCategoryTwo)).to.equal('ที่ดูดความชื้น');208 break;209 case 1:210 driver.execute('flutter:scrollUntilVisible', scrollKey, {211 item: subCategoryTwo,212 dxScroll: -200,213 dyScroll: 10214 });215 expect(await driver.getElementText(subCategoryTwo)).to.equal('น้ำหอมปรับอากาศ');216 break;217 }218 }219 });220 it('อุปกรณ์เครื่องเขียน', async function () {221 this.timeout(300 * 1000);222 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {223 item: byValueKey("catTwo4"),224 dxScroll: 10,225 dyScroll: -300226 });227 categoryTwo = byValueKey("catTwo4");228 expect(await driver.getElementText(categoryTwo)).to.equal('อุปกรณ์เครื่องเขียน');229 scrollKey = byValueKey('horiLst4');230 var j;231 for (j = 0; j < 17; j++) {232 subCategoryTwo = byValueKey("subCatTwoTxt4" + "in" + j.toString());233 switch (j) {234 case 0:235 expect(await driver.getElementText(subCategoryTwo)).to.equal('เทปกาวและอุปกรณ์');236 break;237 case 1:238 driver.execute('flutter:scrollUntilVisible', scrollKey, {239 item: subCategoryTwo,240 dxScroll: -200,241 dyScroll: 10242 });243 expect(await driver.getElementText(subCategoryTwo)).to.equal('กรรไกรและคัตเตอร์');244 break;245 case 2:246 driver.execute('flutter:scrollUntilVisible', scrollKey, {247 item: subCategoryTwo,248 dxScroll: -200,249 dyScroll: 10250 });251 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องเจาะและเย็บกระดาษ');252 break;253 case 3:254 driver.execute('flutter:scrollUntilVisible', scrollKey, {255 item: subCategoryTwo,256 dxScroll: -200,257 dyScroll: 10258 });259 expect(await driver.getElementText(subCategoryTwo)).to.equal('แฟ้ม');260 break;261 case 4:262 driver.execute('flutter:scrollUntilVisible', scrollKey, {263 item: subCategoryTwo,264 dxScroll: -200,265 dyScroll: 10266 });267 expect(await driver.getElementText(subCategoryTwo)).to.equal('แม่เหล็กและหมุด');268 break;269 case 5:270 driver.execute('flutter:scrollUntilVisible', scrollKey, {271 item: subCategoryTwo,272 dxScroll: -200,273 dyScroll: 10274 });275 expect(await driver.getElementText(subCategoryTwo)).to.equal('ไม้บรรทัดและวงเวียน');276 break;277 case 6:278 driver.execute('flutter:scrollUntilVisible', scrollKey, {279 item: subCategoryTwo,280 dxScroll: -200,281 dyScroll: 10282 });283 expect(await driver.getElementText(subCategoryTwo)).to.equal('กบเหลาดินสอ');284 break;285 case 7:286 driver.execute('flutter:scrollUntilVisible', scrollKey, {287 item: subCategoryTwo,288 dxScroll: -200,289 dyScroll: 10290 });291 expect(await driver.getElementText(subCategoryTwo)).to.equal('กาว');292 break;293 case 8:294 driver.execute('flutter:scrollUntilVisible', scrollKey, {295 item: subCategoryTwo,296 dxScroll: -200,297 dyScroll: 10298 });299 expect(await driver.getElementText(subCategoryTwo)).to.equal('คลิปหนีบกระดาษ');300 break;301 case 9:302 driver.execute('flutter:scrollUntilVisible', scrollKey, {303 item: subCategoryTwo,304 dxScroll: -200,305 dyScroll: 10306 });307 expect(await driver.getElementText(subCategoryTwo)).to.equal('ดินสอและดินสอสี');308 break;309 case 10:310 driver.execute('flutter:scrollUntilVisible', scrollKey, {311 item: subCategoryTwo,312 dxScroll: -200,313 dyScroll: 10314 });315 expect(await driver.getElementText(subCategoryTwo)).to.equal('ตรายางและแท่นหมึก');316 break;317 case 11:318 driver.execute('flutter:scrollUntilVisible', scrollKey, {319 item: subCategoryTwo,320 dxScroll: -200,321 dyScroll: 10322 });323 expect(await driver.getElementText(subCategoryTwo)).to.equal('ปากกาและปากกาเคมี');324 break;325 case 12:326 driver.execute('flutter:scrollUntilVisible', scrollKey, {327 item: subCategoryTwo,328 dxScroll: -200,329 dyScroll: 10330 });331 expect(await driver.getElementText(subCategoryTwo)).to.equal('ผลิตภัณฑ์กระดาษ');332 break;333 case 13:334 driver.execute('flutter:scrollUntilVisible', scrollKey, {335 item: subCategoryTwo,336 dxScroll: -200,337 dyScroll: 10338 });339 expect(await driver.getElementText(subCategoryTwo)).to.equal('ยางลบและผลิตภัณฑ์ลบคำผิด');340 break;341 case 14:342 driver.execute('flutter:scrollUntilVisible', scrollKey, {343 item: subCategoryTwo,344 dxScroll: -200,345 dyScroll: 10346 });347 expect(await driver.getElementText(subCategoryTwo)).to.equal('สติ๊กเกอร์');348 break;349 case 15:350 driver.execute('flutter:scrollUntilVisible', scrollKey, {351 item: subCategoryTwo,352 dxScroll: -200,353 dyScroll: 10354 });355 expect(await driver.getElementText(subCategoryTwo)).to.equal('สมุด');356 break;357 case 16:358 driver.execute('flutter:scrollUntilVisible', scrollKey, {359 item: subCategoryTwo,360 dxScroll: -200,361 dyScroll: 10362 });363 expect(await driver.getElementText(subCategoryTwo)).to.equal('งานศิลปะ');364 break;365 }366 }367 });368 it('อุปกรณ์เดินทาง', async function () {369 this.timeout(300 * 1000);370 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {371 item: byValueKey("catTwo5"),372 dxScroll: 10,373 dyScroll: -300374 });375 categoryTwo = byValueKey("catTwo5");376 expect(await driver.getElementText(categoryTwo)).to.equal('อุปกรณ์เดินทาง');377 scrollKey = byValueKey('horiLst5');378 var j;379 for (j = 0; j < 6; j++) {380 subCategoryTwo = byValueKey("subCatTwoTxt5" + "in" + j.toString());381 switch (j) {382 case 0:383 expect(await driver.getElementText(subCategoryTwo)).to.equal('กระเป๋าเดินทาง');384 break;385 case 1:386 driver.execute('flutter:scrollUntilVisible', scrollKey, {387 item: subCategoryTwo,388 dxScroll: -200,389 dyScroll: 10390 });391 expect(await driver.getElementText(subCategoryTwo)).to.equal('กระเป๋าเก็บอุณหภูมิ');392 break;393 case 2:394 driver.execute('flutter:scrollUntilVisible', scrollKey, {395 item: subCategoryTwo,396 dxScroll: -200,397 dyScroll: 10398 });399 expect(await driver.getElementText(subCategoryTwo)).to.equal('กระเป๋าเป้และกระเป๋าสะพาย');400 break;401 case 3:402 driver.execute('flutter:scrollUntilVisible', scrollKey, {403 item: subCategoryTwo,404 dxScroll: -200,405 dyScroll: 10406 });407 expect(await driver.getElementText(subCategoryTwo)).to.equal('ร่มและเสื้อกันฝน');408 break;409 case 4:410 driver.execute('flutter:scrollUntilVisible', scrollKey, {411 item: subCategoryTwo,412 dxScroll: -200,413 dyScroll: 10414 });415 expect(await driver.getElementText(subCategoryTwo)).to.equal('อุปกรณ์เดินทางอื่นๆ');416 break;417 case 5:418 driver.execute('flutter:scrollUntilVisible', scrollKey, {419 item: subCategoryTwo,420 dxScroll: -200,421 dyScroll: 10422 });423 expect(await driver.getElementText(subCategoryTwo)).to.equal('กระเป๋าจัดเก็บ');424 break;425 }426 }427 });428 it('อุปกรณ์แพ็คกิ้ง', async function () {429 this.timeout(300 * 1000);430 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {431 item: byValueKey("catTwo6"),432 dxScroll: 10,433 dyScroll: -300434 });435 categoryTwo = byValueKey("catTwo6");436 expect(await driver.getElementText(categoryTwo)).to.equal('อุปกรณ์แพ็คกิ้ง');437 scrollKey = byValueKey('horiLst6');438 var j;439 for (j = 0; j < 5; j++) {440 subCategoryTwo = byValueKey("subCatTwoTxt6" + "in" + j.toString());441 switch (j) {442 case 0:443 expect(await driver.getElementText(subCategoryTwo)).to.equal('วัสดุห่อหุ้ม');444 break;445 case 1:446 driver.execute('flutter:scrollUntilVisible', scrollKey, {447 item: subCategoryTwo,448 dxScroll: -200,449 dyScroll: 10450 });451 expect(await driver.getElementText(subCategoryTwo)).to.equal('กล่องและกระดาษ');452 break;453 case 2:454 driver.execute('flutter:scrollUntilVisible', scrollKey, {455 item: subCategoryTwo,456 dxScroll: -200,457 dyScroll: 10458 });459 expect(await driver.getElementText(subCategoryTwo)).to.equal('เชือกและสายรัด');460 break;461 case 3:462 driver.execute('flutter:scrollUntilVisible', scrollKey, {463 item: subCategoryTwo,464 dxScroll: -200,465 dyScroll: 10466 });467 expect(await driver.getElementText(subCategoryTwo)).to.equal('ซองไปรษณีย์');468 break;469 case 4:470 driver.execute('flutter:scrollUntilVisible', scrollKey, {471 item: subCategoryTwo,472 dxScroll: -200,473 dyScroll: 10474 });475 expect(await driver.getElementText(subCategoryTwo)).to.equal('อุปกรณ์แพ็คกิ้งอื่นๆ');476 break;477 }478 }479 });480 it('อุปกรณ์และผลิตภัณฑ์ซักรีด', async function () {481 this.timeout(300 * 1000);482 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {483 item: byValueKey("catTwo7"),484 dxScroll: 10,485 dyScroll: -300486 });487 categoryTwo = byValueKey("catTwo7");488 expect(await driver.getElementText(categoryTwo)).to.equal('อุปกรณ์และผลิตภัณฑ์ซักรีด');489 scrollKey = byValueKey('horiLst7');490 var j;491 for (j = 0; j < 5; j++) {492 subCategoryTwo = byValueKey("subCatTwoTxt7" + "in" + j.toString());493 switch (j) {494 case 0:495 expect(await driver.getElementText(subCategoryTwo)).to.equal('อุปกรณ์ซักผ้า');496 break;497 case 1:498 driver.execute('flutter:scrollUntilVisible', scrollKey, {499 item: subCategoryTwo,500 dxScroll: -200,501 dyScroll: 10502 });503 expect(await driver.getElementText(subCategoryTwo)).to.equal('โต๊ะรีดผ้าและอุปกรณ์');504 break;505 case 2:506 driver.execute('flutter:scrollUntilVisible', scrollKey, {507 item: subCategoryTwo,508 dxScroll: -200,509 dyScroll: 10510 });511 expect(await driver.getElementText(subCategoryTwo)).to.equal('น้ำยาซักผ้า');512 break;513 case 3:514 driver.execute('flutter:scrollUntilVisible', scrollKey, {515 item: subCategoryTwo,516 dxScroll: -200,517 dyScroll: 10518 });519 expect(await driver.getElementText(subCategoryTwo)).to.equal('น้ำยาปรับผ้านุ่ม');520 break;521 case 4:522 driver.execute('flutter:scrollUntilVisible', scrollKey, {523 item: subCategoryTwo,524 dxScroll: -200,525 dyScroll: 10526 });527 expect(await driver.getElementText(subCategoryTwo)).to.equal('น้ำยารีดผ้า');528 break;529 }530 }531 });532 533 it('อุปกรณ์กำจัดแมลงและสัตว์รบกวน', async function () {534 this.timeout(300 * 1000);535 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {536 item: byValueKey("catTwo8"),537 dxScroll: 10,538 dyScroll: -300539 });540 categoryTwo = byValueKey("catTwo8");541 expect(await driver.getElementText(categoryTwo)).to.equal('อุปกรณ์กำจัดแมลงและสัตว์รบกวน');542 scrollKey = byValueKey('horiLst8');543 var j;544 for (j = 0; j < 2; j++) {545 subCategoryTwo = byValueKey("subCatTwoTxt8" + "in" + j.toString());546 switch (j) {547 case 0:548 expect(await driver.getElementText(subCategoryTwo)).to.equal('สารกำจัดแมลงและสัตว์');549 break;550 case 1:551 driver.execute('flutter:scrollUntilVisible', scrollKey, {552 item: subCategoryTwo,553 dxScroll: -200,554 dyScroll: 10555 });556 expect(await driver.getElementText(subCategoryTwo)).to.equal('อุปกรณ์กำจัดแมลงและสัตว์รบกวน');557 break;558 }559 }560 });561 it('อุปกรณ์จัดเก็บเสื้อผ้า', async function () {562 this.timeout(300 * 1000);563 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {564 item: byValueKey("catTwo9"),565 dxScroll: 10,566 dyScroll: -300567 });568 categoryTwo = byValueKey("catTwo9");569 expect(await driver.getElementText(categoryTwo)).to.equal('อุปกรณ์จัดเก็บเสื้อผ้า');570 scrollKey = byValueKey('horiLst9');571 var j;572 for (j = 0; j < 5; j++) {573 subCategoryTwo = byValueKey("subCatTwoTxt9" + "in" + j.toString());574 switch (j) {575 case 0:576 expect(await driver.getElementText(subCategoryTwo)).to.equal('กล่องเก็บผ้า');577 break;578 case 1:579 driver.execute('flutter:scrollUntilVisible', scrollKey, {580 item: subCategoryTwo,581 dxScroll: -200,582 dyScroll: 10583 });584 expect(await driver.getElementText(subCategoryTwo)).to.equal('ขอแขวนผ้า');585 break;586 case 2:587 driver.execute('flutter:scrollUntilVisible', scrollKey, {588 item: subCategoryTwo,589 dxScroll: -200,590 dyScroll: 10591 });592 expect(await driver.getElementText(subCategoryTwo)).to.equal('ตะกร้าผ้า');593 break;594 case 3:595 driver.execute('flutter:scrollUntilVisible', scrollKey, {596 item: subCategoryTwo,597 dxScroll: -200,598 dyScroll: 10599 });600 expect(await driver.getElementText(subCategoryTwo)).to.equal('ตู้เสื้อผ้า');601 break;602 case 4:603 driver.execute('flutter:scrollUntilVisible', scrollKey, {604 item: subCategoryTwo,605 dxScroll: -200,606 dyScroll: 10607 });608 expect(await driver.getElementText(subCategoryTwo)).to.equal('ที่แขวนและถุงจัดเก็บ');609 break;610 }611 }612 });613 it('อุปกรณ์จัดเก็บทั่วไป', async function () {614 this.timeout(300 * 1000);615 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {616 item: byValueKey("catTwo10"),617 dxScroll: 10,618 dyScroll: -300619 });620 categoryTwo = byValueKey("catTwo10");621 expect(await driver.getElementText(categoryTwo)).to.equal('อุปกรณ์จัดเก็บทั่วไป');622 scrollKey = byValueKey('horiLst10');623 var j;624 for (j = 0; j < 8; j++) {625 subCategoryTwo = byValueKey("subCatTwoTxt10" + "in" + j.toString());626 switch (j) {627 case 0:628 expect(await driver.getElementText(subCategoryTwo)).to.equal('แผ่นชั้นและแขนรับชั้น');629 break;630 case 1:631 driver.execute('flutter:scrollUntilVisible', scrollKey, {632 item: subCategoryTwo,633 dxScroll: -200,634 dyScroll: 10635 });636 expect(await driver.getElementText(subCategoryTwo)).to.equal('ที่จัดเก็บรองเท้า');637 break;638 case 2:639 driver.execute('flutter:scrollUntilVisible', scrollKey, {640 item: subCategoryTwo,641 dxScroll: -200,642 dyScroll: 10643 });644 expect(await driver.getElementText(subCategoryTwo)).to.equal('กระเป๋าอเนกประสงค์');645 break;646 case 3:647 driver.execute('flutter:scrollUntilVisible', scrollKey, {648 item: subCategoryTwo,649 dxScroll: -200,650 dyScroll: 10651 });652 expect(await driver.getElementText(subCategoryTwo)).to.equal('กล่องเก็บของ');653 break;654 case 4:655 driver.execute('flutter:scrollUntilVisible', scrollKey, {656 item: subCategoryTwo,657 dxScroll: -200,658 dyScroll: 10659 });660 expect(await driver.getElementText(subCategoryTwo)).to.equal('ชั้นวางของ');661 break;662 case 5:663 driver.execute('flutter:scrollUntilVisible', scrollKey, {664 item: subCategoryTwo,665 dxScroll: -200,666 dyScroll: 10667 });668 expect(await driver.getElementText(subCategoryTwo)).to.equal('ลิ้นชักเก็บของ');669 break;670 case 6:671 driver.execute('flutter:scrollUntilVisible', scrollKey, {672 item: subCategoryTwo,673 dxScroll: -200,674 dyScroll: 10675 });676 expect(await driver.getElementText(subCategoryTwo)).to.equal('อุปกรณ์จัดเก็บเครื่องสำอาง');677 break;678 case 7:679 driver.execute('flutter:scrollUntilVisible', scrollKey, {680 item: subCategoryTwo,681 dxScroll: -200,682 dyScroll: 10683 });684 expect(await driver.getElementText(subCategoryTwo)).to.equal('อุปกรณ์จัดเก็บสำนักงาน');685 break;686 }687 }688 });689 it('อุปกรณ์ตากผ้า', async function () {690 this.timeout(300 * 1000);691 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {692 item: byValueKey("catTwo11"),693 dxScroll: 10,694 dyScroll: -300695 });696 categoryTwo = byValueKey("catTwo11");697 expect(await driver.getElementText(categoryTwo)).to.equal('อุปกรณ์ตากผ้า');698 scrollKey = byValueKey('horiLst11');699 var j;700 for (j = 0; j < 5; j++) {701 subCategoryTwo = byValueKey("subCatTwoTxt11" + "in" + j.toString());702 switch (j) {703 case 0:704 console.log(await driver.getElementText(subCategoryTwo));705 expect(await driver.getElementText(subCategoryTwo)).to.equal('ไม้แขวนเสื้อ');706 break;707 case 1:708 driver.execute('flutter:scrollUntilVisible', scrollKey, {709 item: subCategoryTwo,710 dxScroll: -200,711 dyScroll: 10712 });713 expect(await driver.getElementText(subCategoryTwo)).to.equal('กิ๊บหนีบผ้า');714 break;715 case 2:716 driver.execute('flutter:scrollUntilVisible', scrollKey, {717 item: subCategoryTwo,718 dxScroll: -200,719 dyScroll: 10720 });721 expect(await driver.getElementText(subCategoryTwo)).to.equal('ราวตากผ้า');722 break;723 case 3:724 driver.execute('flutter:scrollUntilVisible', scrollKey, {725 item: subCategoryTwo,726 dxScroll: -200,727 dyScroll: 10728 });729 expect(await driver.getElementText(subCategoryTwo)).to.equal('ห่วงตากผ้า');730 break;731 case 4:732 driver.execute('flutter:scrollUntilVisible', scrollKey, {733 item: subCategoryTwo,734 dxScroll: -200,735 dyScroll: 10736 });737 expect(await driver.getElementText(subCategoryTwo)).to.equal('อุปกรณ์ตากผ้าอื่นๆ');738 break;739 }740 }741 });742 it('อุปกรณ์ทำความสะอาด', async function () {743 this.timeout(300 * 1000);744 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {745 item: byValueKey("catTwo12"),746 dxScroll: 10,747 dyScroll: -300748 });749 categoryTwo = byValueKey("catTwo12");750 expect(await driver.getElementText(categoryTwo)).to.equal('อุปกรณ์ทำความสะอาด');751 scrollKey = byValueKey('horiLst12');752 var j;753 for (j = 0; j < 14; j++) {754 subCategoryTwo = byValueKey("subCatTwoTxt12" + "in" + j.toString());755 switch (j) {756 case 0:757 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องมือขัดพื้นและอุปกรณ์');758 break;759 case 1:760 driver.execute('flutter:scrollUntilVisible', scrollKey, {761 item: subCategoryTwo,762 dxScroll: -200,763 dyScroll: 10764 });765 expect(await driver.getElementText(subCategoryTwo)).to.equal('ไม้ม็อบและอุปกรณ์');766 break;767 case 2:768 driver.execute('flutter:scrollUntilVisible', scrollKey, {769 item: subCategoryTwo,770 dxScroll: -200,771 dyScroll: 10772 });773 expect(await driver.getElementText(subCategoryTwo)).to.equal('แปรงทำความสะอาด');774 break;775 case 3:776 driver.execute('flutter:scrollUntilVisible', scrollKey, {777 item: subCategoryTwo,778 dxScroll: -200,779 dyScroll: 10780 });781 expect(await driver.getElementText(subCategoryTwo)).to.equal('แผ่นกรองอากาศ');782 break;783 case 4:784 driver.execute('flutter:scrollUntilVisible', scrollKey, {785 item: subCategoryTwo,786 dxScroll: -200,787 dyScroll: 10788 });789 expect(await driver.getElementText(subCategoryTwo)).to.equal('ไม้กวาดและที่โกยผง');790 break;791 case 5:792 driver.execute('flutter:scrollUntilVisible', scrollKey, {793 item: subCategoryTwo,794 dxScroll: -200,795 dyScroll: 10796 });797 expect(await driver.getElementText(subCategoryTwo)).to.equal('กระดาษชำระและทิชชู่เปียก');798 break;799 case 6:800 driver.execute('flutter:scrollUntilVisible', scrollKey, {801 item: subCategoryTwo,802 dxScroll: -200,803 dyScroll: 10804 });805 expect(await driver.getElementText(subCategoryTwo)).to.equal('ถังน้ำ');806 break;807 case 7:808 driver.execute('flutter:scrollUntilVisible', scrollKey, {809 item: subCategoryTwo,810 dxScroll: -200,811 dyScroll: 10812 });813 expect(await driver.getElementText(subCategoryTwo)).to.equal('ถุงมือ');814 break;815 case 8:816 driver.execute('flutter:scrollUntilVisible', scrollKey, {817 item: subCategoryTwo,818 dxScroll: -200,819 dyScroll: 10820 });821 expect(await driver.getElementText(subCategoryTwo)).to.equal('ที่เก็บอุปกรณ์');822 break;823 case 9:824 driver.execute('flutter:scrollUntilVisible', scrollKey, {825 item: subCategoryTwo,826 dxScroll: -200,827 dyScroll: 10828 });829 expect(await driver.getElementText(subCategoryTwo)).to.equal('ที่เช็ดกระจกและยางไล่น้ำ');830 break;831 case 10:832 driver.execute('flutter:scrollUntilVisible', scrollKey, {833 item: subCategoryTwo,834 dxScroll: -200,835 dyScroll: 10836 });837 expect(await driver.getElementText(subCategoryTwo)).to.equal('ผ้าเช็ดอเนกประสงค์');838 break;839 case 11:840 driver.execute('flutter:scrollUntilVisible', scrollKey, {841 item: subCategoryTwo,842 dxScroll: -200,843 dyScroll: 10844 });845 expect(await driver.getElementText(subCategoryTwo)).to.equal('ฟองน้ำและใยขัด');846 break;847 case 12:848 driver.execute('flutter:scrollUntilVisible', scrollKey, {849 item: subCategoryTwo,850 dxScroll: -200,851 dyScroll: 10852 });853 expect(await driver.getElementText(subCategoryTwo)).to.equal('ยางปั๊ม');854 break;855 case 13:856 driver.execute('flutter:scrollUntilVisible', scrollKey, {857 item: subCategoryTwo,858 dxScroll: -200,859 dyScroll: 10860 });861 expect(await driver.getElementText(subCategoryTwo)).to.equal('ลูกกลิ้งเก็บขนและฝุ่น');862 break;863 }864 }865 });866 it('ผลิตภัณฑ์แม่และเด็ก', async function () {867 this.timeout(300 * 1000);868 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {869 item: byValueKey("catTwo13"),870 dxScroll: 10,871 dyScroll: -300872 });873 categoryTwo = byValueKey("catTwo13");874 expect(await driver.getElementText(categoryTwo)).to.equal('ผลิตภัณฑ์แม่และเด็ก');875 scrollKey = byValueKey('horiLst13');876 var j;877 for (j = 0; j < 3; j++) {878 subCategoryTwo = byValueKey("subCatTwoTxt13" + "in" + j.toString());879 switch (j) {880 case 0:881 expect(await driver.getElementText(subCategoryTwo)).to.equal('ผลิตภัณฑ์เพื่อสุขอนามัย');882 break;883 case 1:884 driver.execute('flutter:scrollUntilVisible', scrollKey, {885 item: subCategoryTwo,886 dxScroll: -200,887 dyScroll: 10888 });889 expect(await driver.getElementText(subCategoryTwo)).to.equal('ผลิตภัณฑ์จำเป็นสำหรับเด็ก');890 break;891 case 2:892 driver.execute('flutter:scrollUntilVisible', scrollKey, {893 item: subCategoryTwo,894 dxScroll: -200,895 dyScroll: 10896 });897 expect(await driver.getElementText(subCategoryTwo)).to.equal('ผลิตภัณฑ์การทานอาหาร');898 break;899 }900 }901 }); 902 });903 describe('กลับไปหน้าหลัก', function(){904 before(function () {905 skip = false;906 });907 908 it('ไปหน้าหลัก', async function () {909 backBtn = byValueKey('backIcon');910 await driver.touchAction({911 action: 'tap',...

Full Screen

Full Screen

handtool.js

Source:handtool.js Github

copy

Full Screen

...23 });24 it('เครื่องมือโยธา', async function () {25 this.timeout(300 * 1000);26 categoryTwo = byValueKey("catTwo0");27 expect(await driver.getElementText(categoryTwo)).to.equal('เครื่องมือโยธา');28 scrollKey = byValueKey('horiLst0');29 for (j = 0; j < 8; j++) {30 subCategoryTwo = byValueKey("subCatTwoTxt0" + "in" + j.toString());31 switch (j) {32 case 0:33 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องโม่ปูน');34 break;35 case 1:36 driver.execute('flutter:scrollUntilVisible', scrollKey, {37 item: subCategoryTwo,38 dxScroll: -200,39 dyScroll: 1040 });41 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องขัดมันปูน');42 break;43 case 2:44 driver.execute('flutter:scrollUntilVisible', scrollKey, {45 item: subCategoryTwo,46 dxScroll: -200,47 dyScroll: 1048 });49 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องจี้ปูน');50 break;51 case 3:52 driver.execute('flutter:scrollUntilVisible', scrollKey, {53 item: subCategoryTwo,54 dxScroll: -200,55 dyScroll: 1056 });57 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องตบดิน');58 break;59 case 4:60 driver.execute('flutter:scrollUntilVisible', scrollKey, {61 item: subCategoryTwo,62 dxScroll: -200,63 dyScroll: 1064 });65 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องผสมปูนฉาบ');66 break;67 case 5:68 driver.execute('flutter:scrollUntilVisible', scrollKey, {69 item: subCategoryTwo,70 dxScroll: -200,71 dyScroll: 1072 });73 expect(await driver.getElementText(subCategoryTwo)).to.equal('อุปกรณ์ยกของ');74 break;75 case 6:76 driver.execute('flutter:scrollUntilVisible', scrollKey, {77 item: subCategoryTwo,78 dxScroll: -200,79 dyScroll: 1080 });81 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องปาดปูน');82 break;83 case 7:84 driver.execute('flutter:scrollUntilVisible', scrollKey, {85 item: subCategoryTwo,86 dxScroll: -200,87 dyScroll: 1088 });89 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องดัดเหล็ก');90 break;91 }92 }93 });94 it('เครื่องมือไฟฟ้า', async function () {95 this.timeout(300*1000);96 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {97 item: byValueKey("catTwo1"),98 dxScroll: 10,99 dyScroll: -400100 });101 categoryTwo = byValueKey("catTwo1");102 expect(await driver.getElementText(categoryTwo)).to.equal('เครื่องมือไฟฟ้า');103 scrollKey = byValueKey('horiLst1');104 for (j = 0; j < 11; j++) {105 subCategoryTwo = byValueKey("subCatTwoTxt1" + "in" + j.toString());106 switch (j) {107 case 0:108 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องเจียระไนและอุปกรณ์');109 break;110 case 1:111 driver.execute('flutter:scrollUntilVisible', scrollKey, {112 item: subCategoryTwo,113 dxScroll: -200,114 dyScroll: 10115 });116 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องเป่าลม');117 break;118 case 2:119 driver.execute('flutter:scrollUntilVisible', scrollKey, {120 item: subCategoryTwo,121 dxScroll: -200,122 dyScroll: 10123 });124 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องมือเลื่อยและอุปกรณ์');125 break;126 case 3:127 driver.execute('flutter:scrollUntilVisible', scrollKey, {128 item: subCategoryTwo,129 dxScroll: -200,130 dyScroll: 10131 });132 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องกบไสไม้และอุปกรณ์');133 break;134 case 4:135 driver.execute('flutter:scrollUntilVisible', scrollKey, {136 item: subCategoryTwo,137 dxScroll: -200,138 dyScroll: 10139 });140 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องฉีดน้ำและอุปกรณ์');141 break;142 case 5:143 driver.execute('flutter:scrollUntilVisible', scrollKey, {144 item: subCategoryTwo,145 dxScroll: -200,146 dyScroll: 10147 });148 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องมือตัดและอุปกรณ์');149 break;150 case 6:151 driver.execute('flutter:scrollUntilVisible', scrollKey, {152 item: subCategoryTwo,153 dxScroll: -200,154 dyScroll: 10155 });156 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องมือขัดและอุปกรณ์');157 break;158 case 7:159 driver.execute('flutter:scrollUntilVisible', scrollKey, {160 item: subCategoryTwo,161 dxScroll: -200,162 dyScroll: 10163 });164 expect(await driver.getElementText(subCategoryTwo)).to.equal('สว่านและดอกสว่าน');165 break;166 case 8:167 driver.execute('flutter:scrollUntilVisible', scrollKey, {168 item: subCategoryTwo,169 dxScroll: -200,170 dyScroll: 10171 });172 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องสกัด');173 break;174 case 9:175 driver.execute('flutter:scrollUntilVisible', scrollKey, {176 item: subCategoryTwo,177 dxScroll: -200,178 dyScroll: 10179 });180 expect(await driver.getElementText(subCategoryTwo)).to.equal('แบตเตอรี่เครื่องมือไร้สาย');181 break;182 case 10:183 driver.execute('flutter:scrollUntilVisible', scrollKey, {184 item: subCategoryTwo,185 dxScroll: -200,186 dyScroll: 10187 });188 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องพ่นละออง');189 break;190 }191 }192 });193 it('เครื่องมือช่าง', async function () {194 this.timeout(300 * 1000);195 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {196 item: byValueKey("catTwo2"),197 dxScroll: 10,198 dyScroll: -400199 });200 categoryTwo = byValueKey("catTwo2");201 expect(await driver.getElementText(categoryTwo)).to.equal('เครื่องมือช่าง');202 scrollKey = byValueKey('horiLst2');203 var j;204 for (j = 0; j < 16; j++) {205 subCategoryTwo = byValueKey("subCatTwoTxt2" + "in" + j.toString());206 switch (j) {207 case 0:208 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องมืองานปูน');209 break;210 case 1:211 driver.execute('flutter:scrollUntilVisible', scrollKey, {212 item: subCategoryTwo,213 dxScroll: -200,214 dyScroll: 10215 });216 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องมืองานไม้');217 break;218 case 2:219 driver.execute('flutter:scrollUntilVisible', scrollKey, {220 item: subCategoryTwo,221 dxScroll: -200,222 dyScroll: 10223 });224 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องมือวัด');225 break;226 case 3:227 driver.execute('flutter:scrollUntilVisible', scrollKey, {228 item: subCategoryTwo,229 dxScroll: -200,230 dyScroll: 10231 });232 expect(await driver.getElementText(subCategoryTwo)).to.equal('เลื่อย');233 break;234 case 4:235 driver.execute('flutter:scrollUntilVisible', scrollKey, {236 item: subCategoryTwo,237 dxScroll: -200,238 dyScroll: 10239 });240 expect(await driver.getElementText(subCategoryTwo)).to.equal('ไขควง');241 break;242 case 5:243 driver.execute('flutter:scrollUntilVisible', scrollKey, {244 item: subCategoryTwo,245 dxScroll: -200,246 dyScroll: 10247 });248 expect(await driver.getElementText(subCategoryTwo)).to.equal('กรรไกรตัดชิ้นงาน');249 break;250 case 6:251 driver.execute('flutter:scrollUntilVisible', scrollKey, {252 item: subCategoryTwo,253 dxScroll: -200,254 dyScroll: 10255 });256 expect(await driver.getElementText(subCategoryTwo)).to.equal('ไขควงบล็อก');257 break;258 case 7:259 driver.execute('flutter:scrollUntilVisible', scrollKey, {260 item: subCategoryTwo,261 dxScroll: -200,262 dyScroll: 10263 });264 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องมืออื่นๆ');265 break;266 case 8:267 driver.execute('flutter:scrollUntilVisible', scrollKey, {268 item: subCategoryTwo,269 dxScroll: -200,270 dyScroll: 10271 });272 expect(await driver.getElementText(subCategoryTwo)).to.equal('ค้อน');273 break;274 case 9:275 driver.execute('flutter:scrollUntilVisible', scrollKey, {276 item: subCategoryTwo,277 dxScroll: -200,278 dyScroll: 10279 });280 expect(await driver.getElementText(subCategoryTwo)).to.equal('คีม');281 break;282 case 10:283 driver.execute('flutter:scrollUntilVisible', scrollKey, {284 item: subCategoryTwo,285 dxScroll: -200,286 dyScroll: 10287 });288 expect(await driver.getElementText(subCategoryTwo)).to.equal('ปากกาจับงาน');289 break;290 case 11:291 driver.execute('flutter:scrollUntilVisible', scrollKey, {292 item: subCategoryTwo,293 dxScroll: -200,294 dyScroll: 10295 });296 expect(await driver.getElementText(subCategoryTwo)).to.equal('ประแจ');297 break;298 case 12:299 driver.execute('flutter:scrollUntilVisible', scrollKey, {300 item: subCategoryTwo,301 dxScroll: -200,302 dyScroll: 10303 });304 expect(await driver.getElementText(subCategoryTwo)).to.equal('แชลง');305 break;306 case 13:307 driver.execute('flutter:scrollUntilVisible', scrollKey, {308 item: subCategoryTwo,309 dxScroll: -200,310 dyScroll: 10311 });312 expect(await driver.getElementText(subCategoryTwo)).to.equal('ขวาน');313 break;314 case 14:315 driver.execute('flutter:scrollUntilVisible', scrollKey, {316 item: subCategoryTwo,317 dxScroll: -200,318 dyScroll: 10319 });320 expect(await driver.getElementText(subCategoryTwo)).to.equal('ชุดเครืองมือช่าง');321 break;322 case 15:323 driver.execute('flutter:scrollUntilVisible', scrollKey, {324 item: subCategoryTwo,325 dxScroll: -200,326 dyScroll: 10327 });328 expect(await driver.getElementText(subCategoryTwo)).to.equal('สว่านมือ');329 break;330 }331 }332 });333 it('เครื่องมือลม', async function () {334 this.timeout(300 * 1000);335 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {336 item: byValueKey("catTwo3"),337 dxScroll: 10,338 dyScroll: -400339 });340 categoryTwo = byValueKey("catTwo3");341 expect(await driver.getElementText(categoryTwo)).to.equal('เครื่องมือลม');342 scrollKey = byValueKey('horiLst3');343 var j;344 for (j = 0; j < 8; j++) {345 subCategoryTwo = byValueKey("subCatTwoTxt3" + "in" + j.toString());346 switch (j) {347 case 0:348 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องพ่นสี');349 break;350 case 1:351 driver.execute('flutter:scrollUntilVisible', scrollKey, {352 item: subCategoryTwo,353 dxScroll: -200,354 dyScroll: 10355 });356 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องยิงแม๊กลม');357 break;358 case 2:359 driver.execute('flutter:scrollUntilVisible', scrollKey, {360 item: subCategoryTwo,361 dxScroll: -200,362 dyScroll: 10363 });364 expect(await driver.getElementText(subCategoryTwo)).to.equal('ปั๊มลม');365 break;366 case 3:367 driver.execute('flutter:scrollUntilVisible', scrollKey, {368 item: subCategoryTwo,369 dxScroll: -200,370 dyScroll: 10371 });372 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องเจียรแม่พิมพ์ลม');373 break;374 case 4:375 driver.execute('flutter:scrollUntilVisible', scrollKey, {376 item: subCategoryTwo,377 dxScroll: -200,378 dyScroll: 10379 });380 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องขัดกระดาษทรายลม');381 break;382 case 5:383 driver.execute('flutter:scrollUntilVisible', scrollKey, {384 item: subCategoryTwo,385 dxScroll: -200,386 dyScroll: 10387 });388 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องบล็อกลม');389 break;390 case 6:391 driver.execute('flutter:scrollUntilVisible', scrollKey, {392 item: subCategoryTwo,393 dxScroll: -200,394 dyScroll: 10395 });396 expect(await driver.getElementText(subCategoryTwo)).to.equal('ชุดไขควงและบล็อกลม');397 break;398 case 7:399 driver.execute('flutter:scrollUntilVisible', scrollKey, {400 item: subCategoryTwo,401 dxScroll: -200,402 dyScroll: 10403 });404 expect(await driver.getElementText(subCategoryTwo)).to.equal('อุปกรณ์เสริมเครื่องมือลม');405 break;406 }407 }408 });409 it('เครื่องยนต์และเครื่องปั่นไฟ', async function () {410 this.timeout(300 * 1000);411 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {412 item: byValueKey("catTwo4"),413 dxScroll: 10,414 dyScroll: -400415 });416 categoryTwo = byValueKey("catTwo4");417 expect(await driver.getElementText(categoryTwo)).to.equal('เครื่องยนต์และเครื่องปั่นไฟ');418 scrollKey = byValueKey('horiLst4');419 var j;420 for (j = 0; j < 5; j++) {421 subCategoryTwo = byValueKey("subCatTwoTxt4" + "in" + j.toString());422 switch (j) {423 case 0:424 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องชาร์จแบต');425 break;426 case 1:427 driver.execute('flutter:scrollUntilVisible', scrollKey, {428 item: subCategoryTwo,429 dxScroll: -200,430 dyScroll: 10431 });432 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องปั่นไฟ');433 break;434 case 2:435 driver.execute('flutter:scrollUntilVisible', scrollKey, {436 item: subCategoryTwo,437 dxScroll: -200,438 dyScroll: 10439 });440 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องยนต์เบนซิน');441 break;442 case 3:443 driver.execute('flutter:scrollUntilVisible', scrollKey, {444 item: subCategoryTwo,445 dxScroll: -200,446 dyScroll: 10447 });448 expect(await driver.getElementText(subCategoryTwo)).to.equal('มอเตอร์');449 break;450 case 4:451 driver.execute('flutter:scrollUntilVisible', scrollKey, {452 item: subCategoryTwo,453 dxScroll: -200,454 dyScroll: 10455 });456 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องยนต์สูบน้ำ');457 break;458 }459 }460 });461 it('กล่องเครื่องมือ', async function () {462 this.timeout(300 * 1000);463 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {464 item: byValueKey("catTwo5"),465 dxScroll: 10,466 dyScroll: -400467 });468 categoryTwo = byValueKey("catTwo5");469 expect(await driver.getElementText(categoryTwo)).to.equal('กล่องเครื่องมือ');470 scrollKey = byValueKey('horiLst5');471 var j;472 for (j = 0; j < 4; j++) {473 subCategoryTwo = byValueKey("subCatTwoTxt5" + "in" + j.toString());474 switch (j) {475 case 0:476 expect(await driver.getElementText(subCategoryTwo)).to.equal('เอี๊ยมช่าง');477 break;478 case 1:479 driver.execute('flutter:scrollUntilVisible', scrollKey, {480 item: subCategoryTwo,481 dxScroll: -200,482 dyScroll: 10483 });484 expect(await driver.getElementText(subCategoryTwo)).to.equal('กระเป๋าเข็มขัดช่าง');485 break;486 case 2:487 driver.execute('flutter:scrollUntilVisible', scrollKey, {488 item: subCategoryTwo,489 dxScroll: -200,490 dyScroll: 10491 });492 expect(await driver.getElementText(subCategoryTwo)).to.equal('กระเป๋าช่าง');493 break;494 case 3:495 driver.execute('flutter:scrollUntilVisible', scrollKey, {496 item: subCategoryTwo,497 dxScroll: -200,498 dyScroll: 10499 });500 expect(await driver.getElementText(subCategoryTwo)).to.equal('กล่องเครื่องมือช่าง');501 break;502 }503 }504 });505 it('กาว', async function () {506 this.timeout(300 * 1000);507 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {508 item: byValueKey("catTwo6"),509 dxScroll: 10,510 dyScroll: -400511 });512 categoryTwo = byValueKey("catTwo6");513 expect(await driver.getElementText(categoryTwo)).to.equal('กาว');514 scrollKey = byValueKey('horiLst6');515 var j;516 for (j = 0; j < 14; j++) {517 subCategoryTwo = byValueKey("subCatTwoTxt6" + "in" + j.toString());518 switch (j) {519 case 0:520 expect(await driver.getElementText(subCategoryTwo)).to.equal('กาวเอนกประสงค์');521 break;522 case 1:523 driver.execute('flutter:scrollUntilVisible', scrollKey, {524 item: subCategoryTwo,525 dxScroll: -200,526 dyScroll: 10527 });528 expect(await driver.getElementText(subCategoryTwo)).to.equal('กาวแท่ง');529 break;530 case 2:531 driver.execute('flutter:scrollUntilVisible', scrollKey, {532 item: subCategoryTwo,533 dxScroll: -200,534 dyScroll: 10535 });536 expect(await driver.getElementText(subCategoryTwo)).to.equal('กาวซิลิโคน');537 break;538 case 3:539 driver.execute('flutter:scrollUntilVisible', scrollKey, {540 item: subCategoryTwo,541 dxScroll: -200,542 dyScroll: 10543 });544 expect(await driver.getElementText(subCategoryTwo)).to.equal('กาวดินน้ำมัน');545 break;546 case 4:547 driver.execute('flutter:scrollUntilVisible', scrollKey, {548 item: subCategoryTwo,549 dxScroll: -200,550 dyScroll: 10551 });552 expect(await driver.getElementText(subCategoryTwo)).to.equal('กาวตะปู');553 break;554 case 5:555 driver.execute('flutter:scrollUntilVisible', scrollKey, {556 item: subCategoryTwo,557 dxScroll: -200,558 dyScroll: 10559 });560 expect(await driver.getElementText(subCategoryTwo)).to.equal('กาวติดพลาสติก');561 break;562 case 6:563 driver.execute('flutter:scrollUntilVisible', scrollKey, {564 item: subCategoryTwo,565 dxScroll: -200,566 dyScroll: 10567 });568 expect(await driver.getElementText(subCategoryTwo)).to.equal('กาวปะเก็น');569 break;570 case 7:571 driver.execute('flutter:scrollUntilVisible', scrollKey, {572 item: subCategoryTwo,573 dxScroll: -200,574 dyScroll: 10575 });576 expect(await driver.getElementText(subCategoryTwo)).to.equal('กาวผง');577 break;578 case 8:579 driver.execute('flutter:scrollUntilVisible', scrollKey, {580 item: subCategoryTwo,581 dxScroll: -200,582 dyScroll: 10583 });584 expect(await driver.getElementText(subCategoryTwo)).to.equal('กาวยาง');585 break;586 case 9:587 driver.execute('flutter:scrollUntilVisible', scrollKey, {588 item: subCategoryTwo,589 dxScroll: -200,590 dyScroll: 10591 });592 expect(await driver.getElementText(subCategoryTwo)).to.equal('กาวร้อน');593 break;594 case 10:595 driver.execute('flutter:scrollUntilVisible', scrollKey, {596 item: subCategoryTwo,597 dxScroll: -200,598 dyScroll: 10599 });600 expect(await driver.getElementText(subCategoryTwo)).to.equal('กาวลาเท็กซ์');601 break;602 case 11:603 driver.execute('flutter:scrollUntilVisible', scrollKey, {604 item: subCategoryTwo,605 dxScroll: -200,606 dyScroll: 10607 });608 expect(await driver.getElementText(subCategoryTwo)).to.equal('กาวสเปรย์');609 break;610 case 12:611 driver.execute('flutter:scrollUntilVisible', scrollKey, {612 item: subCategoryTwo,613 dxScroll: -200,614 dyScroll: 10615 });616 expect(await driver.getElementText(subCategoryTwo)).to.equal('กาวอีพ๊อกซี่');617 break;618 case 13:619 driver.execute('flutter:scrollUntilVisible', scrollKey, {620 item: subCategoryTwo,621 dxScroll: -200,622 dyScroll: 10623 });624 expect(await driver.getElementText(subCategoryTwo)).to.equal('ปืนยิงกาว');625 break;626 }627 }628 });629 it('ชุดและอุปกรณ์เซฟตี้', async function () {630 this.timeout(300 * 1000);631 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {632 item: byValueKey("catTwo7"),633 dxScroll: 10,634 dyScroll: -400635 });636 categoryTwo = byValueKey("catTwo7");637 expect(await driver.getElementText(categoryTwo)).to.equal('ชุดและอุปกรณ์เซฟตี้');638 scrollKey = byValueKey('horiLst7');639 var j;640 for (j = 0; j < 2; j++) {641 subCategoryTwo = byValueKey("subCatTwoTxt7" + "in" + j.toString());642 switch (j) {643 case 0:644 expect(await driver.getElementText(subCategoryTwo)).to.equal('อุปกรณ์นิรภัยส่วนบุคคล');645 break;646 case 1:647 driver.execute('flutter:scrollUntilVisible', scrollKey, {648 item: subCategoryTwo,649 dxScroll: -200,650 dyScroll: 10651 });652 expect(await driver.getElementText(subCategoryTwo)).to.equal('อุปกรณ์นิรภัยสาธารณะ');653 break;654 }655 }656 });657 658 it('บันได', async function () {659 this.timeout(300 * 1000);660 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {661 item: byValueKey("catTwo8"),662 dxScroll: 10,663 dyScroll: -400664 });665 categoryTwo = byValueKey("catTwo8");666 expect(await driver.getElementText(categoryTwo)).to.equal('บันได');667 scrollKey = byValueKey('horiLst8');668 var j;669 for (j = 0; j < 4; j++) {670 subCategoryTwo = byValueKey("subCatTwoTxt8" + "in" + j.toString());671 switch (j) {672 case 0:673 expect(await driver.getElementText(subCategoryTwo)).to.equal('บันไดทรงA');674 break;675 case 1:676 driver.execute('flutter:scrollUntilVisible', scrollKey, {677 item: subCategoryTwo,678 dxScroll: -200,679 dyScroll: 10680 });681 expect(await driver.getElementText(subCategoryTwo)).to.equal('บันไดพาด');682 break;683 case 2:684 driver.execute('flutter:scrollUntilVisible', scrollKey, {685 item: subCategoryTwo,686 dxScroll: -200,687 dyScroll: 10688 });689 expect(await driver.getElementText(subCategoryTwo)).to.equal('บันไดสเต็ป');690 break;691 case 3:692 driver.execute('flutter:scrollUntilVisible', scrollKey, {693 item: subCategoryTwo,694 dxScroll: -200,695 dyScroll: 10696 });697 expect(await driver.getElementText(subCategoryTwo)).to.equal('บันไดอเนกประสงค์');698 break;699 }700 }701 });702 it('ประดับยนต์', async function () {703 this.timeout(300 * 1000);704 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {705 item: byValueKey("catTwo9"),706 dxScroll: 10,707 dyScroll: -400708 });709 categoryTwo = byValueKey("catTwo9");710 expect(await driver.getElementText(categoryTwo)).to.equal('ประดับยนต์');711 scrollKey = byValueKey('horiLst9');712 var j;713 for (j = 0; j < 5; j++) {714 subCategoryTwo = byValueKey("subCatTwoTxt9" + "in" + j.toString());715 switch (j) {716 case 0:717 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องขัดสีรถยนต์');718 break;719 case 1:720 driver.execute('flutter:scrollUntilVisible', scrollKey, {721 item: subCategoryTwo,722 dxScroll: -200,723 dyScroll: 10724 });725 expect(await driver.getElementText(subCategoryTwo)).to.equal('น้ำยาดูแลรถยนต์');726 break;727 case 2:728 driver.execute('flutter:scrollUntilVisible', scrollKey, {729 item: subCategoryTwo,730 dxScroll: -200,731 dyScroll: 10732 });733 expect(await driver.getElementText(subCategoryTwo)).to.equal('อุปกรณ์ตกแต่งรถยนต์');734 break;735 case 3:736 driver.execute('flutter:scrollUntilVisible', scrollKey, {737 item: subCategoryTwo,738 dxScroll: -200,739 dyScroll: 10740 });741 expect(await driver.getElementText(subCategoryTwo)).to.equal('อุปกรณ์ทำความสะอาดรถยนต์');742 break;743 case 4:744 driver.execute('flutter:scrollUntilVisible', scrollKey, {745 item: subCategoryTwo,746 dxScroll: -200,747 dyScroll: 10748 });749 expect(await driver.getElementText(subCategoryTwo)).to.equal('อุปกรณ์รักษาความปลอดภัยรถยนต์');750 break;751 }752 }753 });754 it('รถเข็น', async function () {755 this.timeout(300 * 1000);756 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {757 item: byValueKey("catTwo10"),758 dxScroll: 10,759 dyScroll: -300760 });761 categoryTwo = byValueKey("catTwo10");762 expect(await driver.getElementText(categoryTwo)).to.equal('รถเข็น');763 scrollKey = byValueKey('horiLst10');764 var j;765 for (j = 0; j < 2; j++) {766 subCategoryTwo = byValueKey("subCatTwoTxt10" + "in" + j.toString());767 switch (j) {768 case 0:769 expect(await driver.getElementText(subCategoryTwo)).to.equal('รถเข็น');770 break;771 case 1:772 driver.execute('flutter:scrollUntilVisible', scrollKey, {773 item: subCategoryTwo,774 dxScroll: -200,775 dyScroll: 10776 });777 expect(await driver.getElementText(subCategoryTwo)).to.equal('รถเข็นเครื่องมือช่าง');778 break;779 }780 }781 });782 it('อุปกรณ์เชื่อมและบัดกรี', async function () {783 this.timeout(300 * 1000);784 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {785 item: byValueKey("catTwo11"),786 dxScroll: 10,787 dyScroll: -300788 });789 categoryTwo = byValueKey("catTwo11");790 expect(await driver.getElementText(categoryTwo)).to.equal('อุปกรณ์เชื่อมและบัดกรี');791 scrollKey = byValueKey('horiLst11');792 var j;793 for (j = 0; j < 2; j++) {794 subCategoryTwo = byValueKey("subCatTwoTxt11" + "in" + j.toString());795 switch (j) {796 case 0:797 console.log(await driver.getElementText(subCategoryTwo));798 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องเชื่อมและอุปกรณ์');799 break;800 case 1:801 driver.execute('flutter:scrollUntilVisible', scrollKey, {802 item: subCategoryTwo,803 dxScroll: -200,804 dyScroll: 10805 });806 expect(await driver.getElementText(subCategoryTwo)).to.equal('อุปกรณ์บัดกรี');807 break;808 }809 }810 });811 it('อุปกรณ์ยึดติด', async function () {812 this.timeout(300 * 1000);813 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {814 item: byValueKey("catTwo12"),815 dxScroll: 10,816 dyScroll: -300817 });818 categoryTwo = byValueKey("catTwo12");819 expect(await driver.getElementText(categoryTwo)).to.equal('อุปกรณ์ยึดติด');820 scrollKey = byValueKey('horiLst12');821 var j;822 for (j = 0; j < 3; j++) {823 subCategoryTwo = byValueKey("subCatTwoTxt12" + "in" + j.toString());824 switch (j) {825 case 0:826 expect(await driver.getElementText(subCategoryTwo)).to.equal('สกรู, น๊อตและแหวน');827 break;828 case 1:829 driver.execute('flutter:scrollUntilVisible', scrollKey, {830 item: subCategoryTwo,831 dxScroll: -200,832 dyScroll: 10833 });834 expect(await driver.getElementText(subCategoryTwo)).to.equal('พุ๊ก');835 break;836 case 2:837 driver.execute('flutter:scrollUntilVisible', scrollKey, {838 item: subCategoryTwo,839 dxScroll: -200,840 dyScroll: 10841 });842 expect(await driver.getElementText(subCategoryTwo)).to.equal('อุปกรณ์ยึดอื่นๆ');843 break;844 }845 }846 });847 });848 describe('กลับไปหน้าหลัก', function(){849 before(function () {850 skip = false;851 });852 853 it('ไปหน้าหลัก', async function () {854 backBtn = byValueKey('backIcon');855 await driver.touchAction({856 action: 'tap',...

Full Screen

Full Screen

bathroom.js

Source:bathroom.js Github

copy

Full Screen

...19 });20 it('กระจกห้องน้ำ', async function () {21 this.timeout(300 * 1000);22 categoryTwo = byValueKey("catTwo0");23 expect(await driver.getElementText(categoryTwo)).to.equal('กระจกห้องน้ำ');24 scrollKey = byValueKey('horiLst0');25 for (j = 0; j < 7; j++) {26 subCategoryTwo = byValueKey("subCatTwoTxt0" + "in" + j.toString());27 switch (j) {28 case 0:29 expect(await driver.getElementText(subCategoryTwo)).to.equal('กระจกแต่งหน้า');30 break;31 case 1:32 driver.execute('flutter:scrollUntilVisible', scrollKey, {33 item: subCategoryTwo,34 dxScroll: -200,35 dyScroll: 1036 });37 expect(await driver.getElementText(subCategoryTwo)).to.equal('กระจกไร้ขอบ');38 break;39 case 2:40 driver.execute('flutter:scrollUntilVisible', scrollKey, {41 item: subCategoryTwo,42 dxScroll: -200,43 dyScroll: 1044 });45 expect(await driver.getElementText(subCategoryTwo)).to.equal('กระจกชั้นวางของ');46 break;47 case 3:48 driver.execute('flutter:scrollUntilVisible', scrollKey, {49 item: subCategoryTwo,50 dxScroll: -200,51 dyScroll: 1052 });53 expect(await driver.getElementText(subCategoryTwo)).to.equal('กระจกตกแต่ง');54 break;55 case 4:56 driver.execute('flutter:scrollUntilVisible', scrollKey, {57 item: subCategoryTwo,58 dxScroll: -200,59 dyScroll: 1060 });61 expect(await driver.getElementText(subCategoryTwo)).to.equal('กระจกพลาสติก');62 break;63 case 5:64 driver.execute('flutter:scrollUntilVisible', scrollKey, {65 item: subCategoryTwo,66 dxScroll: -200,67 dyScroll: 1068 });69 expect(await driver.getElementText(subCategoryTwo)).to.equal('กระจกมีขอบ');70 break;71 case 6:72 driver.execute('flutter:scrollUntilVisible', scrollKey, {73 item: subCategoryTwo,74 dxScroll: -200,75 dyScroll: 1076 });77 expect(await driver.getElementText(subCategoryTwo)).to.equal('กระจกยาว');78 }79 }80 });81 it('ก๊อกน้ำ', async function () {82 this.timeout(300*1000);83 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {84 item: byValueKey("catTwo1"),85 dxScroll: 10,86 dyScroll: -30087 });88 categoryTwo = byValueKey("catTwo1");89 expect(await driver.getElementText(categoryTwo)).to.equal('ก๊อกน้ำ');90 scrollKey = byValueKey('horiLst1');91 for (j = 0; j < 6; j++) {92 subCategoryTwo = byValueKey("subCatTwoTxt1" + "in" + j.toString());93 switch (j) {94 case 0:95 expect(await driver.getElementText(subCategoryTwo)).to.equal('ก๊อกซิงค์');96 break;97 case 1:98 driver.execute('flutter:scrollUntilVisible', scrollKey, {99 item: subCategoryTwo,100 dxScroll: -200,101 dyScroll: 10102 });103 expect(await driver.getElementText(subCategoryTwo)).to.equal('ก๊อกบิเด้');104 break;105 case 2:106 driver.execute('flutter:scrollUntilVisible', scrollKey, {107 item: subCategoryTwo,108 dxScroll: -200,109 dyScroll: 10110 });111 expect(await driver.getElementText(subCategoryTwo)).to.equal('ก๊อกผสมยืนอาบ');112 break;113 case 3:114 driver.execute('flutter:scrollUntilVisible', scrollKey, {115 item: subCategoryTwo,116 dxScroll: -200,117 dyScroll: 10118 });119 expect(await driver.getElementText(subCategoryTwo)).to.equal('ก๊อกล้างพื้น');120 break;121 case 4:122 driver.execute('flutter:scrollUntilVisible', scrollKey, {123 item: subCategoryTwo,124 dxScroll: -200,125 dyScroll: 10126 });127 expect(await driver.getElementText(subCategoryTwo)).to.equal('ก๊อกอ่างล้างหน้า');128 break;129 case 5:130 driver.execute('flutter:scrollUntilVisible', scrollKey, {131 item: subCategoryTwo,132 dxScroll: -200,133 dyScroll: 10134 });135 expect(await driver.getElementText(subCategoryTwo)).to.equal('ก๊อกอ่างอาบน้ำ');136 break;137 case 6:138 driver.execute('flutter:scrollUntilVisible', scrollKey, {139 item: subCategoryTwo,140 dxScroll: -200,141 dyScroll: 10142 });143 expect(await driver.getElementText(subCategoryTwo)).to.equal('วาล์วและสต๊อปวาล์ว');144 }145 }146 });147 it('ฉากกั้นอาบน้ำ', async function () {148 this.timeout(300 * 1000);149 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {150 item: byValueKey("catTwo2"),151 dxScroll: 10,152 dyScroll: -300153 });154 categoryTwo = byValueKey("catTwo2");155 expect(await driver.getElementText(categoryTwo)).to.equal('ฉากกั้นอาบน้ำ');156 scrollKey = byValueKey('horiLst2');157 var j;158 for (j = 0; j < 4; j++) {159 subCategoryTwo = byValueKey("subCatTwoTxt2" + "in" + j.toString());160 switch (j) {161 case 0:162 expect(await driver.getElementText(subCategoryTwo)).to.equal('ฉากกั้นอาบน้ำ');163 break;164 case 1:165 driver.execute('flutter:scrollUntilVisible', scrollKey, {166 item: subCategoryTwo,167 dxScroll: -200,168 dyScroll: 10169 });170 expect(await driver.getElementText(subCategoryTwo)).to.equal('ตู้อาบน้ำ');171 break;172 case 2:173 driver.execute('flutter:scrollUntilVisible', scrollKey, {174 item: subCategoryTwo,175 dxScroll: -200,176 dyScroll: 10177 });178 expect(await driver.getElementText(subCategoryTwo)).to.equal('ถาดรองอาบน้ำ');179 break;180 case 3:181 driver.execute('flutter:scrollUntilVisible', scrollKey, {182 item: subCategoryTwo,183 dxScroll: -200,184 dyScroll: 10185 });186 expect(await driver.getElementText(subCategoryTwo)).to.equal('ธรณีเทียม');187 }188 }189 });190 it('ผ้าเช็ดตัวและชุดคลุม', async function () {191 this.timeout(300 * 1000);192 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {193 item: byValueKey("catTwo3"),194 dxScroll: 10,195 dyScroll: -300196 });197 categoryTwo = byValueKey("catTwo3");198 expect(await driver.getElementText(categoryTwo)).to.equal('ผ้าเช็ดตัวและชุดคลุม');199 scrollKey = byValueKey('horiLst3');200 var j;201 for (j = 0; j < 4; j++) {202 subCategoryTwo = byValueKey("subCatTwoTxt3" + "in" + j.toString());203 switch (j) {204 case 0:205 expect(await driver.getElementText(subCategoryTwo)).to.equal('ชุดคลุมอาบน้ำ');206 break;207 case 1:208 driver.execute('flutter:scrollUntilVisible', scrollKey, {209 item: subCategoryTwo,210 dxScroll: -200,211 dyScroll: 10212 });213 expect(await driver.getElementText(subCategoryTwo)).to.equal('ผ้าเช็ดตัว');214 break;215 case 2:216 driver.execute('flutter:scrollUntilVisible', scrollKey, {217 item: subCategoryTwo,218 dxScroll: -200,219 dyScroll: 10220 });221 expect(await driver.getElementText(subCategoryTwo)).to.equal('ผ้าเช็ดผม');222 break;223 case 3:224 driver.execute('flutter:scrollUntilVisible', scrollKey, {225 item: subCategoryTwo,226 dxScroll: -200,227 dyScroll: 10228 });229 expect(await driver.getElementText(subCategoryTwo)).to.equal('ผ้าเช็ดหน้า');230 }231 }232 });233 it('ฝักบัว', async function () {234 this.timeout(300 * 1000);235 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {236 item: byValueKey("catTwo4"),237 dxScroll: 10,238 dyScroll: -300239 });240 categoryTwo = byValueKey("catTwo4");241 expect(await driver.getElementText(categoryTwo)).to.equal('ฝักบัว');242 scrollKey = byValueKey('horiLst4');243 var j;244 for (j = 0; j < 5; j++) {245 subCategoryTwo = byValueKey("subCatTwoTxt4" + "in" + j.toString());246 switch (j) {247 case 0:248 expect(await driver.getElementText(subCategoryTwo)).to.equal('แผงฝักบัว');249 break;250 case 1:251 driver.execute('flutter:scrollUntilVisible', scrollKey, {252 item: subCategoryTwo,253 dxScroll: -200,254 dyScroll: 10255 });256 expect(await driver.getElementText(subCategoryTwo)).to.equal('ฝักบัวเรนชาวเวอร์');257 break;258 case 2:259 driver.execute('flutter:scrollUntilVisible', scrollKey, {260 item: subCategoryTwo,261 dxScroll: -200,262 dyScroll: 10263 });264 expect(await driver.getElementText(subCategoryTwo)).to.equal('ฝักบัวก้านแข็ง');265 break;266 case 3:267 driver.execute('flutter:scrollUntilVisible', scrollKey, {268 item: subCategoryTwo,269 dxScroll: -200,270 dyScroll: 10271 });272 expect(await driver.getElementText(subCategoryTwo)).to.equal('ฝักบัวราวเลื่อน');273 break;274 case 4:275 driver.execute('flutter:scrollUntilVisible', scrollKey, {276 item: subCategoryTwo,277 dxScroll: -200,278 dyScroll: 10279 });280 expect(await driver.getElementText(subCategoryTwo)).to.equal('ฝักบัวสายอ่อน');281 }282 }283 });284 it('ม่านห้องน้ำ', async function () {285 this.timeout(300 * 1000);286 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {287 item: byValueKey("catTwo5"),288 dxScroll: 10,289 dyScroll: -300290 });291 categoryTwo = byValueKey("catTwo5");292 expect(await driver.getElementText(categoryTwo)).to.equal('ม่านห้องน้ำ');293 scrollKey = byValueKey('horiLst5');294 var j;295 for (j = 0; j < 2; j++) {296 subCategoryTwo = byValueKey("subCatTwoTxt5" + "in" + j.toString());297 switch (j) {298 case 0:299 expect(await driver.getElementText(subCategoryTwo)).to.equal('ผ้าม่านห้องน้ำ');300 break;301 case 1:302 driver.execute('flutter:scrollUntilVisible', scrollKey, {303 item: subCategoryTwo,304 dxScroll: -200,305 dyScroll: 10306 });307 expect(await driver.getElementText(subCategoryTwo)).to.equal('ราวม่านและอุปกรณ์');308 break;309 }310 }311 });312 it('สายฉีดชำระ', async function () {313 this.timeout(300 * 1000);314 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {315 item: byValueKey("catTwo6"),316 dxScroll: 10,317 dyScroll: -300318 });319 categoryTwo = byValueKey("catTwo6");320 expect(await driver.getElementText(categoryTwo)).to.equal('สายฉีดชำระ');321 scrollKey = byValueKey('horiLst6');322 var j;323 for (j = 0; j < 2; j++) {324 subCategoryTwo = byValueKey("subCatTwoTxt6" + "in" + j.toString());325 switch (j) {326 case 0:327 expect(await driver.getElementText(subCategoryTwo)).to.equal('ชุดสายฉีดชำระ');328 break;329 case 1:330 driver.execute('flutter:scrollUntilVisible', scrollKey, {331 item: subCategoryTwo,332 dxScroll: -200,333 dyScroll: 10334 });335 expect(await driver.getElementText(subCategoryTwo)).to.equal('หัวฉีดชำระ');336 }337 }338 });339 it('สุขภัณฑ์', async function () {340 this.timeout(300 * 1000);341 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {342 item: byValueKey("catTwo7"),343 dxScroll: 10,344 dyScroll: -300345 });346 categoryTwo = byValueKey("catTwo7");347 expect(await driver.getElementText(categoryTwo)).to.equal('สุขภัณฑ์');348 scrollKey = byValueKey('horiLst7');349 var j;350 for (j = 0; j < 7; j++) {351 subCategoryTwo = byValueKey("subCatTwoTxt7" + "in" + j.toString());352 switch (j) {353 case 0:354 expect(await driver.getElementText(subCategoryTwo)).to.equal('อะไหล่โถปัสสาวะ');355 break;356 case 1:357 driver.execute('flutter:scrollUntilVisible', scrollKey, {358 item: subCategoryTwo,359 dxScroll: -200,360 dyScroll: 10361 });362 expect(await driver.getElementText(subCategoryTwo)).to.equal('สุขภัณฑ์นั่งราบ');363 break;364 case 2:365 driver.execute('flutter:scrollUntilVisible', scrollKey, {366 item: subCategoryTwo,367 dxScroll: -200,368 dyScroll: 10369 });370 expect(await driver.getElementText(subCategoryTwo)).to.equal('เก้าอี้นั่งขับถ่าย');371 break;372 case 3:373 driver.execute('flutter:scrollUntilVisible', scrollKey, {374 item: subCategoryTwo,375 dxScroll: -200,376 dyScroll: 10377 });378 expect(await driver.getElementText(subCategoryTwo)).to.equal('โถปัสสาวะและแผงกั้น');379 break;380 case 4:381 driver.execute('flutter:scrollUntilVisible', scrollKey, {382 item: subCategoryTwo,383 dxScroll: -200,384 dyScroll: 10385 });386 expect(await driver.getElementText(subCategoryTwo)).to.equal('โถปัสสาวะหญิง');387 break;388 case 5:389 driver.execute('flutter:scrollUntilVisible', scrollKey, {390 item: subCategoryTwo,391 dxScroll: -200,392 dyScroll: 10393 });394 expect(await driver.getElementText(subCategoryTwo)).to.equal('สุขภัณฑ์เคลื่อนที่');395 break;396 case 6:397 driver.execute('flutter:scrollUntilVisible', scrollKey, {398 item: subCategoryTwo,399 dxScroll: -200,400 dyScroll: 10401 });402 expect(await driver.getElementText(subCategoryTwo)).to.equal('สุขภัณฑ์นั่งยอง');403 }404 }405 });406 407 it('อะไหล่ห้องน้ำ', async function () {408 this.timeout(300 * 1000);409 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {410 item: byValueKey("catTwo8"),411 dxScroll: 10,412 dyScroll: -300413 });414 categoryTwo = byValueKey("catTwo8");415 expect(await driver.getElementText(categoryTwo)).to.equal('อะไหล่ห้องน้ำ');416 scrollKey = byValueKey('horiLst8');417 var j;418 for (j = 0; j < 7; j++) {419 subCategoryTwo = byValueKey("subCatTwoTxt8" + "in" + j.toString());420 switch (j) {421 case 0:422 expect(await driver.getElementText(subCategoryTwo)).to.equal('อะไหล่ฝักบัว');423 break;424 case 1:425 driver.execute('flutter:scrollUntilVisible', scrollKey, {426 item: subCategoryTwo,427 dxScroll: -200,428 dyScroll: 10429 });430 expect(await driver.getElementText(subCategoryTwo)).to.equal('อะไหล่อ่างล้างหน้าและอ่างอาบน้ำ');431 break;432 case 2:433 driver.execute('flutter:scrollUntilVisible', scrollKey, {434 item: subCategoryTwo,435 dxScroll: -200,436 dyScroll: 10437 });438 expect(await driver.getElementText(subCategoryTwo)).to.equal('อะไหล่ก๊อกน้ำ');439 break;440 case 3:441 driver.execute('flutter:scrollUntilVisible', scrollKey, {442 item: subCategoryTwo,443 dxScroll: -200,444 dyScroll: 10445 });446 expect(await driver.getElementText(subCategoryTwo)).to.equal('ฝารองนั่ง');447 break;448 case 4:449 driver.execute('flutter:scrollUntilVisible', scrollKey, {450 item: subCategoryTwo,451 dxScroll: -200,452 dyScroll: 10453 });454 expect(await driver.getElementText(subCategoryTwo)).to.equal('อะไหล่สุขภัณฑ์');455 break;456 case 5:457 driver.execute('flutter:scrollUntilVisible', scrollKey, {458 item: subCategoryTwo,459 dxScroll: -200,460 dyScroll: 10461 });462 expect(await driver.getElementText(subCategoryTwo)).to.equal('สายน้ำดี');463 break;464 case 6:465 driver.execute('flutter:scrollUntilVisible', scrollKey, {466 item: subCategoryTwo,467 dxScroll: -200,468 dyScroll: 10469 });470 expect(await driver.getElementText(subCategoryTwo)).to.equal('อุปกรณ์ข้อต่อน้ำทิ้ง');471 }472 }473 });474 it('อ่างล้างหน้า', async function () {475 this.timeout(300 * 1000);476 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {477 item: byValueKey("catTwo9"),478 dxScroll: 10,479 dyScroll: -300480 });481 categoryTwo = byValueKey("catTwo9");482 expect(await driver.getElementText(categoryTwo)).to.equal('อ่างล้างหน้า');483 scrollKey = byValueKey('horiLst9');484 var j;485 for (j = 0; j < 6; j++) {486 subCategoryTwo = byValueKey("subCatTwoTxt9" + "in" + j.toString());487 switch (j) {488 case 0:489 expect(await driver.getElementText(subCategoryTwo)).to.equal('เคาน์เตอร์อ่างล้างหน้า');490 break;491 case 1:492 driver.execute('flutter:scrollUntilVisible', scrollKey, {493 item: subCategoryTwo,494 dxScroll: -200,495 dyScroll: 10496 });497 expect(await driver.getElementText(subCategoryTwo)).to.equal('อ่างล้างหน้าแขวน');498 break;499 case 2:500 driver.execute('flutter:scrollUntilVisible', scrollKey, {501 item: subCategoryTwo,502 dxScroll: -200,503 dyScroll: 10504 });505 expect(await driver.getElementText(subCategoryTwo)).to.equal('อ่างล้างหน้าบนเคาน์เตอร์');506 break;507 case 3:508 driver.execute('flutter:scrollUntilVisible', scrollKey, {509 item: subCategoryTwo,510 dxScroll: -200,511 dyScroll: 10512 });513 expect(await driver.getElementText(subCategoryTwo)).to.equal('อ่างล้างหน้าฝัง');514 break;515 case 4:516 driver.execute('flutter:scrollUntilVisible', scrollKey, {517 item: subCategoryTwo,518 dxScroll: -200,519 dyScroll: 10520 });521 expect(await driver.getElementText(subCategoryTwo)).to.equal('อ่างล้างหน้าพร้อมเคาน์เตอร์');522 break;523 case 5:524 driver.execute('flutter:scrollUntilVisible', scrollKey, {525 item: subCategoryTwo,526 dxScroll: -200,527 dyScroll: 10528 });529 expect(await driver.getElementText(subCategoryTwo)).to.equal('อ่างล้างหน้าพร้อมขาตั้ง');530 break;531 }532 }533 });534 it('อ่างอาบน้ำ', async function () {535 this.timeout(300 * 1000);536 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {537 item: byValueKey("catTwo10"),538 dxScroll: 10,539 dyScroll: -300540 });541 categoryTwo = byValueKey("catTwo10");542 expect(await driver.getElementText(categoryTwo)).to.equal('อ่างอาบน้ำ');543 scrollKey = byValueKey('horiLst10');544 var j;545 for (j = 0; j < 2; j++) {546 subCategoryTwo = byValueKey("subCatTwoTxt10" + "in" + j.toString());547 switch (j) {548 case 0:549 expect(await driver.getElementText(subCategoryTwo)).to.equal('อ่างอาบน้ำ');550 break;551 case 1:552 driver.execute('flutter:scrollUntilVisible', scrollKey, {553 item: subCategoryTwo,554 dxScroll: -200,555 dyScroll: 10556 });557 expect(await driver.getElementText(subCategoryTwo)).to.equal('อ่างอาบน้ำวน');558 break;559 }560 }561 });562 it('อุปกรณ์ห้องน้ำ', async function () {563 this.timeout(300 * 1000);564 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {565 item: byValueKey("catTwo11"),566 dxScroll: 10,567 dyScroll: -300568 });569 categoryTwo = byValueKey("catTwo11");570 expect(await driver.getElementText(categoryTwo)).to.equal('อุปกรณ์ห้องน้ำ');571 scrollKey = byValueKey('horiLst11');572 var j;573 for (j = 0; j < 3; j++) {574 subCategoryTwo = byValueKey("subCatTwoTxt11" + "in" + j.toString());575 switch (j) {576 case 0:577 console.log(await driver.getElementText(subCategoryTwo));578 expect(await driver.getElementText(subCategoryTwo)).to.equal('อุปกรณ์ความปลอดภัยและผู้สูงอายุ');579 break;580 case 1:581 driver.execute('flutter:scrollUntilVisible', scrollKey, {582 item: subCategoryTwo,583 dxScroll: -200,584 dyScroll: 10585 });586 expect(await driver.getElementText(subCategoryTwo)).to.equal('อุปกรณ์ในห้องน้ำ');587 break;588 case 2:589 driver.execute('flutter:scrollUntilVisible', scrollKey, {590 item: subCategoryTwo,591 dxScroll: -200,592 dyScroll: 10593 });594 expect(await driver.getElementText(subCategoryTwo)).to.equal('อุปกรณ์จัดเก็บในห้องน้ำ');595 break;596 case 3:597 driver.execute('flutter:scrollUntilVisible', scrollKey, {598 item: subCategoryTwo,599 dxScroll: -200,600 dyScroll: 10601 });602 expect(await driver.getElementText(subCategoryTwo)).to.equal('ชุดอุปกรณ์ในห้องน้ำ');603 break;604 case 4:605 driver.execute('flutter:scrollUntilVisible', scrollKey, {606 item: subCategoryTwo,607 dxScroll: -200,608 dyScroll: 10609 });610 expect(await driver.getElementText(subCategoryTwo)).to.equal('อุปกรณ์แขวนในห้องน้ำ');611 break;612 case 5:613 driver.execute('flutter:scrollUntilVisible', scrollKey, {614 item: subCategoryTwo,615 dxScroll: -200,616 dyScroll: 10617 });618 expect(await driver.getElementText(subCategoryTwo)).to.equal('ห้องน้ำเด็กเล็ก');619 break;620 }621 }622 });623 });624 describe('กลับไปหน้าหลัก', function(){625 before(function () {626 skip = false;627 });628 629 it('ไปหน้าหลัก', async function () {630 backBtn = byValueKey('backIcon');631 await driver.touchAction({632 action: 'tap',...

Full Screen

Full Screen

kitchen.js

Source:kitchen.js Github

copy

Full Screen

...23 });24 it('เครื่องใช้ไฟฟ้าในครัว', async function () {25 this.timeout(300 * 1000);26 categoryTwo = byValueKey("catTwo0");27 expect(await driver.getElementText(categoryTwo)).to.equal('เครื่องใช้ไฟฟ้าในครัว');28 scrollKey = byValueKey('horiLst0');29 for (j = 0; j < 10; j++) {30 subCategoryTwo = byValueKey("subCatTwoTxt0" + "in" + j.toString());31 switch (j) {32 case 0:33 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องดูดควัน');34 break;35 case 1:36 driver.execute('flutter:scrollUntilVisible', scrollKey, {37 item: subCategoryTwo,38 dxScroll: -200,39 dyScroll: 1040 });41 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องล้างจานและอบจาน');42 break;43 case 2:44 driver.execute('flutter:scrollUntilVisible', scrollKey, {45 item: subCategoryTwo,46 dxScroll: -200,47 dyScroll: 1048 });49 expect(await driver.getElementText(subCategoryTwo)).to.equal('เตาฝัง');50 break;51 case 3:52 driver.execute('flutter:scrollUntilVisible', scrollKey, {53 item: subCategoryTwo,54 dxScroll: -200,55 dyScroll: 1056 });57 expect(await driver.getElementText(subCategoryTwo)).to.equal('เตาอบและอุปกรณ์');58 break;59 case 4:60 driver.execute('flutter:scrollUntilVisible', scrollKey, {61 item: subCategoryTwo,62 dxScroll: -200,63 dyScroll: 1064 });65 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องทำกาแฟบิวท์อิน');66 break;67 case 5:68 driver.execute('flutter:scrollUntilVisible', scrollKey, {69 item: subCategoryTwo,70 dxScroll: -200,71 dyScroll: 1072 });73 expect(await driver.getElementText(subCategoryTwo)).to.equal('เตาแก๊ส');74 break;75 case 6:76 driver.execute('flutter:scrollUntilVisible', scrollKey, {77 item: subCategoryTwo,78 dxScroll: -200,79 dyScroll: 1080 });81 expect(await driver.getElementText(subCategoryTwo)).to.equal('เตาปรุงอาหาร');82 break;83 case 7:84 driver.execute('flutter:scrollUntilVisible', scrollKey, {85 item: subCategoryTwo,86 dxScroll: -200,87 dyScroll: 1088 });89 expect(await driver.getElementText(subCategoryTwo)).to.equal('ไมโครเวฟบิวท์อิน');90 break;91 case 8:92 driver.execute('flutter:scrollUntilVisible', scrollKey, {93 item: subCategoryTwo,94 dxScroll: -200,95 dyScroll: 1096 });97 expect(await driver.getElementText(subCategoryTwo)).to.equal('ชุดเครื่องใช้ไฟฟ้าในครัว');98 break;99 case 9:100 driver.execute('flutter:scrollUntilVisible', scrollKey, {101 item: subCategoryTwo,102 dxScroll: -200,103 dyScroll: 10104 });105 expect(await driver.getElementText(subCategoryTwo)).to.equal('อะไหล่เครื่องใช้ไฟฟ้าในครัว');106 break;107 }108 }109 });110 it('เครื่องกรองน้ำและไส้กรอง', async function () {111 this.timeout(300*1000);112 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {113 item: byValueKey("catTwo1"),114 dxScroll: 10,115 dyScroll: -300116 });117 categoryTwo = byValueKey("catTwo1");118 expect(await driver.getElementText(categoryTwo)).to.equal('เครื่องกรองน้ำและไส้กรอง');119 scrollKey = byValueKey('horiLst1');120 for (j = 0; j < 3; j++) {121 subCategoryTwo = byValueKey("subCatTwoTxt1" + "in" + j.toString());122 switch (j) {123 case 0:124 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องกรองน้ำใช้');125 break;126 case 1:127 driver.execute('flutter:scrollUntilVisible', scrollKey, {128 item: subCategoryTwo,129 dxScroll: -200,130 dyScroll: 10131 });132 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องกรองน้ำดื่ม');133 break;134 case 2:135 driver.execute('flutter:scrollUntilVisible', scrollKey, {136 item: subCategoryTwo,137 dxScroll: -200,138 dyScroll: 10139 });140 expect(await driver.getElementText(subCategoryTwo)).to.equal('ไส้กรองเครื่องกรองน้ำ');141 break;142 }143 }144 });145 it('เครื่องครัวและอุปกรณ์', async function () {146 this.timeout(300 * 1000);147 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {148 item: byValueKey("catTwo2"),149 dxScroll: 10,150 dyScroll: -300151 });152 categoryTwo = byValueKey("catTwo2");153 expect(await driver.getElementText(categoryTwo)).to.equal('เครื่องครัวและอุปกรณ์');154 scrollKey = byValueKey('horiLst2');155 var j;156 for (j = 0; j < 7; j++) {157 subCategoryTwo = byValueKey("subCatTwoTxt2" + "in" + j.toString());158 switch (j) {159 case 0:160 expect(await driver.getElementText(subCategoryTwo)).to.equal('อุปกรณ์เตรียมอาหาร');161 break;162 case 1:163 driver.execute('flutter:scrollUntilVisible', scrollKey, {164 item: subCategoryTwo,165 dxScroll: -200,166 dyScroll: 10167 });168 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องครัวและอุปกรณ์อื่นๆ');169 break;170 case 2:171 driver.execute('flutter:scrollUntilVisible', scrollKey, {172 item: subCategoryTwo,173 dxScroll: -200,174 dyScroll: 10175 });176 expect(await driver.getElementText(subCategoryTwo)).to.equal('อุปกรณ์ตักอาหาร');177 break;178 case 3:179 driver.execute('flutter:scrollUntilVisible', scrollKey, {180 item: subCategoryTwo,181 dxScroll: -200,182 dyScroll: 10183 });184 expect(await driver.getElementText(subCategoryTwo)).to.equal('เครื่องครัว');185 break;186 case 4:187 driver.execute('flutter:scrollUntilVisible', scrollKey, {188 item: subCategoryTwo,189 dxScroll: -200,190 dyScroll: 10191 });192 expect(await driver.getElementText(subCategoryTwo)).to.equal('ชุดกันเปื้อนและถุงมือ');193 break;194 case 5:195 driver.execute('flutter:scrollUntilVisible', scrollKey, {196 item: subCategoryTwo,197 dxScroll: -200,198 dyScroll: 10199 });200 expect(await driver.getElementText(subCategoryTwo)).to.equal('กาต้มน้ำ');201 break;202 case 6:203 driver.execute('flutter:scrollUntilVisible', scrollKey, {204 item: subCategoryTwo,205 dxScroll: -200,206 dyScroll: 10207 });208 expect(await driver.getElementText(subCategoryTwo)).to.equal('ภาชนะไมโครเวฟ');209 break;210 }211 }212 });213 it('เฟอร์นิเจอร์ครัว', async function () {214 this.timeout(300 * 1000);215 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {216 item: byValueKey("catTwo3"),217 dxScroll: 10,218 dyScroll: -300219 });220 categoryTwo = byValueKey("catTwo3");221 expect(await driver.getElementText(categoryTwo)).to.equal('เฟอร์นิเจอร์ครัว');222 scrollKey = byValueKey('horiLst3');223 var j;224 for (j = 0; j < 8; j++) {225 subCategoryTwo = byValueKey("subCatTwoTxt3" + "in" + j.toString());226 switch (j) {227 case 0:228 expect(await driver.getElementText(subCategoryTwo)).to.equal('อุปกรณ์จัดเก็บในตู้');229 break;230 case 1:231 driver.execute('flutter:scrollUntilVisible', scrollKey, {232 item: subCategoryTwo,233 dxScroll: -200,234 dyScroll: 10235 });236 expect(await driver.getElementText(subCategoryTwo)).to.equal('หน้าบาน');237 break;238 case 2:239 driver.execute('flutter:scrollUntilVisible', scrollKey, {240 item: subCategoryTwo,241 dxScroll: -200,242 dyScroll: 10243 });244 expect(await driver.getElementText(subCategoryTwo)).to.equal('ตู้เก็บอาหาร');245 break;246 case 3:247 driver.execute('flutter:scrollUntilVisible', scrollKey, {248 item: subCategoryTwo,249 dxScroll: -200,250 dyScroll: 10251 });252 expect(await driver.getElementText(subCategoryTwo)).to.equal('ตู้เรียบอลูมิเนียม');253 break;254 case 4:255 driver.execute('flutter:scrollUntilVisible', scrollKey, {256 item: subCategoryTwo,257 dxScroll: -200,258 dyScroll: 10259 });260 expect(await driver.getElementText(subCategoryTwo)).to.equal('ตู้แขวน');261 break;262 case 5:263 driver.execute('flutter:scrollUntilVisible', scrollKey, {264 item: subCategoryTwo,265 dxScroll: -200,266 dyScroll: 10267 });268 expect(await driver.getElementText(subCategoryTwo)).to.equal('ตู้ครัวตั้งพื้น');269 break;270 case 6:271 driver.execute('flutter:scrollUntilVisible', scrollKey, {272 item: subCategoryTwo,273 dxScroll: -200,274 dyScroll: 10275 });276 expect(await driver.getElementText(subCategoryTwo)).to.equal('ตู้ซิงค์อลูมิเนียม');277 break;278 case 7:279 driver.execute('flutter:scrollUntilVisible', scrollKey, {280 item: subCategoryTwo,281 dxScroll: -200,282 dyScroll: 10283 });284 expect(await driver.getElementText(subCategoryTwo)).to.equal('อุปกรณ์เสริมตู้จัดเก็บ');285 break;286 }287 }288 });289 it('ชุดครัวสำเร็จรูป', async function () {290 this.timeout(300 * 1000);291 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {292 item: byValueKey("catTwo4"),293 dxScroll: 10,294 dyScroll: -300295 });296 categoryTwo = byValueKey("catTwo4");297 expect(await driver.getElementText(categoryTwo)).to.equal('ชุดครัวสำเร็จรูป');298 scrollKey = byValueKey('horiLst4');299 var j;300 for (j = 0; j < 4; j++) {301 subCategoryTwo = byValueKey("subCatTwoTxt4" + "in" + j.toString());302 switch (j) {303 case 0:304 expect(await driver.getElementText(subCategoryTwo)).to.equal('ครัว WPC สำเร็จรูป');305 break;306 case 1:307 driver.execute('flutter:scrollUntilVisible', scrollKey, {308 item: subCategoryTwo,309 dxScroll: -200,310 dyScroll: 10311 });312 expect(await driver.getElementText(subCategoryTwo)).to.equal('ครัวไม้สำเร็จรูป');313 break;314 case 2:315 driver.execute('flutter:scrollUntilVisible', scrollKey, {316 item: subCategoryTwo,317 dxScroll: -200,318 dyScroll: 10319 });320 expect(await driver.getElementText(subCategoryTwo)).to.equal('ครัวสำเร็จรูปวัสดุสังเคราะห์');321 break;322 case 3:323 driver.execute('flutter:scrollUntilVisible', scrollKey, {324 item: subCategoryTwo,325 dxScroll: -200,326 dyScroll: 10327 });328 expect(await driver.getElementText(subCategoryTwo)).to.equal('ครัวอลูมิเนียมสำเร็จรูป');329 break;330 }331 }332 });333 it('ภาชนะบรรจุอาหาร', async function () {334 this.timeout(300 * 1000);335 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {336 item: byValueKey("catTwo5"),337 dxScroll: 10,338 dyScroll: -300339 });340 categoryTwo = byValueKey("catTwo5");341 expect(await driver.getElementText(categoryTwo)).to.equal('ภาชนะบรรจุอาหาร');342 scrollKey = byValueKey('horiLst5');343 var j;344 for (j = 0; j < 5; j++) {345 subCategoryTwo = byValueKey("subCatTwoTxt5" + "in" + j.toString());346 switch (j) {347 case 0:348 expect(await driver.getElementText(subCategoryTwo)).to.equal('ภาชนะใส่น้ำและน้ำแข็ง');349 break;350 case 1:351 driver.execute('flutter:scrollUntilVisible', scrollKey, {352 item: subCategoryTwo,353 dxScroll: -200,354 dyScroll: 10355 });356 expect(await driver.getElementText(subCategoryTwo)).to.equal('ภาชนะใส่อาหาร');357 break;358 case 2:359 driver.execute('flutter:scrollUntilVisible', scrollKey, {360 item: subCategoryTwo,361 dxScroll: -200,362 dyScroll: 10363 });364 expect(await driver.getElementText(subCategoryTwo)).to.equal('ขวดโหล');365 break;366 case 3:367 driver.execute('flutter:scrollUntilVisible', scrollKey, {368 item: subCategoryTwo,369 dxScroll: -200,370 dyScroll: 10371 });372 expect(await driver.getElementText(subCategoryTwo)).to.equal('พลาสติกห่ออาหาร');373 break;374 case 4:375 driver.execute('flutter:scrollUntilVisible', scrollKey, {376 item: subCategoryTwo,377 dxScroll: -200,378 dyScroll: 10379 });380 expect(await driver.getElementText(subCategoryTwo)).to.equal('ฟอยล์ห่ออาหาร');381 break;382 }383 }384 });385 it('อ่างล้างจานและอุปกรณ์', async function () {386 this.timeout(300 * 1000);387 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {388 item: byValueKey("catTwo6"),389 dxScroll: 10,390 dyScroll: -300391 });392 categoryTwo = byValueKey("catTwo6");393 expect(await driver.getElementText(categoryTwo)).to.equal('อ่างล้างจานและอุปกรณ์');394 scrollKey = byValueKey('horiLst6');395 var j;396 for (j = 0; j < 3; j++) {397 subCategoryTwo = byValueKey("subCatTwoTxt6" + "in" + j.toString());398 switch (j) {399 case 0:400 expect(await driver.getElementText(subCategoryTwo)).to.equal('อ่างล้างจานขาตั้ง');401 break;402 case 1:403 driver.execute('flutter:scrollUntilVisible', scrollKey, {404 item: subCategoryTwo,405 dxScroll: -200,406 dyScroll: 10407 });408 expect(await driver.getElementText(subCategoryTwo)).to.equal('อ่างล้างจานฝัง');409 break;410 case 2:411 driver.execute('flutter:scrollUntilVisible', scrollKey, {412 item: subCategoryTwo,413 dxScroll: -200,414 dyScroll: 10415 });416 expect(await driver.getElementText(subCategoryTwo)).to.equal('อุปกรณ์อ่างล้างจาน');417 break;418 }419 }420 });421 it('อุปกรณ์จัดเก็บในครัว', async function () {422 this.timeout(300 * 1000);423 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {424 item: byValueKey("catTwo7"),425 dxScroll: 10,426 dyScroll: -300427 });428 categoryTwo = byValueKey("catTwo7");429 expect(await driver.getElementText(categoryTwo)).to.equal('อุปกรณ์จัดเก็บในครัว');430 scrollKey = byValueKey('horiLst7');431 var j;432 for (j = 0; j < 9; j++) {433 subCategoryTwo = byValueKey("subCatTwoTxt7" + "in" + j.toString());434 switch (j) {435 case 0:436 expect(await driver.getElementText(subCategoryTwo)).to.equal('ชั้นวางของในครัว');437 break;438 case 1:439 driver.execute('flutter:scrollUntilVisible', scrollKey, {440 item: subCategoryTwo,441 dxScroll: -200,442 dyScroll: 10443 });444 expect(await driver.getElementText(subCategoryTwo)).to.equal('ตะกร้าใส่ของในครัว');445 break;446 case 2:447 driver.execute('flutter:scrollUntilVisible', scrollKey, {448 item: subCategoryTwo,449 dxScroll: -200,450 dyScroll: 10451 });452 expect(await driver.getElementText(subCategoryTwo)).to.equal('ตะกร้าผลไม้');453 break;454 case 3:455 driver.execute('flutter:scrollUntilVisible', scrollKey, {456 item: subCategoryTwo,457 dxScroll: -200,458 dyScroll: 10459 });460 expect(await driver.getElementText(subCategoryTwo)).to.equal('ที่เก็บแก้วน้ำ');461 break;462 case 4:463 driver.execute('flutter:scrollUntilVisible', scrollKey, {464 item: subCategoryTwo,465 dxScroll: -200,466 dyScroll: 10467 });468 expect(await driver.getElementText(subCategoryTwo)).to.equal('ที่เสียบมีด');469 break;470 case 5:471 driver.execute('flutter:scrollUntilVisible', scrollKey, {472 item: subCategoryTwo,473 dxScroll: -200,474 dyScroll: 10475 });476 expect(await driver.getElementText(subCategoryTwo)).to.equal('ที่ใส่ช้อนส้อม');477 break;478 case 6:479 driver.execute('flutter:scrollUntilVisible', scrollKey, {480 item: subCategoryTwo,481 dxScroll: -200,482 dyScroll: 10483 });484 expect(await driver.getElementText(subCategoryTwo)).to.equal('ที่ใส่ทิชชู่');485 break;486 case 7:487 driver.execute('flutter:scrollUntilVisible', scrollKey, {488 item: subCategoryTwo,489 dxScroll: -200,490 dyScroll: 10491 });492 expect(await driver.getElementText(subCategoryTwo)).to.equal('ราวแขวนในครัว');493 break;494 case 8:495 driver.execute('flutter:scrollUntilVisible', scrollKey, {496 item: subCategoryTwo,497 dxScroll: -200,498 dyScroll: 10499 });500 expect(await driver.getElementText(subCategoryTwo)).to.equal('อุปกรณ์จัดเก็บในครัวอื่นๆ');501 break;502 }503 }504 });505 506 it('อุปกรณ์บนโต๊ะอาหาร', async function () {507 this.timeout(300 * 1000);508 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {509 item: byValueKey("catTwo8"),510 dxScroll: 10,511 dyScroll: -300512 });513 categoryTwo = byValueKey("catTwo8");514 expect(await driver.getElementText(categoryTwo)).to.equal('อุปกรณ์บนโต๊ะอาหาร');515 scrollKey = byValueKey('horiLst8');516 var j;517 for (j = 0; j < 8; j++) {518 subCategoryTwo = byValueKey("subCatTwoTxt8" + "in" + j.toString());519 switch (j) {520 case 0:521 expect(await driver.getElementText(subCategoryTwo)).to.equal('แก้วน้ำ');522 break;523 case 1:524 driver.execute('flutter:scrollUntilVisible', scrollKey, {525 item: subCategoryTwo,526 dxScroll: -200,527 dyScroll: 10528 });529 expect(await driver.getElementText(subCategoryTwo)).to.equal('ที่รองภาชนะ');530 break;531 case 2:532 driver.execute('flutter:scrollUntilVisible', scrollKey, {533 item: subCategoryTwo,534 dxScroll: -200,535 dyScroll: 10536 });537 expect(await driver.getElementText(subCategoryTwo)).to.equal('อุปกรณ์ใส่อาหาร');538 break;539 case 3:540 driver.execute('flutter:scrollUntilVisible', scrollKey, {541 item: subCategoryTwo,542 dxScroll: -200,543 dyScroll: 10544 });545 expect(await driver.getElementText(subCategoryTwo)).to.equal('อุปกรณ์ทานอาหาร');546 break;547 case 4:548 driver.execute('flutter:scrollUntilVisible', scrollKey, {549 item: subCategoryTwo,550 dxScroll: -200,551 dyScroll: 10552 });553 expect(await driver.getElementText(subCategoryTwo)).to.equal('กล่องใส่ทิชชู');554 break;555 case 5:556 driver.execute('flutter:scrollUntilVisible', scrollKey, {557 item: subCategoryTwo,558 dxScroll: -200,559 dyScroll: 10560 });561 expect(await driver.getElementText(subCategoryTwo)).to.equal('ชุดอุปกรณ์บนโต๊ะอาหาร');562 break;563 case 6:564 driver.execute('flutter:scrollUntilVisible', scrollKey, {565 item: subCategoryTwo,566 dxScroll: -200,567 dyScroll: 10568 });569 expect(await driver.getElementText(subCategoryTwo)).to.equal('ผ้าปูโต๊ะ');570 break;571 case 7:572 driver.execute('flutter:scrollUntilVisible', scrollKey, {573 item: subCategoryTwo,574 dxScroll: -200,575 dyScroll: 10576 });577 expect(await driver.getElementText(subCategoryTwo)).to.equal('อุปกรณ์บนโต๊ะอาหารอื่นๆ');578 break;579 580 }581 }582 });583 });584 describe('กลับไปหน้าหลัก', function(){585 before(function () {586 skip = false;587 });588 589 it('ไปหน้าหลัก', async function () {590 backBtn = byValueKey('backIcon');591 await driver.touchAction({...

Full Screen

Full Screen

electricsystem.js

Source:electricsystem.js Github

copy

Full Screen

...18 });19 it('เบรกเกอร์และตู้ไฟ', async function () {20 this.timeout(300 * 1000);21 categoryTwo = byValueKey("catTwo0");22 expect(await driver.getElementText(categoryTwo)).to.equal('เบรกเกอร์และตู้ไฟ');23 scrollKey = byValueKey('horiLst0');24 for (j = 0; j < 4; j++) {25 subCategoryTwo = byValueKey("subCatTwoTxt0" + "in" + j.toString());26 switch (j) {27 case 0:28 expect(await driver.getElementText(subCategoryTwo)).to.equal('เบรกเกอร์');29 break;30 case 1:31 driver.execute('flutter:scrollUntilVisible', scrollKey, {32 item: subCategoryTwo,33 dxScroll: -200,34 dyScroll: 1035 });36 expect(await driver.getElementText(subCategoryTwo)).to.equal('ตู้ไฟฟ้า');37 break;38 case 2:39 driver.execute('flutter:scrollUntilVisible', scrollKey, {40 item: subCategoryTwo,41 dxScroll: -200,42 dyScroll: 1043 });44 expect(await driver.getElementText(subCategoryTwo)).to.equal('ฟิวส์');45 break;46 case 3:47 driver.execute('flutter:scrollUntilVisible', scrollKey, {48 item: subCategoryTwo,49 dxScroll: -200,50 dyScroll: 1051 });52 expect(await driver.getElementText(subCategoryTwo)).to.equal('มิเตอร์ไฟฟ้า');53 break;54 }55 }56 });57 it('ไฟฉายและไฟฉุกเฉิน', async function () {58 this.timeout(300*1000);59 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {60 item: byValueKey("catTwo1"),61 dxScroll: 10,62 dyScroll: -30063 });64 categoryTwo = byValueKey("catTwo1");65 expect(await driver.getElementText(categoryTwo)).to.equal('ไฟฉายและไฟฉุกเฉิน');66 scrollKey = byValueKey('horiLst1');67 for (j = 0; j < 5; j++) {68 subCategoryTwo = byValueKey("subCatTwoTxt1" + "in" + j.toString());69 switch (j) {70 case 0:71 expect(await driver.getElementText(subCategoryTwo)).to.equal('ไฟฉายและอุปกรณ์');72 break;73 case 1:74 driver.execute('flutter:scrollUntilVisible', scrollKey, {75 item: subCategoryTwo,76 dxScroll: -200,77 dyScroll: 1078 });79 expect(await driver.getElementText(subCategoryTwo)).to.equal('แบตเตอรี่แห้ง');80 break;81 case 2:82 driver.execute('flutter:scrollUntilVisible', scrollKey, {83 item: subCategoryTwo,84 dxScroll: -200,85 dyScroll: 1086 });87 expect(await driver.getElementText(subCategoryTwo)).to.equal('ไฟฉุกเฉิน');88 break;89 case 3:90 driver.execute('flutter:scrollUntilVisible', scrollKey, {91 item: subCategoryTwo,92 dxScroll: -200,93 dyScroll: 1094 });95 expect(await driver.getElementText(subCategoryTwo)).to.equal('ไฟส่องซ่อม');96 break;97 case 4:98 driver.execute('flutter:scrollUntilVisible', scrollKey, {99 item: subCategoryTwo,100 dxScroll: -200,101 dyScroll: 10102 });103 expect(await driver.getElementText(subCategoryTwo)).to.equal('ไฟไนท์ไลท์');104 break;105 }106 }107 });108 it('กริ่ง', async function () {109 this.timeout(300 * 1000);110 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {111 item: byValueKey("catTwo2"),112 dxScroll: 10,113 dyScroll: -300114 });115 categoryTwo = byValueKey("catTwo2");116 expect(await driver.getElementText(categoryTwo)).to.equal('กริ่ง');117 scrollKey = byValueKey('horiLst2');118 var j;119 for (j = 0; j < 2; j++) {120 subCategoryTwo = byValueKey("subCatTwoTxt2" + "in" + j.toString());121 switch (j) {122 case 0:123 expect(await driver.getElementText(subCategoryTwo)).to.equal('กริ่งไฟฟ้า');124 break;125 case 1:126 driver.execute('flutter:scrollUntilVisible', scrollKey, {127 item: subCategoryTwo,128 dxScroll: -200,129 dyScroll: 10130 });131 expect(await driver.getElementText(subCategoryTwo)).to.equal('กริ่งไร้สาย');132 break;133 }134 }135 });136 it('ท่อร้อยสายไฟและอุปกรณ์', async function () {137 this.timeout(300 * 1000);138 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {139 item: byValueKey("catTwo3"),140 dxScroll: 10,141 dyScroll: -300142 });143 categoryTwo = byValueKey("catTwo3");144 expect(await driver.getElementText(categoryTwo)).to.equal('ท่อร้อยสายไฟและอุปกรณ์');145 scrollKey = byValueKey('horiLst3');146 var j;147 for (j = 0; j < 10; j++) {148 subCategoryTwo = byValueKey("subCatTwoTxt3" + "in" + j.toString());149 switch (j) {150 case 0:151 expect(await driver.getElementText(subCategoryTwo)).to.equal('กล่องพักสายไฟ');152 break;153 case 1:154 driver.execute('flutter:scrollUntilVisible', scrollKey, {155 item: subCategoryTwo,156 dxScroll: -200,157 dyScroll: 10158 });159 expect(await driver.getElementText(subCategoryTwo)).to.equal('กล่องสายไฟ');160 break;161 case 2:162 driver.execute('flutter:scrollUntilVisible', scrollKey, {163 item: subCategoryTwo,164 dxScroll: -200,165 dyScroll: 10166 });167 expect(await driver.getElementText(subCategoryTwo)).to.equal('ข้อต่อ');168 break;169 case 3:170 driver.execute('flutter:scrollUntilVisible', scrollKey, {171 item: subCategoryTwo,172 dxScroll: -200,173 dyScroll: 10174 });175 expect(await driver.getElementText(subCategoryTwo)).to.equal('ตัวยึดท่อ');176 break;177 case 4:178 driver.execute('flutter:scrollUntilVisible', scrollKey, {179 item: subCategoryTwo,180 dxScroll: -200,181 dyScroll: 10182 });183 expect(await driver.getElementText(subCategoryTwo)).to.equal('ตู้พักสาย');184 break;185 case 5:186 driver.execute('flutter:scrollUntilVisible', scrollKey, {187 item: subCategoryTwo,188 dxScroll: -200,189 dyScroll: 10190 });191 expect(await driver.getElementText(subCategoryTwo)).to.equal('ท่อตรง');192 break;193 case 6:194 driver.execute('flutter:scrollUntilVisible', scrollKey, {195 item: subCategoryTwo,196 dxScroll: -200,197 dyScroll: 10198 });199 expect(await driver.getElementText(subCategoryTwo)).to.equal('ท่ออ่อน');200 break;201 case 7:202 driver.execute('flutter:scrollUntilVisible', scrollKey, {203 item: subCategoryTwo,204 dxScroll: -200,205 dyScroll: 10206 });207 expect(await driver.getElementText(subCategoryTwo)).to.equal('รางเก็บสายไฟ');208 break;209 case 8:210 driver.execute('flutter:scrollUntilVisible', scrollKey, {211 item: subCategoryTwo,212 dxScroll: -200,213 dyScroll: 10214 });215 expect(await driver.getElementText(subCategoryTwo)).to.equal('อุปกรณ์ดัดท่อ');216 break;217 case 9:218 driver.execute('flutter:scrollUntilVisible', scrollKey, {219 item: subCategoryTwo,220 dxScroll: -200,221 dyScroll: 10222 });223 expect(await driver.getElementText(subCategoryTwo)).to.equal('อุปกรณ์ท่อร้อยสายอื่นๆ');224 break;225 }226 }227 });228 it('ปลั๊กและสวิทช์ไฟฟ้า', async function () {229 this.timeout(300 * 1000);230 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {231 item: byValueKey("catTwo4"),232 dxScroll: 10,233 dyScroll: -300234 });235 categoryTwo = byValueKey("catTwo4");236 expect(await driver.getElementText(categoryTwo)).to.equal('ปลั๊กและสวิทช์ไฟฟ้า');237 scrollKey = byValueKey('horiLst4');238 var j;239 for (j = 0; j < 1; j++) {240 subCategoryTwo = byValueKey("subCatTwoTxt4" + "in" + j.toString());241 switch (j) {242 case 0:243 expect(await driver.getElementText(subCategoryTwo)).to.equal('ปลั๊กไฟ');244 break;245 }246 }247 });248 it('ระบบโซล่าเซลล์', async function () {249 this.timeout(300 * 1000);250 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {251 item: byValueKey("catTwo5"),252 dxScroll: 10,253 dyScroll: -300254 });255 categoryTwo = byValueKey("catTwo5");256 expect(await driver.getElementText(categoryTwo)).to.equal('ระบบโซล่าเซลล์');257 scrollKey = byValueKey('horiLst5');258 var j;259 for (j = 0; j < 9; j++) {260 subCategoryTwo = byValueKey("subCatTwoTxt5" + "in" + j.toString());261 switch (j) {262 case 0:263 expect(await driver.getElementText(subCategoryTwo)).to.equal('สายไฟโซล่าเซลล์');264 break;265 case 1:266 driver.execute('flutter:scrollUntilVisible', scrollKey, {267 item: subCategoryTwo,268 dxScroll: -200,269 dyScroll: 10270 });271 expect(await driver.getElementText(subCategoryTwo)).to.equal('แผงโซล่าเซลล์');272 break;273 }274 }275 });276 it('สายไฟ', async function () {277 this.timeout(300 * 1000);278 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {279 item: byValueKey("catTwo6"),280 dxScroll: 10,281 dyScroll: -300282 });283 categoryTwo = byValueKey("catTwo6");284 expect(await driver.getElementText(categoryTwo)).to.equal('สายไฟ');285 scrollKey = byValueKey('horiLst6');286 var j;287 for (j = 0; j < 13; j++) {288 subCategoryTwo = byValueKey("subCatTwoTxt6" + "in" + j.toString());289 switch (j) {290 case 0:291 expect(await driver.getElementText(subCategoryTwo)).to.equal('สาย LAN');292 break;293 case 1:294 driver.execute('flutter:scrollUntilVisible', scrollKey, {295 item: subCategoryTwo,296 dxScroll: -200,297 dyScroll: 10298 });299 expect(await driver.getElementText(subCategoryTwo)).to.equal('สายโทรศัพท์');300 break;301 case 2:302 driver.execute('flutter:scrollUntilVisible', scrollKey, {303 item: subCategoryTwo,304 dxScroll: -200,305 dyScroll: 10306 });307 expect(await driver.getElementText(subCategoryTwo)).to.equal('สายไฟ NYY');308 break;309 case 3:310 driver.execute('flutter:scrollUntilVisible', scrollKey, {311 item: subCategoryTwo,312 dxScroll: -200,313 dyScroll: 10314 });315 expect(await driver.getElementText(subCategoryTwo)).to.equal('สายไฟ THW');316 break;317 case 4:318 driver.execute('flutter:scrollUntilVisible', scrollKey, {319 item: subCategoryTwo,320 dxScroll: -200,321 dyScroll: 10322 });323 expect(await driver.getElementText(subCategoryTwo)).to.equal('สายไฟ THW-A');324 break;325 case 5:326 driver.execute('flutter:scrollUntilVisible', scrollKey, {327 item: subCategoryTwo,328 dxScroll: -200,329 dyScroll: 10330 });331 expect(await driver.getElementText(subCategoryTwo)).to.equal('สายไฟ VAF');332 break;333 case 6:334 driver.execute('flutter:scrollUntilVisible', scrollKey, {335 item: subCategoryTwo,336 dxScroll: -200,337 dyScroll: 10338 });339 expect(await driver.getElementText(subCategoryTwo)).to.equal('สายไฟ VAF-GRD');340 break;341 case 7:342 driver.execute('flutter:scrollUntilVisible', scrollKey, {343 item: subCategoryTwo,344 dxScroll: -200,345 dyScroll: 10346 });347 expect(await driver.getElementText(subCategoryTwo)).to.equal('สายไฟ VCT');348 break;349 case 8:350 driver.execute('flutter:scrollUntilVisible', scrollKey, {351 item: subCategoryTwo,352 dxScroll: -200,353 dyScroll: 10354 });355 expect(await driver.getElementText(subCategoryTwo)).to.equal('สายไฟ VFF');356 break;357 case 9:358 driver.execute('flutter:scrollUntilVisible', scrollKey, {359 item: subCategoryTwo,360 dxScroll: -200,361 dyScroll: 10362 });363 expect(await driver.getElementText(subCategoryTwo)).to.equal('สายไฟ VSF');364 break;365 case 10:366 driver.execute('flutter:scrollUntilVisible', scrollKey, {367 item: subCategoryTwo,368 dxScroll: -200,369 dyScroll: 10370 });371 expect(await driver.getElementText(subCategoryTwo)).to.equal('สายไฟเครื่องใช้ไฟฟ้า');372 break;373 case 11:374 driver.execute('flutter:scrollUntilVisible', scrollKey, {375 item: subCategoryTwo,376 dxScroll: -200,377 dyScroll: 10378 });379 expect(await driver.getElementText(subCategoryTwo)).to.equal('สายทองแดงเปลือย');380 break;381 case 12:382 driver.execute('flutter:scrollUntilVisible', scrollKey, {383 item: subCategoryTwo,384 dxScroll: -200,385 dyScroll: 10386 });387 expect(await driver.getElementText(subCategoryTwo)).to.equal('สายสัญญาณทีวี');388 break;389 }390 }391 });392 it('อุปกรณ์เดินสายไฟ', async function () {393 this.timeout(300 * 1000);394 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {395 item: byValueKey("catTwo7"),396 dxScroll: 10,397 dyScroll: -300398 });399 categoryTwo = byValueKey("catTwo7");400 expect(await driver.getElementText(categoryTwo)).to.equal('อุปกรณ์เดินสายไฟ');401 scrollKey = byValueKey('horiLst7');402 var j;403 for (j = 0; j < 7; j++) {404 subCategoryTwo = byValueKey("subCatTwoTxt7" + "in" + j.toString());405 switch (j) {406 case 0:407 expect(await driver.getElementText(subCategoryTwo)).to.equal('เคเบิ้ลไทร์');408 break;409 case 1:410 driver.execute('flutter:scrollUntilVisible', scrollKey, {411 item: subCategoryTwo,412 dxScroll: -200,413 dyScroll: 10414 });415 expect(await driver.getElementText(subCategoryTwo)).to.equal('เทปพันสายไฟ');416 break;417 case 2:418 driver.execute('flutter:scrollUntilVisible', scrollKey, {419 item: subCategoryTwo,420 dxScroll: -200,421 dyScroll: 10422 });423 expect(await driver.getElementText(subCategoryTwo)).to.equal('ไส้ไก่');424 break;425 case 3:426 driver.execute('flutter:scrollUntilVisible', scrollKey, {427 item: subCategoryTwo,428 dxScroll: -200,429 dyScroll: 10430 });431 expect(await driver.getElementText(subCategoryTwo)).to.equal('กี๊ปรัดสายไฟ');432 break;433 case 4:434 driver.execute('flutter:scrollUntilVisible', scrollKey, {435 item: subCategoryTwo,436 dxScroll: -200,437 dyScroll: 10438 });439 expect(await driver.getElementText(subCategoryTwo)).to.equal('ตัวต่อสายโทรศัพท์');440 break;441 case 5:442 driver.execute('flutter:scrollUntilVisible', scrollKey, {443 item: subCategoryTwo,444 dxScroll: -200,445 dyScroll: 10446 });447 expect(await driver.getElementText(subCategoryTwo)).to.equal('ตัวต่อสายไฟ');448 break;449 case 6:450 driver.execute('flutter:scrollUntilVisible', scrollKey, {451 item: subCategoryTwo,452 dxScroll: -200,453 dyScroll: 10454 });455 expect(await driver.getElementText(subCategoryTwo)).to.equal('มิเตอร์วัดไฟ');456 break;457 }458 }459 });460 461 it('รางปลั๊กและอแดปเตอร์', async function () {462 this.timeout(300 * 1000);463 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {464 item: byValueKey("catTwo8"),465 dxScroll: 10,466 dyScroll: -300467 });468 categoryTwo = byValueKey("catTwo8");469 expect(await driver.getElementText(categoryTwo)).to.equal('รางปลั๊กและอแดปเตอร์');470 scrollKey = byValueKey('horiLst8');471 var j;472 for (j = 0; j < 3; j++) {473 subCategoryTwo = byValueKey("subCatTwoTxt8" + "in" + j.toString());474 switch (j) {475 case 0:476 expect(await driver.getElementText(subCategoryTwo)).to.equal('ปลั๊กไฟ');477 break;478 case 1:479 driver.execute('flutter:scrollUntilVisible', scrollKey, {480 item: subCategoryTwo,481 dxScroll: -200,482 dyScroll: 10483 });484 expect(await driver.getElementText(subCategoryTwo)).to.equal('อแดปเตอร์');485 break;486 case 2:487 driver.execute('flutter:scrollUntilVisible', scrollKey, {488 item: subCategoryTwo,489 dxScroll: -200,490 dyScroll: 10491 });492 expect(await driver.getElementText(subCategoryTwo)).to.equal('ล้อเก็บสายไฟ');493 break;494 }495 }496 });497 it('ปลั๊กและสวิตช์ไฟฟ้า', async function () {498 this.timeout(300 * 1000);499 await driver.execute('flutter:scrollUntilVisible', byValueKey('lstViewVertical'), {500 item: byValueKey("catTwo9"),501 dxScroll: 10,502 dyScroll: -300503 });504 categoryTwo = byValueKey("catTwo9");505 expect(await driver.getElementText(categoryTwo)).to.equal('ปลั๊กและสวิตช์ไฟฟ้า');506 scrollKey = byValueKey('horiLst9');507 var j;508 for (j = 0; j < 4; j++) {509 subCategoryTwo = byValueKey("subCatTwoTxt9" + "in" + j.toString());510 switch (j) {511 case 0:512 expect(await driver.getElementText(subCategoryTwo)).to.equal('เต้ารับสายไฟ');513 break;514 case 1:515 driver.execute('flutter:scrollUntilVisible', scrollKey, {516 item: subCategoryTwo,517 dxScroll: -200,518 dyScroll: 10519 });520 expect(await driver.getElementText(subCategoryTwo)).to.equal('ปลั๊กไฟ');521 break;522 case 2:523 driver.execute('flutter:scrollUntilVisible', scrollKey, {524 item: subCategoryTwo,525 dxScroll: -200,526 dyScroll: 10527 });528 expect(await driver.getElementText(subCategoryTwo)).to.equal('อุปกรณ์ปลั๊กและสวิตช์');529 break;530 case 3:531 driver.execute('flutter:scrollUntilVisible', scrollKey, {532 item: subCategoryTwo,533 dxScroll: -200,534 dyScroll: 10535 });536 expect(await driver.getElementText(subCategoryTwo)).to.equal('สวิตช์ไฟ');537 break;538 }539 }540 });541 });542 describe('กลับไปหน้าหลัก', function(){543 before(function () {544 skip = false;545 });546 547 it('ไปหน้าหลัก', async function () {548 backBtn = byValueKey('backIcon');549 await driver.touchAction({550 action: 'tap',...

Full Screen

Full Screen

reports-subject.js

Source:reports-subject.js Github

copy

Full Screen

...234 };235 const testLineageList = async (lineageList) => {236 for (let i = 0; i < lineageList.length; i++) {237 const contentText = element(by.css(`#reports-list li .detail .lineage li:nth-child(${i + 1})`));238 expect(await getElementText(contentText)).toBe(lineageList[i]);239 }240 };241 const testLineageSummary = async (summaryList) => {242 for (let i = 0; i < summaryList.length; i++) {243 const contentText = element(by.css(`#reports-content .item-summary .position .lineage li:nth-child(${i + 1})`));244 expect(await getElementText(contentText)).toBe(summaryList[i]);245 }246 };247 const saveReport = (report) => {248 return utils.saveDoc(report);249 };250 const waitElementTextEquals = (elementGetter, expectedText) => {251 return browser.wait(async () => {252 try {253 const element = await elementGetter();254 const text = await helper.getTextFromElementNative(element);255 return text === expectedText;256 } catch (err) {257 // we expect these items to be redrawn, so stale element reference errors are expected258 return false;259 }260 }, 5000);261 };262 /**263 * Since the LHS might be refreshed, random StaleElementReferenceErrors were frequent enough,264 * to do something about them.265 * @param element266 * @param attempt267 * @returns {Promise<* | undefined>}268 */269 const getElementText = (element, attempt = 0) => {270 return helper271 .getTextFromElementNative(element)272 .catch(error => {273 if (attempt < 2) {274 return getElementText(element, attempt + 1);275 }276 throw error;277 });278 };279 beforeAll(async () => {280 await utils.updateSettings(CONFIG);281 await utils.saveDocs(CONTACTS);282 });283 afterAll(utils.afterEach);284 afterEach(() => {285 return utils.deleteAllDocs(CONTACTS.map(contact => contact._id)); // deletes all except these docs286 });287 describe('Displays correct LHS and RHS summary', () => {288 it('Concerning reports using patient_id', async () => {289 const REPORT = {290 _id: 'REF_REF_V1',291 form: 'RR',292 type: 'data_record',293 from: PHONE_CAROL,294 fields: {295 patient_id: MARIA.patient_id296 },297 sms_message: {298 message_id: 23,299 from: PHONE_CAROL,300 message: `1!RR!${MARIA.patient_id}`,301 form: 'RR',302 locale: 'en'303 },304 reported_date: moment().subtract(10, 'minutes').valueOf()305 };306 await saveReport(REPORT);307 await sentinelUtils.waitForSentinel([REPORT._id]);308 await commonElements.goToReportsNative();309 const report = await reportsTab.loadReport(REPORT._id);310 // LHS311 expect(await getElementText(reportsTab.subject(report))).toBe(MARIA.name);312 expect(await getElementText(reportsTab.formName(report))).toBe('REF_REF');313 //shows subject lineage breadcrumbs314 await testLineageList(['TAG Place', 'Health Center', 'District']);315 //RHS316 await browser.wait(() => getElementText(reportsTab.submitterPhone()),10000);317 expect(await getElementText(reportsTab.subjectName())).toBe(MARIA.name);318 expect(await getElementText(reportsTab.summaryFormName())).toBe('REF_REF');319 await testLineageSummary(['TAG Place', 'Health Center', 'District']);320 expect(await getElementText(reportsTab.submitterName())).toMatch(`Submitted by ${CAROL.name}`);321 expect(await getElementText(reportsTab.submitterPhone())).toBe(CAROL.phone);322 });323 it('Concerning reports using doc id', async () => {324 const REPORT = {325 _id: 'REF_REF_V2',326 form: 'RR',327 type: 'data_record',328 from: PHONE_CAROL,329 fields: {330 patient_id: MARIA._id331 },332 sms_message: {333 message_id: 23,334 from: PHONE_CAROL,335 message: `1!RR!${MARIA._id}`,336 form: 'RR',337 locale: 'en'338 },339 reported_date: moment().subtract(20, 'minutes').valueOf()340 };341 await saveReport(REPORT);342 await sentinelUtils.waitForSentinel([REPORT._id]);343 await commonElements.goToReportsNative();344 // LHS345 const report = await reportsTab.loadReport(REPORT._id);346 expect(await getElementText(reportsTab.subject(report))).toBe(MARIA.name);347 expect(await getElementText(reportsTab.formName(report))).toBe('REF_REF');348 //shows subject lineage breadcrumbs349 await testLineageList(['TAG Place', 'Health Center', 'District']);350 //RHS351 expect(await getElementText(reportsTab.subjectName())).toBe(MARIA.name);352 expect(await getElementText(reportsTab.summaryFormName())).toBe('REF_REF');353 await testLineageSummary(['TAG Place', 'Health Center', 'District']);354 expect(await getElementText(reportsTab.submitterName())).toMatch(`Submitted by ${CAROL.name}`);355 expect(await getElementText(reportsTab.submitterPhone())).toBe(CAROL.phone);356 });357 it('Concerning reports with unknown patient_id', async () => {358 const REPORT = {359 _id: 'REF_REF_I',360 form: 'RR',361 type: 'data_record',362 from: PHONE_CAROL,363 fields: {364 patient_id: '111111'365 },366 sms_message: {367 message_id: 23,368 from: PHONE_CAROL,369 message: `1!RR!${MARIA.patient_id}`,370 form: 'RR',371 locale: 'en'372 },373 reported_date: moment().subtract(30, 'minutes').valueOf()374 };375 await saveReport(REPORT);376 await sentinelUtils.waitForSentinel([REPORT._id]);377 await commonElements.goToReportsNative();378 // LHS379 const report = await reportsTab.loadReport(REPORT._id);380 expect(await getElementText(reportsTab.subject(report))).toBe('Unknown subject');381 expect(await getElementText(reportsTab.formName(report))).toBe('REF_REF');382 //shows subject lineage breadcrumbs383 await testLineageList(['Bob Place', 'Health Center', 'District']);384 //RHS385 expect(await getElementText(reportsTab.subjectName())).toBe('Unknown subject');386 expect(await getElementText(reportsTab.summaryFormName())).toBe('REF_REF');387 await testLineageSummary(['Bob Place', 'Health Center', 'District']);388 expect(await getElementText(reportsTab.submitterName())).toMatch(`Submitted by ${CAROL.name}`);389 expect(await getElementText(reportsTab.submitterPhone())).toBe(CAROL.phone);390 });391 it('Concerning reports using patient name', async () => {392 const REPORT = {393 _id: 'NAM_NAM_V',394 form: 'NN',395 type: 'data_record',396 from: PHONE_CAROL,397 fields: {398 patient_name: GEORGE.name399 },400 sms_message: {401 message_id: 23,402 from: PHONE_CAROL,403 message: `1!NN!${GEORGE.name}`,404 form: 'NN',405 locale: 'en'406 },407 reported_date: moment().subtract(40, 'minutes').valueOf()408 };409 await saveReport(REPORT);410 await sentinelUtils.waitForSentinel(REPORT._id);411 await commonElements.goToReportsNative();412 // LHS413 const report = await reportsTab.loadReport(REPORT._id);414 expect(await getElementText(reportsTab.subject(report))).toBe(GEORGE.name);415 expect(await getElementText(reportsTab.formName(report))).toBe('NAM_NAM');416 //shows subject lineage breadcrumbs417 await testLineageList(['Bob Place', 'Health Center', 'District']);418 //RHS419 expect(await getElementText(reportsTab.subjectName())).toBe(GEORGE.name);420 expect(await getElementText(reportsTab.summaryFormName())).toBe('NAM_NAM');421 await testLineageSummary(['Bob Place', 'Health Center', 'District']);422 expect(await getElementText(reportsTab.submitterName())).toMatch(`Submitted by ${CAROL.name}`);423 expect(await getElementText(reportsTab.submitterPhone())).toBe(CAROL.phone);424 });425 it('Concerning reports using missing required patient name', async () => {426 const REPORT = {427 _id: 'NAM_NAM_I',428 form: 'NN',429 type: 'data_record',430 from: PHONE_CAROL,431 errors: [432 {433 fields: 'patient_name',434 code: 'sys.missing_fields'435 }436 ],437 fields: {438 patient_name: ''439 },440 sms_message: {441 message_id: 23,442 from: PHONE_CAROL,443 message: `1!RR!${MARIA._id}`,444 form: 'NN',445 locale: 'en'446 },447 reported_date: moment().subtract(50, 'minutes').valueOf()448 };449 await saveReport(REPORT);450 await sentinelUtils.waitForSentinel([REPORT._id]);451 await commonElements.goToReportsNative();452 // LHS453 const report = await reportsTab.loadReport(REPORT._id);454 expect(await getElementText(reportsTab.subject(report))).toBe('Unknown subject');455 expect(await getElementText(reportsTab.formName(report))).toBe('NAM_NAM');456 //shows subject lineage breadcrumbs457 await testLineageList(['Bob Place', 'Health Center', 'District']);458 //RHS459 expect(await getElementText(reportsTab.subjectName())).toBe('Unknown subject');460 expect(await getElementText(reportsTab.summaryFormName())).toBe('NAM_NAM');461 await testLineageSummary(['Bob Place', 'Health Center', 'District']);462 expect(await getElementText(reportsTab.submitterName())).toMatch(`Submitted by ${CAROL.name}`);463 expect(await getElementText(reportsTab.submitterPhone())).toBe(CAROL.phone);464 });465 it('Concerning reports using place_id with a place_uuid', async () => {466 const REPORT = {467 _id: 'PREF_PREF_V',468 form: 'P',469 type: 'data_record',470 from: PHONE_CAROL,471 fields: {472 place_id: TAG_PLACE._id473 },474 sms_message: {475 message_id: 23,476 from: PHONE_CAROL,477 message: `1!P!${TAG_PLACE._id}`,478 form: 'RR',479 locale: 'en'480 },481 reported_date: moment().subtract(60, 'minutes').valueOf()482 };483 await saveReport(REPORT);484 await sentinelUtils.waitForSentinel([REPORT._id]);485 await commonElements.goToReportsNative();486 // LHS487 const report = await reportsTab.loadReport(REPORT._id);488 expect(await getElementText(reportsTab.subject(report))).toBe(TAG_PLACE.name);489 expect(await getElementText(reportsTab.formName(report))).toBe('PID_PID');490 //shows subject lineage breadcrumbs491 await testLineageList(['Health Center', 'District']);492 //RHS493 expect(await getElementText(reportsTab.subjectName())).toBe(TAG_PLACE.name);494 expect(await getElementText(reportsTab.summaryFormName())).toBe('PID_PID');495 await testLineageSummary(['Health Center', 'District']);496 expect(await getElementText(reportsTab.submitterName())).toMatch(`Submitted by ${CAROL.name}`);497 expect(await getElementText(reportsTab.submitterPhone())).toBe(CAROL.phone);498 });499 it('Concerning reports using place_id with a shortcode', async () => {500 const REPORT = {501 _id: 'PREF_PREF_V',502 form: 'P',503 type: 'data_record',504 from: PHONE_CAROL,505 fields: {506 place_id: TAG_PLACE.place_id507 },508 sms_message: {509 message_id: 23,510 from: PHONE_CAROL,511 message: `1!P!${TAG_PLACE.place_id}`,512 form: 'RR',513 locale: 'en'514 },515 reported_date: moment().subtract(60, 'minutes').valueOf()516 };517 await saveReport(REPORT);518 await sentinelUtils.waitForSentinel([REPORT._id]);519 await commonElements.goToReportsNative();520 // LHS521 const report = await reportsTab.loadReport(REPORT._id);522 expect(await getElementText(reportsTab.subject(report))).toBe(TAG_PLACE.name);523 expect(await getElementText(reportsTab.formName(report))).toBe('PID_PID');524 //shows subject lineage breadcrumbs525 await testLineageList(['Health Center', 'District']);526 //RHS527 expect(await getElementText(reportsTab.subjectName())).toBe(TAG_PLACE.name);528 expect(await getElementText(reportsTab.summaryFormName())).toBe('PID_PID');529 await testLineageSummary(['Health Center', 'District']);530 expect(await getElementText(reportsTab.submitterName())).toMatch(`Submitted by ${CAROL.name}`);531 expect(await getElementText(reportsTab.submitterPhone())).toBe(CAROL.phone);532 });533 it('Concerning reports using unknown place_id', async () => {534 const REPORT = {535 _id: 'PREF_PREF_I',536 form: 'P',537 type: 'data_record',538 from: PHONE_CAROL,539 fields: {540 place_id: '12'541 },542 sms_message: {543 message_id: 23,544 from: PHONE_CAROL,545 message: `1!P!12`,546 form: 'RR',547 locale: 'en'548 },549 reported_date: moment().subtract(2, 'hours').valueOf()550 };551 await saveReport(REPORT);552 await sentinelUtils.waitForSentinel([REPORT._id]);553 await commonElements.goToReportsNative();554 // LHS555 const report = await reportsTab.loadReport(REPORT._id);556 expect(await getElementText(reportsTab.subject(report))).toBe('Unknown subject');557 expect(await getElementText(reportsTab.formName(report))).toBe('PID_PID');558 //shows subject lineage breadcrumbs559 await testLineageList(['Bob Place', 'Health Center', 'District']);560 //RHS561 expect(await getElementText(reportsTab.subjectName())).toBe('Unknown subject');562 expect(await getElementText(reportsTab.summaryFormName())).toBe('PID_PID');563 await testLineageSummary(['Bob Place', 'Health Center', 'District']);564 expect(await getElementText(reportsTab.submitterName())).toMatch(`Submitted by ${CAROL.name}`);565 expect(await getElementText(reportsTab.submitterPhone())).toBe(CAROL.phone);566 });567 it('Concerning reports which do not have a subject', async () => {568 const REPORT = {569 _id: 'SURVEY_REPORT',570 form: 'S',571 type: 'data_record',572 from: PHONE_CAROL,573 fields: {574 survey_subject: 'something'575 },576 sms_message: {577 message_id: 23,578 from: PHONE_CAROL,579 message: `1!S!something`,580 form: 'S',581 locale: 'en'582 },583 reported_date: moment().subtract(10, 'hours').valueOf()584 };585 await saveReport(REPORT);586 await sentinelUtils.waitForSentinel([REPORT._id]);587 await commonElements.goToReportsNative();588 // LHS589 const report = await reportsTab.loadReport(REPORT._id);590 expect(await getElementText(reportsTab.subject(report))).toBe(CAROL.name);591 expect(await getElementText(reportsTab.formName(report))).toBe('SURVEY');592 //shows subject lineage breadcrumbs593 await testLineageList(['Bob Place', 'Health Center', 'District']);594 //RHS595 expect(await reportsTab.subjectName().isPresent()).toBe(false);596 expect(await getElementText(reportsTab.formNameNoSubject())).toBe('SURVEY');597 await testLineageSummary(['Bob Place', 'Health Center', 'District']);598 expect(await getElementText(reportsTab.submitterName())).toBe(CAROL.name);599 expect(await getElementText(reportsTab.submitterPhone())).toBe(CAROL.phone);600 });601 it('Concerning reports which have an unknown sender and have a known subject', async () => {602 const REPORT = {603 _id: 'PID_US',604 form: 'P',605 type: 'data_record',606 from: '555',607 fields: {608 place_id: BOB_PLACE._id609 },610 sms_message: {611 message_id: 23,612 from: '555',613 message: `1!P!${BOB_PLACE._id}`,614 form: 'RR',615 locale: 'en'616 },617 reported_date: moment().subtract(6, 'hours').valueOf()618 };619 await saveReport(REPORT);620 await commonElements.goToReportsNative();621 // LHS622 const report = await reportsTab.loadReport(REPORT._id);623 expect(await getElementText(reportsTab.subject(report))).toBe(BOB_PLACE.name);624 expect(await getElementText(reportsTab.formName(report))).toBe('PID_PID');625 //shows subject lineage breadcrumbs626 await testLineageList(['Health Center', 'District']);627 //RHS628 expect(await getElementText(reportsTab.subjectName())).toBe(BOB_PLACE.name);629 expect(await getElementText(reportsTab.summaryFormName())).toBe('PID_PID');630 await testLineageSummary(['Health Center', 'District']);631 expect(await getElementText(reportsTab.submitterName())).toMatch('555');632 expect(await getElementText(reportsTab.submitterPhone())).toBe('');633 });634 it('Concerning reports which have an unknown sender with no phone number', async () => {635 const REPORT = {636 _id: 'PID_USNP',637 form: 'P',638 type: 'data_record',639 from: '',640 fields: {641 place_id: BOB_PLACE._id642 },643 sms_message: {644 message_id: 23,645 from: '',646 message: `1!P!${BOB_PLACE._id}`,647 form: 'RR',648 locale: 'en'649 },650 reported_date: moment().subtract(6, 'hours').valueOf()651 };652 await saveReport(REPORT);653 await commonElements.goToReportsNative();654 const report = await reportsTab.loadReport(REPORT._id);655 expect(await getElementText(reportsTab.subject(report))).toBe(BOB_PLACE.name);656 expect(await getElementText(reportsTab.formName(report))).toBe('PID_PID');657 //shows subject lineage breadcrumbs658 await testLineageList(['Health Center', 'District']);659 //RHS660 expect(await getElementText(reportsTab.subjectName())).toBe(BOB_PLACE.name);661 expect(await getElementText(reportsTab.summaryFormName())).toBe('PID_PID');662 await testLineageSummary(['Health Center', 'District']);663 expect(await getElementText(reportsTab.submitterName())).toMatch('Unknown sender');664 expect(await getElementText(reportsTab.submitterPhone())).toBe('');665 });666 it('Changes to a loaded or list report should be reflected in the UI', async () => {667 const REPORT = {668 _id: 'REF_REF_V3',669 form: 'RR',670 type: 'data_record',671 from: PHONE_CAROL,672 fields: {673 patient_id: MARIA.patient_id674 },675 contact: {676 _id: CAROL._id,677 parent: CAROL.parent,678 },679 reported_date: moment().subtract(10, 'minutes').valueOf(),680 };681 await saveReport(REPORT);682 await sentinelUtils.waitForSentinel([REPORT._id]);683 await commonElements.goToReportsNative();684 // LHS685 let report = await reportsTab.loadReport(REPORT._id);686 expect(await getElementText(reportsTab.subject(report))).toBe(MARIA.name);687 expect(await getElementText(reportsTab.formName(report))).toBe('REF_REF');688 //shows subject lineage breadcrumbs689 await testLineageList(['TAG Place', 'Health Center', 'District']);690 //RHS691 expect(await getElementText(reportsTab.subjectName())).toBe(MARIA.name);692 expect(await getElementText(reportsTab.summaryFormName())).toBe('REF_REF');693 await testLineageSummary(['TAG Place', 'Health Center', 'District']);694 expect(await getElementText(reportsTab.submitterName())).toMatch(`Submitted by ${CAROL.name}`);695 expect(await getElementText(reportsTab.submitterPhone())).toBe(CAROL.phone);696 // change both patient and submitter697 const reportDoc = await utils.getDoc(REPORT._id);698 reportDoc.contact = { _id: JOHN._id, parent: JOHN.parent };699 reportDoc.fields.patient_id = ROBERT.patient_id;700 await utils.saveDoc(reportDoc);701 // wait until this is reflected in the UI, without refreshing!702 const getFreshListitem = async () => {703 const report = await reportsTab.reportByUUID(REPORT._id);704 return reportsTab.subject(report);705 };706 await waitElementTextEquals(() => getFreshListitem(), ROBERT.name); // LHS updated707 await waitElementTextEquals(() => reportsTab.submitterPhone(), JOHN.phone); // RHS updated708 report = await reportsTab.reportByUUID(REPORT._id);709 // LHS710 expect(await getElementText(reportsTab.subject(report))).toBe(ROBERT.name);711 //shows subject lineage breadcrumbs712 await testLineageList(['Bob Place', 'Health Center', 'District']);713 //RHS714 expect(await getElementText(reportsTab.subjectName())).toBe(ROBERT.name);715 expect(await getElementText(reportsTab.summaryFormName())).toBe('REF_REF');716 await testLineageSummary(['Bob Place', 'Health Center', 'District']);717 expect(await getElementText(reportsTab.submitterName())).toMatch(`Submitted by ${JOHN.name}`);718 expect(await getElementText(reportsTab.submitterPhone())).toBe(JOHN.phone);719 });720 });...

Full Screen

Full Screen

common.js

Source:common.js Github

copy

Full Screen

...55 56 return "";57 } 58 59 const title = getElementText("title");60 const description = getElementText("summary");61 const guid = getElementText("id");62 const pubDate = getElementText("updated");63 const author = getElementText("author");64 const link = getElementAttribute("link", "href");65 66 return {"title": sanitize(title), "guid": guid, "description": description, "pubDate": pubDate, "author": author, "link": link};67};68 69const convertRSSItemToJSON = (item) => {70 const getElementText = (tagName) => {71 const elements = findNodes(tagName, item.childNodes);72 if(elements && elements.length > 0) {73 return elements[0].textContent;74 }75 76 return "";77 } 78 79 const title = getElementText("title");80 const description = getElementText("description");81 const guid = getElementText("guid");82 const pubDate = getElementText("pubDate");83 const author = getElementText("author");84 const link = getElementText("link");85 86 return {"title": title, "guid": guid, "description": description, "pubDate": pubDate, "author": author, "link": link};87};88/*89const convertFeedItemToJSON = (item) => {90 if (item.nodeName === 'item') {91 return convertRSSItemToJSON(item);92 } else if (item.nodeName === 'entry') {93 return convertAtomItemToJSON(item);94 } else {95 return [];96 }97}98const convertAtomItemToJSON = (item) => {99 const getElementText = (tagName) => {100 const elements = item.getElementsByTagName(tagName);101 if (elements && elements.length > 0) {102 return elements[0].textContent;103 }104 return "";105 }106 const getElementAttribute = (tagName, attribute) => {107 const elements = item.getElementsByTagName(tagName);108 if (elements && elements.length > 0 && elements[0].attributes['href']) {109 return elements[0].attributes['href'].value;110 }111 return "";112 }113 const title = getElementText("title");114 const description = getElementText("summary");115 const guid = getElementText("id");116 const pubDate = getElementText("updated");117 const author = getElementText("author");118 const link = getElementAttribute("link", "href");119 return {120 "title": title,121 "guid": guid,122 "description": description,123 "pubDate": pubDate,124 "author": author,125 "link": link126 };127};128const convertRSSItemToJSON = (item) => {129 const getElementText = (tagName) => {130 const elements = item.getElementsByTagName(tagName);131 if (elements && elements.length > 0) {132 return elements[0].textContent;133 }134 return "";135 }136 const title = getElementText("title");137 const description = getElementText("description");138 const guid = getElementText("guid");139 const pubDate = getElementText("pubDate");140 const author = getElementText("author");141 const link = getElementText("link");142 return {143 "title": title,144 "guid": guid,145 "description": description,146 "pubDate": pubDate,147 "author": author,148 "link": link149 };150};*/151export {152 convertRSSItemToJSON,153 convertAtomItemToJSON,154 convertFeedItemsToJSON155}

Full Screen

Full Screen

retrieveFeed.js

Source:retrieveFeed.js Github

copy

Full Screen

...7 function getElementHtml(parent, selector) {8 const element = parent.querySelector(selector);9 return element ? element.innerHTML : '';10 }11 function getElementText(parent, selector) {12 const element = parent.querySelector(selector);13 return element ? element.textContent : '';14 }15 function getElementAttribute(parent, selector, attribute) {16 const element = parent.querySelector(selector);17 return element ? element.getAttribute(attribute) : '';18 }19 var feedHandlers = [20 {21 name: 'atom',22 selector: 'feed entry',23 parseArticle: function (element) {24 return {25 id: getElementText(element, 'id'),26 url: getElementAttribute(element, 'link', 'href'),27 title: getElementText(element, 'title'),28 author: getElementText(element, 'name'),29 date: getElementText(element, 'published') || getElementText(element, 'updated'),30 content: getElementHtml(element, 'content') || getElementHtml(element, 'summary')31 };32 },33 parseMetadata: function (doc) {34 const updated = getElementText(doc, 'feed > updated');35 return {36 title: getElementText(doc, 'feed > title'),37 updatedDate: updated ? new Date(updated) : undefined38 };39 }40 },41 {42 name: 'rss',43 selector: 'rss item, rdf\\:RDF item',44 parseArticle: function (element) {45 return {46 id: getElementText(element, 'guid') ||47 getElementText(element, 'identifier') || getElementText(element, 'link'), // RSSv148 url: getElementText(element, 'link'),49 title: getElementText(element, 'title'),50 author: getElementText(element, 'author') || getElementText(element, 'creator'),51 date: getElementText(element, 'pubDate') || getElementText(element, 'date'),52 content: getElementHtml(element, 'description')53 };54 },55 parseMetadata: function (doc) {56 const updated = getElementText(doc, 'channel > pubDate') ||57 getElementText(doc, 'channel > lastBuildDate') ||58 getElementText(doc, 'channel > syn\\:updateBase'); // RSSv159 return {60 title: getElementText(doc, 'channel > title'),61 description: getElementText(doc, 'channel > description'),62 updatedDate: updated ? new Date(updated) : undefined,63 url: getElementText(doc, 'channel > link')64 };65 }66 }67 ];68 function handleFeed(doc, url) {69 let elements;70 const match = feedHandlers.find(function (obj) {71 elements = doc.querySelectorAll(obj.selector);72 return elements.length > 0;73 });74 if (!match) {75 throw new Error('Unrecognized feed format');76 }77 const articles = slice.call(elements).map(function (element) {...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriverio = require('webdriverio');2var options = {3 desiredCapabilities: {4 }5};6 .remote(options)7 .init()8 .getTitle().then(function(title) {9 console.log('Title was: ' + title);10 })11 .click('a[href="/intl/en/about/products/"]')12 .pause(3000)13 .getTitle().then(function(title) {14 console.log('Title was: ' + title);15 })16 .end();

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriverio = require('webdriverio');2var options = {3 desiredCapabilities: {4 }5};6 .remote(options)7 .init()8 .getTitle().then(function(title) {9 console.log('Title was: ' + title);10 })11 .end();

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriverio = require('webdriverio');2var options = { desiredCapabilities: { browserName: 'chrome' } };3var client = webdriverio.remote(options);4 .init()5 .getTitle().then(function(title) {6 console.log('Title was: ' + title);7 })8 .end();9var webdriverio = require('webdriverio');10var options = { desiredCapabilities: { browserName: 'chrome' } };11var client = webdriverio.remote(options);12 .init()13 .getText('body').then(function(text) {14 console.log('Text was: ' + text);15 })16 .end();17var webdriverio = require('webdriverio');18var options = { desiredCapabilities: { browserName: 'chrome' } };19var client = webdriverio.remote(options);20 .init()21 .getText('body').then(function(text) {22 console.log('Text was: ' + text);23 })24 .end();25var webdriverio = require('webdriverio');26var options = { desiredCapabilities: { browserName: 'chrome' } };27var client = webdriverio.remote(options);28 .init()29 .getText('body').then(function(text) {30 console.log('Text was: ' + text);31 })32 .end();33var webdriverio = require('webdriverio');34var options = { desiredCapabilities: { browserName: 'chrome' } };35var client = webdriverio.remote(options);36 .init()

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriverio = require('webdriverio');2var options = { desiredCapabilities: { browserName: 'chrome' } };3var client = webdriverio.remote(options);4 .init()5 .getTitle().then(function(title) {6 console.log('Title was: ' + title);7 })8 .end();9We can also use the .getTitle() method to grab the title of the page and store it in a variable, like so:10var title = client.getTitle();11.click()12var webdriverio = require('webdriverio');13var options = { desiredCapabilities: { browserName: 'chrome' } };14var client = webdriverio.remote(options);

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriverio = require('webdriverio');2var options = {3 desiredCapabilities: {4 }5};6 .remote(options)7 .init()8 .getTitle().then(function(title) {9 console.log('Title was: ' + title);10 })11 .end();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { remote } = require('webdriverio');2(async () => {3 const browser = await remote({4 capabilities: {5 }6 })7 const title = await browser.getTitle()8 console.log('Title was: ' + title)9 await browser.deleteSession();10})().catch((e) => console.error(e))11The syntax of the getElementText() function is:12const text = await browser.getElementText(selector)13const { remote } = require('webdriverio');14(async () => {15 const browser = await remote({16 capabilities: {17 }18 })19 const text = await browser.getElementText('h1')20 console.log('Text was: ' + text)21 await browser.deleteSession();22})().catch((e) => console.error(e))23The syntax of the getText() function is:24const text = await browser.getText(selector)

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('Test WebdriverIO', () => {2 it('should have the right title', () => {3 const title = browser.getTitle();4 console.log('Title was: ' + title);5 const text = $('h1').getText();6 console.log('text was: ' + text);7 });8});

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('Getting text of an element', function() {2 it('should get the text of an element', function () {3 var text = browser.getElementText('#button-clicks');4 console.log(text);5 });6});

Full Screen

WebdriverIO Tutorial

Wondering what could be a next-gen browser and mobile test automation framework that is also simple and concise? Yes, that’s right, it's WebdriverIO. Since the setup is very easy to follow compared to Selenium testing configuration, you can configure the features manually thereby being the center of attraction for automation testing. Therefore the testers adopt WedriverIO to fulfill their needs of browser testing.

Learn to run automation testing with WebdriverIO tutorial. Go from a beginner to a professional automation test expert with LambdaTest WebdriverIO tutorial.

Chapters

  1. Running Your First Automation Script - Learn the steps involved to execute your first Test Automation Script using WebdriverIO since the setup is very easy to follow and the features can be configured manually.

  2. Selenium Automation With WebdriverIO - Read more about automation testing with WebdriverIO and how it supports both browsers and mobile devices.

  3. Browser Commands For Selenium Testing - Understand more about the barriers faced while working on your Selenium Automation Scripts in WebdriverIO, the ‘browser’ object and how to use them?

  4. Handling Alerts & Overlay In Selenium - Learn different types of alerts faced during automation, how to handle these alerts and pops and also overlay modal in WebdriverIO.

  5. How To Use Selenium Locators? - Understand how Webdriver uses selenium locators in a most unique way since having to choose web elements very carefully for script execution is very important to get stable test results.

  6. Deep Selectors In Selenium WebdriverIO - The most popular automation testing framework that is extensively adopted by all the testers at a global level is WebdriverIO. Learn how you can use Deep Selectors in Selenium WebdriverIO.

  7. Handling Dropdown In Selenium - Learn more about handling dropdowns and how it's important while performing automated browser testing.

  8. Automated Monkey Testing with Selenium & WebdriverIO - Understand how you can leverage the amazing quality of WebdriverIO along with selenium framework to automate monkey testing of your website or web applications.

  9. JavaScript Testing with Selenium and WebdriverIO - Speed up your Javascript testing with Selenium and WebdriverIO.

  10. Cross Browser Testing With WebdriverIO - Learn more with this step-by-step tutorial about WebdriverIO framework and how cross-browser testing is done with WebdriverIO.

Run Webdriverio automation tests on LambdaTest cloud grid

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

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful