How to use waitFor method in testing-library-react-hooks

Best JavaScript code snippet using testing-library-react-hooks

test.js

Source:test.js Github

copy

Full Screen

...14{15 for(var i=0;i<times;i++)16 {17 replay.keyDown(direction);18 replay.waitFor(new Framework.EqualCondition("map.player1.isWalking",false));19 replay.keyUp(direction);20 }21}22var PlaceBomb = function()23{24 replay.keyDown("Space");25}26var WaitAllBombExplore = function()27{28 replay.waitFor(new Framework.EqualCondition("map.bombArray.length",0,0));29}30var GoToLevel = function(levelName)31{32 replay.goToLevel(levelName);33}34var WaitFor = function(waitCycle)35{36 replay.waitFor(waitCycle);37}3839var AssertBombPower = function(bombPower){40 replay.assertEqual("map.player1.bombPower",bombPower);41}42var AssertMaxBombNum = function(maxBombNum){43 replay.assertEqual("map.player1.maxBombNum",maxBombNum);44}45var AssertBombNum = function(bombNum){46 replay.assertEqual("map.player1.bombNum",bombNum);47}48var AssertMapTile = function(x,y,tileType){49 replay.assertEqual("map.mapArray["+x+"]["+y+"]",tileType);50}51var AssertMonsterDie = function(monsterId){52 replay.assertEqual("map.monster["+monsterId+"].isdead",true);53}54var AssertIsMonsterStop = function(isMonsterStop){55 replay.assertEqual("map.stopMonster",isMonsterStop);56}57var AssertScore = function(score){58 replay.assertEqual("map.score._score",score);59}606162QUnit.asyncTest( "Test Script", function( assert ) {63 Framework.Replay.waitFor(85);64 // Change Level :level1;65 Framework.Replay.waitFor(3);66 Framework.Replay.mouseClick(471,343);67 Framework.Replay.waitFor(106);68 Framework.Replay.keyDown('Right');69 Framework.Replay.waitFor(13);70 Framework.Replay.keyUp('Right');71 Framework.Replay.waitFor(7);72 Framework.Replay.keyDown('Space');73 Framework.Replay.waitFor(11);74 Framework.Replay.keyUp('Space');75 Framework.Replay.waitFor(13);76 Framework.Replay.keyDown('Left');77 Framework.Replay.waitFor(9);78 Framework.Replay.keyUp('Left');79 Framework.Replay.waitFor(41);80 Framework.Replay.keyDown('Down');81 Framework.Replay.waitFor(9);82 Framework.Replay.keyUp('Down');83 Framework.Replay.waitFor(73);84 Framework.Replay.keyDown('Up');85 Framework.Replay.waitFor(11);86 Framework.Replay.keyUp('Up');87 Framework.Replay.waitFor(17);88 Framework.Replay.keyDown('Right');89 Framework.Replay.waitFor(15);90 Framework.Replay.keyUp('Right');91 Framework.Replay.waitFor(41);92 Framework.Replay.keyDown('Down');93 Framework.Replay.waitFor(11);94 Framework.Replay.keyUp('Down');95 Framework.Replay.waitFor(17);96 Framework.Replay.keyDown('Space');97 Framework.Replay.waitFor(13);98 Framework.Replay.keyUp('Space');99 Framework.Replay.waitFor(7);100 Framework.Replay.keyDown('Up');101 Framework.Replay.waitFor(9);102 Framework.Replay.keyUp('Up');103 Framework.Replay.waitFor(15);104 Framework.Replay.keyDown('Left');105 Framework.Replay.waitFor(11);106 Framework.Replay.keyUp('Left');107 Framework.Replay.waitFor(90);108 Framework.Replay.keyDown('Right');109 Framework.Replay.waitFor(13);110 Framework.Replay.keyUp('Right');111 Framework.Replay.waitFor(19);112 Framework.Replay.keyDown('Right');113 Framework.Replay.waitFor(13);114 Framework.Replay.keyUp('Right');115 Framework.Replay.waitFor(18);116 Framework.Replay.keyDown('Down');117 Framework.Replay.waitFor(9);118 Framework.Replay.keyUp('Down');119 Framework.Replay.waitFor(47);120 Framework.Replay.keyDown('Down');121 Framework.Replay.waitFor(7);122 Framework.Replay.keyUp('Down');123 Framework.Replay.waitFor(27);124 Framework.Replay.keyDown('Space');125 Framework.Replay.waitFor(9);126 Framework.Replay.keyUp('Space');127 Framework.Replay.waitFor(19);128 Framework.Replay.keyDown('Up');129 Framework.Replay.waitFor(7);130 Framework.Replay.keyUp('Up');131 Framework.Replay.waitFor(17);132 Framework.Replay.keyDown('Up');133 Framework.Replay.waitFor(9);134 Framework.Replay.keyUp('Up');135 Framework.Replay.waitFor(13);136 Framework.Replay.keyDown('Left');137 Framework.Replay.waitFor(13);138 Framework.Replay.keyUp('Left');139 Framework.Replay.waitFor(54);140 Framework.Replay.keyDown('Right');141 Framework.Replay.waitFor(11);142 Framework.Replay.keyUp('Right');143 Framework.Replay.waitFor(13);144 Framework.Replay.keyDown('Right');145 Framework.Replay.waitFor(11);146 Framework.Replay.keyUp('Right');147 Framework.Replay.waitFor(11);148 Framework.Replay.keyDown('Down');149 Framework.Replay.waitFor(11);150 Framework.Replay.keyUp('Down');151 Framework.Replay.waitFor(53);152 Framework.Replay.keyDown('Right');153 Framework.Replay.waitFor(11);154 Framework.Replay.keyUp('Right');155 Framework.Replay.waitFor(55);156 Framework.Replay.keyDown('Space');157 Framework.Replay.waitFor(9);158 Framework.Replay.keyUp('Space');159 Framework.Replay.waitFor(10);160 Framework.Replay.keyDown('Right');161 Framework.Replay.waitFor(9);162 Framework.Replay.keyUp('Right');163 Framework.Replay.waitFor(13);164 Framework.Replay.keyDown('Right');165 Framework.Replay.waitFor(13);166 Framework.Replay.keyUp('Right');167 Framework.Replay.waitFor(95);168 Framework.Replay.keyDown('Left');169 Framework.Replay.waitFor(11);170 Framework.Replay.keyUp('Left');171 Framework.Replay.waitFor(57);172 Framework.Replay.keyDown('Down');173 Framework.Replay.waitFor(9);174 Framework.Replay.keyUp('Down');175 Framework.Replay.waitFor(14);176 Framework.Replay.keyDown('Down');177 Framework.Replay.waitFor(11);178 Framework.Replay.keyUp('Down');179 Framework.Replay.waitFor(29);180 Framework.Replay.keyDown('Space');181 Framework.Replay.waitFor(15);182 Framework.Replay.keyUp('Space');183 Framework.Replay.waitFor(32);184 Framework.Replay.keyDown('Up');185 Framework.Replay.waitFor(7);186 Framework.Replay.keyUp('Up');187 Framework.Replay.waitFor(16);188 Framework.Replay.keyDown('Up');189 Framework.Replay.waitFor(7);190 Framework.Replay.keyUp('Up');191 Framework.Replay.waitFor(89);192 Framework.Replay.keyDown('Down');193 Framework.Replay.waitFor(11);194 Framework.Replay.keyUp('Down');195 Framework.Replay.waitFor(13);196 Framework.Replay.keyDown('Down');197 Framework.Replay.waitFor(9);198 Framework.Replay.keyUp('Down');199 Framework.Replay.waitFor(17);200 Framework.Replay.keyDown('Down');201 Framework.Replay.waitFor(7);202 Framework.Replay.keyUp('Down');203 Framework.Replay.waitFor(55);204 Framework.Replay.keyDown('Space');205 Framework.Replay.waitFor(15);206 Framework.Replay.keyUp('Space');207 Framework.Replay.waitFor(7);208 Framework.Replay.keyDown('Up');209 Framework.Replay.waitFor(11);210 Framework.Replay.keyUp('Up');211 Framework.Replay.waitFor(15);212 Framework.Replay.keyDown('Right');213 Framework.Replay.waitFor(13);214 Framework.Replay.keyUp('Right');215 Framework.Replay.waitFor(120);216 Framework.Replay.keyDown('Down');217 Framework.Replay.waitFor(7);218 Framework.Replay.keyUp('Down');219 Framework.Replay.waitFor(17);220 Framework.Replay.keyDown('Left');221 Framework.Replay.waitFor(7);222 Framework.Replay.keyUp('Left');223 Framework.Replay.waitFor(47);224 Framework.Replay.keyDown('Down');225 Framework.Replay.waitFor(5);226 Framework.Replay.keyUp('Down');227 Framework.Replay.waitFor(48);228 Framework.Replay.keyDown('Left');229 Framework.Replay.waitFor(7);230 Framework.Replay.keyUp('Left');231 Framework.Replay.waitFor(25);232 Framework.Replay.keyDown('Space');233 Framework.Replay.waitFor(11);234 Framework.Replay.keyUp('Space');235 Framework.Replay.waitFor(15);236 Framework.Replay.keyDown('Right');237 Framework.Replay.waitFor(9);238 Framework.Replay.keyUp('Right');239 Framework.Replay.waitFor(13);240 Framework.Replay.keyDown('Up');241 Framework.Replay.waitFor(7);242 Framework.Replay.keyUp('Up');243 Framework.Replay.waitFor(104);244 Framework.Replay.keyDown('Down');245 Framework.Replay.waitFor(5);246 Framework.Replay.keyUp('Down');247 Framework.Replay.waitFor(27);248 Framework.Replay.keyDown('Left');249 Framework.Replay.waitFor(3);250 Framework.Replay.keyUp('Left');251 Framework.Replay.waitFor(43);252 Framework.Replay.keyDown('Left');253 Framework.Replay.waitFor(5);254 Framework.Replay.keyUp('Left');255 Framework.Replay.waitFor(221);256 replay.assertEqual("map.player1.bombPower", 2);257 Framework.Replay.waitFor(37);258 Framework.Replay.keyDown('Right');259 Framework.Replay.waitFor(5);260 Framework.Replay.keyUp('Right');261 Framework.Replay.waitFor(5);262 Framework.Replay.keyDown('Right');263 Framework.Replay.waitFor(7);264 Framework.Replay.keyUp('Right');265 Framework.Replay.waitFor(11);266 Framework.Replay.keyDown('Up');267 Framework.Replay.waitFor(6);268 Framework.Replay.keyUp('Up');269 Framework.Replay.waitFor(7);270 Framework.Replay.keyDown('Up');271 Framework.Replay.waitFor(5);272 Framework.Replay.keyUp('Up');273 Framework.Replay.waitFor(8);274 Framework.Replay.keyDown('Up');275 Framework.Replay.waitFor(5);276 Framework.Replay.keyUp('Up');277 Framework.Replay.waitFor(9);278 Framework.Replay.keyDown('Up');279 Framework.Replay.waitFor(5);280 Framework.Replay.keyUp('Up');281 Framework.Replay.waitFor(13);282 Framework.Replay.keyDown('Right');283 Framework.Replay.waitFor(7);284 Framework.Replay.keyUp('Right');285 Framework.Replay.waitFor(21);286 Framework.Replay.keyDown('Right');287 Framework.Replay.waitFor(8);288 Framework.Replay.keyUp('Right');289 Framework.Replay.waitFor(15);290 Framework.Replay.keyDown('Space');291 Framework.Replay.waitFor(6);292 Framework.Replay.keyUp('Space');293 Framework.Replay.waitFor(3);294 Framework.Replay.keyDown('Left');295 Framework.Replay.waitFor(7);296 Framework.Replay.keyUp('Left');297 Framework.Replay.waitFor(6);298 Framework.Replay.keyDown('Left');299 Framework.Replay.waitFor(6);300 Framework.Replay.keyUp('Left');301 Framework.Replay.waitFor(5);302 Framework.Replay.keyDown('Up');303 Framework.Replay.waitFor(7);304 Framework.Replay.keyUp('Up');305 Framework.Replay.waitFor(97);306 Framework.Replay.keyDown('Down');307 Framework.Replay.waitFor(5);308 Framework.Replay.keyUp('Down');309 Framework.Replay.waitFor(7);310 Framework.Replay.keyDown('Right');311 Framework.Replay.waitFor(6);312 Framework.Replay.keyUp('Right');313 Framework.Replay.waitFor(7);314 Framework.Replay.keyDown('Right');315 Framework.Replay.waitFor(8);316 Framework.Replay.keyUp('Right');317 Framework.Replay.waitFor(18);318 Framework.Replay.keyDown('Right');319 Framework.Replay.waitFor(9);320 Framework.Replay.keyUp('Right');321 Framework.Replay.waitFor(15);322 Framework.Replay.keyDown('Space');323 Framework.Replay.waitFor(5);324 Framework.Replay.keyUp('Space');325 Framework.Replay.waitFor(3);326 Framework.Replay.keyDown('Left');327 Framework.Replay.waitFor(5);328 Framework.Replay.keyUp('Left');329 Framework.Replay.waitFor(7);330 Framework.Replay.keyDown('Up');331 Framework.Replay.waitFor(6);332 Framework.Replay.keyUp('Up');333 Framework.Replay.waitFor(6);334 Framework.Replay.keyDown('Up');335 Framework.Replay.waitFor(7);336 Framework.Replay.keyUp('Up');337 Framework.Replay.waitFor(91);338 Framework.Replay.keyDown('Down');339 Framework.Replay.waitFor(6);340 Framework.Replay.keyUp('Down');341 Framework.Replay.waitFor(9);342 Framework.Replay.keyDown('Down');343 Framework.Replay.waitFor(4);344 Framework.Replay.keyUp('Down');345 Framework.Replay.waitFor(8);346 Framework.Replay.keyDown('Right');347 Framework.Replay.waitFor(42);348 Framework.Replay.keyUp('Right');349 Framework.Replay.waitFor(6);350 Framework.Replay.keyDown('Space');351 Framework.Replay.waitFor(7);352 Framework.Replay.keyUp('Space');353 Framework.Replay.waitFor(5);354 Framework.Replay.keyDown('Left');355 Framework.Replay.waitFor(5);356 Framework.Replay.keyUp('Left');357 Framework.Replay.waitFor(9);358 Framework.Replay.keyDown('Left');359 Framework.Replay.waitFor(4);360 Framework.Replay.keyUp('Left');361 Framework.Replay.keyDown('Up');362 Framework.Replay.waitFor(11);363 Framework.Replay.keyUp('Up');364 Framework.Replay.waitFor(90);365 Framework.Replay.keyDown('Down');366 Framework.Replay.waitFor(4);367 Framework.Replay.keyUp('Down');368 Framework.Replay.waitFor(8);369 Framework.Replay.keyDown('Right');370 Framework.Replay.waitFor(40);371 Framework.Replay.keyUp('Right');372 Framework.Replay.waitFor(7);373 Framework.Replay.keyDown('Space');374 Framework.Replay.waitFor(8);375 Framework.Replay.keyUp('Space');376 Framework.Replay.waitFor(5);377 Framework.Replay.keyDown('Up');378 Framework.Replay.waitFor(5);379 Framework.Replay.keyUp('Up');380 Framework.Replay.waitFor(8);381 Framework.Replay.keyDown('Up');382 Framework.Replay.waitFor(8);383 Framework.Replay.keyUp('Up');384 Framework.Replay.waitFor(13);385 Framework.Replay.keyDown('Left');386 Framework.Replay.waitFor(5);387 Framework.Replay.keyUp('Left');388 Framework.Replay.waitFor(79);389 Framework.Replay.keyDown('Right');390 Framework.Replay.waitFor(7);391 Framework.Replay.keyUp('Right');392 Framework.Replay.waitFor(8);393 Framework.Replay.keyDown('Down');394 Framework.Replay.waitFor(6);395 Framework.Replay.keyUp('Down');396 Framework.Replay.waitFor(7);397 Framework.Replay.keyDown('Down');398 Framework.Replay.waitFor(4);399 Framework.Replay.keyUp('Down');400 Framework.Replay.waitFor(11);401 Framework.Replay.keyDown('Right');402 Framework.Replay.waitFor(37);403 Framework.Replay.keyUp('Right');404 Framework.Replay.waitFor(7);405 Framework.Replay.keyDown('Space');406 Framework.Replay.waitFor(6);407 Framework.Replay.keyUp('Space');408 Framework.Replay.waitFor(2);409 Framework.Replay.keyDown('Left');410 Framework.Replay.waitFor(5);411 Framework.Replay.keyUp('Left');412 Framework.Replay.waitFor(6);413 Framework.Replay.keyDown('Left');414 Framework.Replay.waitFor(7);415 Framework.Replay.keyUp('Left');416 Framework.Replay.waitFor(6);417 Framework.Replay.keyDown('Left');418 Framework.Replay.waitFor(7);419 Framework.Replay.keyUp('Left');420 Framework.Replay.waitFor(140);421 Framework.Replay.keyDown('Right');422 Framework.Replay.waitFor(33);423 Framework.Replay.keyUp('Right');424 Framework.Replay.waitFor(90);425 replay.assertEqual("map.player1.maxBombNum", 2);426 Framework.Replay.waitFor(55);427 Framework.Replay.keyDown('Space');428 Framework.Replay.waitFor(5);429 Framework.Replay.keyUp('Space');430 Framework.Replay.waitFor(4);431 Framework.Replay.keyDown('Left');432 Framework.Replay.waitFor(5);433 Framework.Replay.keyUp('Left');434 Framework.Replay.waitFor(7);435 Framework.Replay.keyDown('Space');436 Framework.Replay.waitFor(6);437 Framework.Replay.keyUp('Space');438 Framework.Replay.waitFor(16);439 Framework.Replay.keyDown('Left');440 Framework.Replay.waitFor(5);441 Framework.Replay.keyUp('Left');442 Framework.Replay.waitFor(6);443 Framework.Replay.keyDown('Left');444 Framework.Replay.waitFor(6);445 Framework.Replay.keyUp('Left');446 Framework.Replay.waitFor(6);447 Framework.Replay.keyDown('Left');448 Framework.Replay.waitFor(5);449 Framework.Replay.keyUp('Left');450 Framework.Replay.waitFor(7);451 Framework.Replay.keyDown('Left');452 Framework.Replay.waitFor(6);453 Framework.Replay.keyUp('Left');454 Framework.Replay.waitFor(35);455 Framework.Replay.keyDown('Space');456 Framework.Replay.waitFor(7);457 Framework.Replay.keyUp('Space');458 Framework.Replay.waitFor(5);459 Framework.Replay.keyDown('Left');460 Framework.Replay.waitFor(5);461 Framework.Replay.keyUp('Left');462 Framework.Replay.waitFor(18);463 Framework.Replay.keyDown('Space');464 Framework.Replay.waitFor(6);465 Framework.Replay.keyUp('Space');466 Framework.Replay.waitFor(12);467 Framework.Replay.keyDown('Left');468 Framework.Replay.waitFor(5);469 Framework.Replay.keyUp('Left');470 Framework.Replay.waitFor(7);471 Framework.Replay.keyDown('Left');472 Framework.Replay.waitFor(5);473 Framework.Replay.keyUp('Left');474 Framework.Replay.waitFor(7);475 Framework.Replay.keyDown('Left');476 Framework.Replay.waitFor(5);477 Framework.Replay.keyUp('Left');478 Framework.Replay.waitFor(6);479 Framework.Replay.keyDown('Left');480 Framework.Replay.waitFor(7);481 Framework.Replay.keyUp('Left');482 Framework.Replay.waitFor(6);483 Framework.Replay.keyDown('Left');484 Framework.Replay.waitFor(6);485 Framework.Replay.keyUp('Left');486 Framework.Replay.waitFor(6);487 Framework.Replay.keyDown('Left');488 Framework.Replay.waitFor(6);489 Framework.Replay.keyUp('Left');490 Framework.Replay.waitFor(46);491 Framework.Replay.keyDown('Right');492 Framework.Replay.waitFor(6);493 Framework.Replay.keyUp('Right');494 Framework.Replay.waitFor(7);495 Framework.Replay.keyDown('Right');496 Framework.Replay.waitFor(7);497 Framework.Replay.keyUp('Right');498 Framework.Replay.waitFor(7);499 Framework.Replay.keyDown('Right');500 Framework.Replay.waitFor(5);501 Framework.Replay.keyUp('Right');502 Framework.Replay.waitFor(7);503 Framework.Replay.keyDown('Right');504 Framework.Replay.waitFor(6);505 Framework.Replay.keyUp('Right');506 Framework.Replay.waitFor(7);507 Framework.Replay.keyDown('Right');508 Framework.Replay.waitFor(6);509 Framework.Replay.keyUp('Right');510 Framework.Replay.waitFor(8);511 Framework.Replay.keyDown('Right');512 Framework.Replay.waitFor(8);513 Framework.Replay.keyUp('Right');514 Framework.Replay.waitFor(34);515 Framework.Replay.keyDown('Down');516 Framework.Replay.waitFor(2);517 Framework.Replay.keyUp('Down');518 Framework.Replay.waitFor(78);519 replay.assertEqual("map.stopMonster", true);520 Framework.Replay.waitFor(45);521 Framework.Replay.keyDown('Up');522 Framework.Replay.waitFor(2);523 Framework.Replay.keyUp('Up');524 Framework.Replay.waitFor(9);525 Framework.Replay.keyDown('Right');526 Framework.Replay.waitFor(36);527 Framework.Replay.keyUp('Right');528 Framework.Replay.waitFor(7);529 Framework.Replay.keyDown('Up');530 Framework.Replay.waitFor(6);531 Framework.Replay.keyUp('Up');532 Framework.Replay.waitFor(7);533 Framework.Replay.keyDown('Up');534 Framework.Replay.waitFor(6);535 Framework.Replay.keyUp('Up');536 Framework.Replay.waitFor(21);537 Framework.Replay.keyDown('Space');538 Framework.Replay.waitFor(5);539 Framework.Replay.keyUp('Space');540 Framework.Replay.waitFor(6);541 Framework.Replay.keyDown('Down');542 Framework.Replay.waitFor(5);543 Framework.Replay.keyUp('Down');544 Framework.Replay.waitFor(7);545 Framework.Replay.keyDown('Down');546 Framework.Replay.waitFor(6);547 Framework.Replay.keyUp('Down');548 Framework.Replay.waitFor(6);549 Framework.Replay.keyDown('Down');550 Framework.Replay.waitFor(6);551 Framework.Replay.keyUp('Down');552 Framework.Replay.waitFor(5);553 Framework.Replay.keyDown('Left');554 Framework.Replay.waitFor(6);555 Framework.Replay.keyUp('Left');556 Framework.Replay.waitFor(8);557 Framework.Replay.keyDown('Left');558 Framework.Replay.waitFor(4);559 Framework.Replay.keyUp('Left');560 Framework.Replay.waitFor(10);561 Framework.Replay.keyDown('Down');562 Framework.Replay.waitFor(6);563 Framework.Replay.keyUp('Down');564 Framework.Replay.waitFor(7);565 Framework.Replay.keyDown('Down');566 Framework.Replay.waitFor(7);567 Framework.Replay.keyUp('Down');568 Framework.Replay.waitFor(7);569 Framework.Replay.keyDown('Down');570 Framework.Replay.waitFor(6);571 Framework.Replay.keyUp('Down');572 Framework.Replay.waitFor(12);573 Framework.Replay.keyDown('Space');574 Framework.Replay.waitFor(5);575 Framework.Replay.keyUp('Space');576 Framework.Replay.waitFor(6);577 Framework.Replay.keyDown('Up');578 Framework.Replay.waitFor(6);579 Framework.Replay.keyUp('Up');580 Framework.Replay.waitFor(6);581 Framework.Replay.keyDown('Up');582 Framework.Replay.waitFor(6);583 Framework.Replay.keyUp('Up');584 Framework.Replay.waitFor(6);585 Framework.Replay.keyDown('Up');586 Framework.Replay.waitFor(8);587 Framework.Replay.keyUp('Up');588 Framework.Replay.waitFor(5);589 Framework.Replay.keyDown('Left');590 Framework.Replay.waitFor(7);591 Framework.Replay.keyUp('Left');592 Framework.Replay.waitFor(15);593 Framework.Replay.keyDown('Left');594 Framework.Replay.waitFor(5);595 Framework.Replay.keyUp('Left');596 Framework.Replay.waitFor(25);597 Framework.Replay.keyDown('Space');598 Framework.Replay.waitFor(5);599 Framework.Replay.keyUp('Space');600 Framework.Replay.waitFor(10);601 Framework.Replay.keyDown('Left');602 Framework.Replay.waitFor(4);603 Framework.Replay.keyUp('Left');604 Framework.Replay.waitFor(7);605 Framework.Replay.keyDown('Left');606 Framework.Replay.waitFor(4);607 Framework.Replay.keyUp('Left');608 Framework.Replay.waitFor(7);609 Framework.Replay.keyDown('Left');610 Framework.Replay.waitFor(5);611 Framework.Replay.keyUp('Left');612 Framework.Replay.waitFor(7);613 Framework.Replay.keyDown('Left');614 Framework.Replay.waitFor(5);615 Framework.Replay.keyUp('Left');616 Framework.Replay.waitFor(6);617 Framework.Replay.keyDown('Left');618 Framework.Replay.waitFor(5);619 Framework.Replay.keyUp('Left');620 Framework.Replay.waitFor(7);621 Framework.Replay.keyDown('Left');622 Framework.Replay.waitFor(5);623 Framework.Replay.keyUp('Left');624 Framework.Replay.waitFor(7);625 Framework.Replay.keyDown('Left');626 Framework.Replay.waitFor(5);627 Framework.Replay.keyUp('Left');628 Framework.Replay.waitFor(9);629 Framework.Replay.keyDown('Down');630 Framework.Replay.waitFor(5);631 Framework.Replay.keyUp('Down');632 Framework.Replay.waitFor(11);633 Framework.Replay.keyDown('Right');634 Framework.Replay.waitFor(5);635 Framework.Replay.keyUp('Right');636 Framework.Replay.waitFor(8);637 Framework.Replay.keyDown('Down');638 Framework.Replay.waitFor(4);639 Framework.Replay.keyUp('Down');640 Framework.Replay.waitFor(5);641 Framework.Replay.keyDown('Down');642 Framework.Replay.waitFor(8);643 Framework.Replay.keyUp('Down');644 Framework.Replay.waitFor(20);645 Framework.Replay.keyDown('Space');646 Framework.Replay.waitFor(5);647 Framework.Replay.keyUp('Space');648 Framework.Replay.waitFor(6);649 Framework.Replay.keyDown('Up');650 Framework.Replay.waitFor(3);651 Framework.Replay.keyUp('Up');652 Framework.Replay.waitFor(7);653 Framework.Replay.keyDown('Up');654 Framework.Replay.waitFor(7);655 Framework.Replay.keyUp('Up');656 Framework.Replay.waitFor(6);657 Framework.Replay.keyDown('Left');658 Framework.Replay.waitFor(8);659 Framework.Replay.keyUp('Left');660 Framework.Replay.waitFor(6);661 Framework.Replay.keyDown('Left');662 Framework.Replay.waitFor(4);663 Framework.Replay.keyUp('Left');664 Framework.Replay.waitFor(12);665 Framework.Replay.keyDown('Down');666 Framework.Replay.waitFor(5);667 Framework.Replay.keyUp('Down');668 Framework.Replay.waitFor(7);669 Framework.Replay.keyDown('Down');670 Framework.Replay.waitFor(5);671 Framework.Replay.keyUp('Down');672 Framework.Replay.waitFor(7);673 Framework.Replay.keyDown('Down');674 Framework.Replay.waitFor(5);675 Framework.Replay.keyUp('Down');676 Framework.Replay.waitFor(8);677 Framework.Replay.keyDown('Down');678 Framework.Replay.waitFor(4);679 Framework.Replay.keyUp('Down');680 Framework.Replay.waitFor(7);681 Framework.Replay.keyDown('Down');682 Framework.Replay.waitFor(4);683 Framework.Replay.keyUp('Down');684 Framework.Replay.waitFor(7);685 Framework.Replay.keyDown('Down');686 Framework.Replay.waitFor(5);687 Framework.Replay.keyUp('Down');688 Framework.Replay.waitFor(24);689 Framework.Replay.keyDown('Space');690 Framework.Replay.waitFor(4);691 Framework.Replay.keyUp('Space');692 Framework.Replay.waitFor(5);693 Framework.Replay.keyDown('Up');694 Framework.Replay.waitFor(4);695 Framework.Replay.keyUp('Up');696 Framework.Replay.waitFor(8);697 Framework.Replay.keyDown('Up');698 Framework.Replay.waitFor(4);699 Framework.Replay.keyUp('Up');700 Framework.Replay.waitFor(6);701 Framework.Replay.keyDown('Up');702 Framework.Replay.waitFor(36);703 Framework.Replay.keyUp('Up');704 Framework.Replay.waitFor(11);705 Framework.Replay.keyDown('Right');706 Framework.Replay.waitFor(127);707 Framework.Replay.keyUp('Right');708 Framework.Replay.waitFor(5);709 Framework.Replay.keyDown('Down');710 Framework.Replay.waitFor(5);711 Framework.Replay.keyUp('Down');712 Framework.Replay.waitFor(7);713 Framework.Replay.keyDown('Down');714 Framework.Replay.waitFor(6);715 Framework.Replay.keyUp('Down');716 Framework.Replay.waitFor(7);717 Framework.Replay.keyDown('Down');718 Framework.Replay.waitFor(5);719 Framework.Replay.keyUp('Down');720 Framework.Replay.waitFor(19);721 Framework.Replay.keyDown('Space');722 Framework.Replay.waitFor(5);723 Framework.Replay.keyUp('Space');724 Framework.Replay.waitFor(5);725 Framework.Replay.keyDown('Up');726 Framework.Replay.waitFor(3);727 Framework.Replay.keyUp('Up');728 Framework.Replay.waitFor(8);729 Framework.Replay.keyDown('Up');730 Framework.Replay.waitFor(5);731 Framework.Replay.keyUp('Up');732 Framework.Replay.waitFor(8);733 Framework.Replay.keyDown('Up');734 Framework.Replay.waitFor(6);735 Framework.Replay.keyUp('Up');736 Framework.Replay.waitFor(7);737 Framework.Replay.keyDown('Left');738 Framework.Replay.waitFor(6);739 Framework.Replay.keyUp('Left');740 Framework.Replay.waitFor(79);741 Framework.Replay.keyDown('Right');742 Framework.Replay.waitFor(6);743 Framework.Replay.keyUp('Right');744 Framework.Replay.waitFor(6);745 Framework.Replay.keyDown('Down');746 Framework.Replay.waitFor(5);747 Framework.Replay.keyUp('Down');748 Framework.Replay.waitFor(5);749 Framework.Replay.keyDown('Down');750 Framework.Replay.waitFor(5);751 Framework.Replay.keyUp('Down');752 Framework.Replay.waitFor(7);753 Framework.Replay.keyDown('Down');754 Framework.Replay.waitFor(5);755 Framework.Replay.keyUp('Down');756 Framework.Replay.waitFor(6);757 Framework.Replay.keyDown('Down');758 Framework.Replay.waitFor(5);759 Framework.Replay.keyUp('Down');760 Framework.Replay.waitFor(7);761 Framework.Replay.keyDown('Down');762 Framework.Replay.waitFor(6);763 Framework.Replay.keyUp('Down');764 Framework.Replay.waitFor(10);765 Framework.Replay.keyDown('Space');766 Framework.Replay.waitFor(5);767 Framework.Replay.keyUp('Space');768 Framework.Replay.waitFor(9);769 Framework.Replay.keyDown('Up');770 Framework.Replay.waitFor(3);771 Framework.Replay.keyUp('Up');772 Framework.Replay.waitFor(7);773 Framework.Replay.keyDown('Up');774 Framework.Replay.waitFor(6);775 Framework.Replay.keyUp('Up');776 Framework.Replay.waitFor(6);777 Framework.Replay.keyDown('Up');778 Framework.Replay.waitFor(5);779 Framework.Replay.keyUp('Up');780 Framework.Replay.waitFor(7);781 Framework.Replay.keyDown('Up');782 Framework.Replay.waitFor(4);783 Framework.Replay.keyUp('Up');784 Framework.Replay.waitFor(7);785 Framework.Replay.keyDown('Up');786 Framework.Replay.waitFor(7);787 Framework.Replay.keyUp('Up');788 Framework.Replay.waitFor(206);789 replay.assertEqual("map.monster[0].isdead", true);790 replay.assertEqual("map.monster[1].isdead", true);791 replay.assertEqual("map.monster[2].isdead", true);792 replay.assertEqual("map.monster[3].isdead", true);793 replay.assertEqual("map.monster[4].isdead", true);794 replay.assertEqual("map.monster[5].isdead", true);795 replay.assertEqual("map.score._score", 5700); ...

Full Screen

Full Screen

x2many.js

Source:x2many.js Github

copy

Full Screen

1odoo.define('web.test.x2many', function (require) {2'use strict';3var Tour = require('web.Tour');4var inc;5Tour.register({6 id: 'widget_x2many',7 name: "one2many and many2many checks",8 mode: 'test',9 path: '/web#action=test_new_api.action_discussions',10 steps: [11 {12 title: "wait web client",13 waitFor: '.oe-view-title:contains(Discussions)'14 },15 // create test discussion16 {17 title: "create new discussion",18 element: 'button.o_list_button_add'19 },20 {21 title: "insert title",22 element: '.oe_form_required input',23 sampleText: 'test'24 },25 // try to add a user with one2many form26 {27 title: "click on moderator one2many drop down",28 waitFor: '.oe_form_required input:propValue(test)',29 element: 'tr:contains(Moderator) .oe_m2o_drop_down_button'30 },31 {32 title: "click on 'Create and Edit...'",33 element: '.oe_m2o_dropdown_option:last'34 },35 {36 title: "insert a name into the modal form",37 element: '.modal .oe_form_field.oe_form_required:first input',38 sampleText: 'user_test',39 onload: function () {40 inc = new Date().getTime();41 this.sampleText = 'user_test_' + inc;42 }43 },44 {45 title: "insert an email into the modal form",46 waitFor: '.modal .oe_form_field.oe_form_required input:propValueContains(user_test)',47 element: '.modal .oe_form_field.oe_form_required:eq(1) input',48 sampleText: 'user_test@test',49 onload: function () {50 this.sampleText = 'user_test_' + inc + '@test';51 }52 },53 {54 title: "save the modal content and create the new moderator",55 waitFor: '.modal .oe_form_field.oe_form_required input:propValueContains(@test)',56 element: '.modal .o_formdialog_save',57 },58 {59 title: "check if the modal is saved",60 waitFor: 'tr:contains(Moderator) .oe_form_field_many2one input:propValueContains(user_test)',61 },62 {63 title: "check the onchange from the o2m to the m2m",64 waitFor: '.tab-pane:last tr:has(.oe_list_field_cell):not(:has(.oe_list_record_selector)):contains(user_test)',65 },66 // add ourself as participant67 {68 title: "change tab to Participants",69 element: '[data-toggle="tab"]:contains(Participants)'70 },71 {72 title: "click to add participants",73 element: '.tab-pane:eq(2).active .oe_form_field_x2many_list_row_add a'74 },75 {76 title: "select Admin",77 element: '.modal .oe_list_content tr:has(td[data-field="name"]:containsExact(Administrator)) .oe_list_record_selector input[type="checkbox"]'78 },79 {80 title: "save selected participants",81 waitFor: '.modal .oe_list_content tr:has(td[data-field="name"]:containsExact(Administrator)) .oe_list_record_selector input[type="checkbox"]:propChecked',82 element: '.o_selectcreatepopup_search_select'83 },84 // save85 {86 title: "save discussion",87 waitFor: '.oe_form_field_many2many tbody tr td.oe_list_field_char:containsExact(Administrator)',88 element: 'button.oe_form_button_save'89 },90 // edit91 {92 title: "edit discussion",93 element: 'button.oe_form_button_edit'94 },95 // add message a96 {97 title: "Select First Tab",98 element: 'a[role=tab]:first',99 },100 {101 title: "create new message a",102 element: '.oe_form_field_x2many_list_row_add:first a'103 },104 {105 title: "insert body a",106 element: '.modal textarea.field_text',107 sampleText: 'a'108 },109 {110 title: "save new message a",111 waitFor: '.modal textarea.field_text:propValue(a)',112 element: '.o_formdialog_save'113 },114 // add message b115 {116 title: "create new message b",117 waitNot: '.modal',118 waitFor: '.oe_application:has(.oe_list_field_cell):has(textarea[name="message_concat"]:propValue([test] Administrator:a))',119 element: '.oe_form_field_x2many_list_row_add:first a'120 },121 {122 title: "insert body b",123 element: '.modal textarea.field_text',124 sampleText: 'b'125 },126 {127 title: "save new message b",128 waitFor: '.modal textarea.field_text:propValue(b)',129 element: '.o_formdialog_save'130 },131 // change title to trigger on change132 {133 title: "insert title",134 waitNot: '.modal',135 waitFor: 'textarea[name="message_concat"]:propValue([test] Administrator:a\n[test] Administrator:b)',136 element: '.oe_form_required input',137 sampleText: 'test_trigger'138 },139 {140 title: "blur the title field",141 waitFor: '.oe_form_required input:propValue(test_trigger)',142 element: '.oe_form_field_many2one input:first',143 },144 {145 title: "check onchange",146 waitFor: 'textarea[name="message_concat"]:propValue([test_trigger] Administrator:a\n[test_trigger] Administrator:b)',147 },148 // change message b149 150 {151 title: "edit message b",152 waitFor: '.tab-pane:first tr:has(.oe_list_field_cell):not(:has(.oe_list_record_selector)):eq(1) .oe_list_field_cell:contains([test_trigger] )',153 waitNot: '.tab-pane:first tr:has(.oe_list_field_cell):not(:has(.oe_list_record_selector)):eq(2)',154 element: '.oe_list_field_cell:containsExact(b)'155 },156 {157 title: "change the body",158 element: '.modal textarea.field_text',159 sampleText: 'bbb'160 },161 {162 title: "save changes",163 waitFor: '.modal textarea.field_text:propValue(bbb)',164 element: '.o_formdialog_save'165 },166 // add message c167 {168 title: "create new message c",169 waitNot: '.modal',170 waitFor: 'textarea[name="message_concat"]:propValue([test_trigger] Administrator:a\n[test_trigger] Administrator:bbb)',171 element: '.oe_form_field_x2many_list_row_add:first a'172 },173 {174 title: "insert body",175 element: '.modal textarea.field_text',176 sampleText: 'c'177 },178 {179 title: "save new message c",180 waitFor: '.modal textarea.field_text:propValue(c)',181 element: '.o_formdialog_save'182 },183 // add participants184 {185 title: "change tab to Participants",186 waitNot: '.modal',187 waitFor: '.oe_form_field_one2many .oe_list_field_cell:eq(3)',188 element: '[data-toggle="tab"]:contains(Participants)'189 },190 {191 title: "click to add participants",192 element: '.tab-pane:eq(2).active .oe_form_field_x2many_list_row_add a'193 },194 {195 title: "select Demo User",196 element: '.modal .oe_list_content tr:has(td[data-field="name"]:containsExact(Demo User)) .oe_list_record_selector input[type="checkbox"]'197 },198 {199 title: "save selected participants",200 waitFor: '.modal .oe_list_content tr:has(td[data-field="name"]:containsExact(Demo User)) .oe_list_record_selector input[type="checkbox"]:propChecked',201 element: '.o_selectcreatepopup_search_select'202 },203 // save204 {205 title: "save discussion",206 waitFor: '.oe_form_field_many2many tbody tr:has(.oe_list_field_char):eq(2)',207 waitNot: '.oe_form_field_many2many tbody tr:has(.oe_list_field_char):eq(3)',208 element: 'button.oe_form_button_save'209 },210 // check saved data211 {212 title: "check data 1",213 waitFor: '.oe_form_field_one2many tbody tr:has(.oe_list_field_char):eq(2)',214 waitNot: '.oe_form_field_one2many tbody tr:has(.oe_list_field_char):eq(3)',215 },216 {217 title: "check data 2",218 waitFor: '.oe_form_field_one2many tr:has(.oe_list_field_text:containsExact(bbb)):has(.oe_list_field_char:containsExact([test_trigger] Administrator))',219 },220 {221 title: "check data 3",222 waitFor: '.oe_form_field_many2many tbody tr:has(.oe_list_field_char):eq(2)',223 waitNot: '.oe_form_field_many2many tbody tr:has(.oe_list_field_char):eq(3)',224 },225 // edit226 {227 title: "edit discussion",228 element: 'button.oe_form_button_edit'229 },230 {231 title: "change tab to Messages",232 waitFor: '.oe_form_editable',233 element: '[data-toggle="tab"]:contains(Messages)'234 },235 // add message d236 {237 title: "create new message d",238 waitFor: 'li.active a[data-toggle="tab"]:contains(Messages)',239 element: '.oe_form_field_x2many_list_row_add:first a'240 },241 {242 title: "insert body",243 element: '.modal textarea.field_text',244 sampleText: 'd'245 },246 {247 title: "save new message d",248 waitFor: '.modal textarea.field_text:propValue(d)',249 element: '.o_formdialog_save'250 },251 // add message e252 {253 title: "create new message e",254 waitNot: '.modal',255 waitFor: '.oe_list_field_cell:containsExact(d)',256 element: '.oe_form_field_x2many_list_row_add:first a'257 },258 {259 title: "insert body",260 element: '.modal textarea.field_text',261 sampleText: 'e'262 },263 {264 title: "save new message e",265 waitFor: '.modal textarea.field_text:propValue(e)',266 element: '.o_formdialog_save'267 },268 // change message a269 {270 title: "edit message a",271 waitNot: '.modal',272 waitFor: '.oe_list_field_cell:containsExact(e)',273 element: '.oe_list_field_cell:containsExact(a)'274 },275 {276 title: "change the body",277 element: '.modal textarea.field_text',278 sampleText: 'aaa'279 },280 {281 title: "save changes",282 waitFor: '.modal textarea.field_text:propValue(aaa)',283 element: '.o_formdialog_save'284 },285 // change message e286 {287 title: "edit message e",288 waitNot: '.modal',289 waitFor: '.oe_list_field_text:contains(aaa)',290 element: '.oe_list_field_cell:containsExact(e)'291 },292 {293 title: "open the many2one to select an other user",294 element: '.modal .oe_m2o_drop_down_button',295 },296 {297 title: "select an other user",298 element: '.ui-autocomplete li:contains(Demo User)',299 },300 {301 title: "test one2many's line onchange after many2one",302 waitFor: '.oe_form_char_content:contains([test_trigger] Demo User)',303 },304 {305 title: "test one2many field not triggered onchange",306 waitFor: 'textarea[name="message_concat"]:propValueContains([test_trigger] Administrator:e)',307 },308 {309 title: "save changes",310 element: '.o_formdialog_save'311 },312 {313 title: "test one2many triggered the onchange on save for the line",314 waitFor: '.oe_list_content td.oe_list_field_cell.oe_readonly:contains([test_trigger] Demo User)',315 },316 {317 title: "test one2many triggered the onchange on save",318 waitFor: 'textarea[name="message_concat"]:propValueContains([test_trigger] Demo User:e)',319 },320 // remove321 {322 title: "remove b",323 waitNot: '.modal',324 waitFor: '.oe_list_field_text:contains(aaa)',325 element: 'tr:has(.oe_list_field_cell:containsExact(bbb)) .oe_list_record_delete'326 },327 {328 title: "remove e",329 waitNot: 'tr:has(.oe_list_field_cell:containsExact(bbb))',330 element: 'tr:has(.oe_list_field_cell:containsExact(e)) .oe_list_record_delete'331 },332 // save333 {334 title: "save discussion",335 waitNot: 'tr:has(.oe_list_field_cell:containsExact(e))',336 element: 'button.oe_form_button_save'337 },338 // check saved data339 {340 title: "check data 4",341 waitNot: '.oe_form_field_one2many tbody tr:has(.oe_list_field_char):eq(4)',342 },343 {344 title: "check data 5",345 waitFor: 'body:has(.oe_list_field_text:containsExact(aaa)):has(.oe_list_field_text:containsExact(c)):has(.oe_list_field_text:containsExact(d))',346 },347 {348 title: "check data 6",349 waitFor: '.oe_form_field_one2many tr:has(.oe_list_field_text:containsExact(aaa)):has(.oe_list_field_char:containsExact([test_trigger] Administrator))',350 },351 {352 title: "check data 7",353 waitFor: '.oe_form_field_many2many tbody tr:has(.oe_list_field_char):eq(2)',354 waitNot: '.oe_form_field_many2many tbody tr:has(.oe_list_field_char):eq(3)',355 },356 // edit357 {358 title: "edit discussion",359 element: 'button.oe_form_button_edit'360 },361 // add message ddd362 {363 title: "create new message ddd",364 waitNot: '.modal',365 waitFor: '.oe_list_field_cell:containsExact(d)',366 element: '.oe_form_field_x2many_list_row_add:first a'367 },368 {369 title: "select an other user",370 element: '.modal .oe_m2o_drop_down_button',371 },372 {373 title: "select demo user",374 element: 'li:contains(Demo User)',375 },376 {377 title: "test one2many's line onchange after many2one",378 waitFor: '.oe_form_char_content:contains([test_trigger] Demo User)',379 },380 {381 title: "insert body",382 element: '.modal textarea.field_text',383 sampleText: 'ddd'384 },385 {386 title: "save new message ddd",387 waitFor: '.modal textarea.field_text:propValue(ddd)',388 element: '.o_formdialog_save'389 },390 // trigger onchange391 {392 title: "blur the one2many",393 waitFor: '.oe_list_field_cell:containsExact(ddd)',394 element: '.oe_form_required input',395 },396 // check onchange data397 {398 title: "check data 8",399 waitFor: 'textarea[name="message_concat"]:propValueContains([test_trigger] Administrator:aaa\n[test_trigger] Administrator:c\n[test_trigger] Administrator:d\n[test_trigger] Demo User:ddd)',400 },401 {402 title: "check data 9",403 waitFor: '.oe_form_field_one2many tbody tr:has(.oe_list_field_cell):eq(3)',404 waitNot: '.oe_form_field_one2many tbody tr:has(.oe_list_field_cell):eq(4)',405 },406 // cancel407 {408 title: "cancel change",409 waitFor: '.oe_list_field_cell:containsExact(ddd)',410 element: 'button.oe_form_button_cancel',411 onload: function () {412 // remove the window alert (can't click on it with JavaScript tour)413 $('.oe_form_dirty').removeClass('oe_form_dirty');414 }415 },416 /////////////////////////////////////////////////////////////////////////////////////////////417 /////////////////////////////////////////////////////////////////////////////////////////////418 {419 title: "switch to the second form view to test one2many with editable list",420 waitFor: '.oe_list_field_cell:eq(3)',421 element: 'a.oe_menu_leaf:contains(Discussions 2)'422 },423 {424 title: "select previous created record",425 waitFor: '.breadcrumb li:containsExact(Discussions 2)',426 element: 'td[data-field="name"]:contains(test_trigger):last',427 },428 {429 title: "click on edit",430 element: '.oe_form_button_edit',431 },432 {433 title: "edit title",434 waitFor: ".oe_form_editable",435 element: '.oe_form_required:first input',436 sampleText: 'test_trigger2'437 },438 {439 title: "click outside to trigger onchange",440 element: '.oe_form_sheet',441 },442 {443 title: "click on a field of the editable list to edit content",444 waitFor: '.oe_list_editable:contains(test_trigger2)',445 element: '.oe_list_editable tr[data-id]:eq(1) .oe_list_field_cell:eq(2)',446 },447 {448 title: "change text value",449 element: '.oe_form_field[data-fieldname="body"] textarea[name="body"]',450 sampleText: 'ccc'451 },452 {453 title: "click on first field (trigger the line onchange)",454 element: '.oe_list_editable .oe_form_editable .oe_form_field[data-fieldname="name"]',455 },456 {457 title: "test one2many's line onchange",458 waitFor: '.oe_list_editable .oe_form_editable .oe_form_field[data-fieldname="size"]:contains(3)',459 },460 {461 title: "test one2many field not triggered onchange",462 waitNot: 'textarea[name="message_concat"]:propValueContains(ccc)',463 },464 {465 title: "open the many2one to select an other user",466 element: '.oe_list .oe_m2o_drop_down_button',467 },468 {469 title: "select an other user",470 element: '.ui-autocomplete li:contains(Demo User)',471 },472 {473 title: "test one2many's line onchange after many2one",474 waitFor: '.oe_form_char_content:contains([test_trigger2] Demo User)',475 },476 {477 title: "test one2many field not triggered onchange",478 waitNot: 'textarea[name="message_concat"]:propValueContains(ccc)',479 },480 {481 title: "change text value",482 element: '.oe_form_field[data-fieldname="body"] textarea',483 sampleText: 'ccccc'484 },485 // check onchange486 {487 title: "click outside to trigger one2many onchange",488 waitNot: 'textarea[name="message_concat"]:propValueContains(Demo User)',489 element: '.oe_form_required input',490 },491 {492 title: "test one2many onchange",493 waitFor: 'textarea[name="message_concat"]:propValueContains([test_trigger2] Demo User:ccccc)',494 },495 {496 title: "click outside to trigger one2many onchange",497 element: '.o_form_field_many2manytags .oe_m2o_drop_down_button',498 },499 {500 title: "add a tag",501 element: '.ui-autocomplete li:first',502 },503 // remove record504 {505 title: "delete the last item in the editable list",506 element: '.oe_list_record_delete:visible:last',507 },508 {509 title: "test one2many onchange after delete",510 waitNot: 'textarea[name="message_concat"]:propValueContains(Administrator:d)',511 },512 513 // save514 {515 title: "save discussion",516 waitNot: 'tr:has(.oe_list_field_cell:containsExact(e))',517 element: 'button.oe_form_button_save'518 },519 // check saved data520 {521 title: "check data 10",522 waitFor: '.oe_form_text_content:containsExact([test_trigger2] Administrator:aaa\n[test_trigger2] Demo User:ccccc)',523 },524 {525 title: "check data 11",526 waitFor: '.oe_form_field_one2many tbody tr:has(.oe_list_field_cell):eq(1)',527 waitNot: '.oe_form_field_one2many tbody tr:has(.oe_list_field_cell):eq(2)',528 },529 // edit530 {531 title: "edit discussion",532 element: 'button.oe_form_button_edit'533 },534 // add message eee535 {536 title: "create new message eee",537 waitFor: 'li.active a[data-toggle="tab"]:contains(Messages)',538 element: '.oe_form_field_x2many_list_row_add:first a'539 },540 {541 title: "change text value",542 element: '.oe_form_field[data-fieldname="body"] textarea',543 sampleText: 'eee'544 },545 // save 546 {547 title: "save discussion",548 waitFor: '.oe_form_field[data-fieldname="body"] textarea:propValueContains(eee)',549 element: 'button.oe_form_button_save'550 },551 // check saved data552 {553 title: "check data 12",554 waitFor: '.oe_form_text_content:containsExact([test_trigger2] Administrator:aaa\n[test_trigger2] Demo User:ccccc\n[test_trigger2] Administrator:eee)',555 },556 {557 title: "check data 13",558 waitFor: '.oe_form_field_one2many tbody tr:has(.oe_list_field_cell):eq(2)',559 waitNot: '.oe_form_field_one2many tbody tr:has(.oe_list_field_cell):eq(3)',560 },561 ]562});...

Full Screen

Full Screen

Routes.js

Source:Routes.js Github

copy

Full Screen

...112 // Page Layout component wrapper113 <BasePage>114 <Suspense fallback={<PageLoader/>}>115 <Switch location={location}>116 <Route path="/login" component={waitFor(Login)}/>117 <Route path="/register" component={waitFor(Register)}/>118 <Route path="/recover" component={waitFor(Recover)}/>119 <Route path="/lock" component={waitFor(Lock)}/>120 <Route path="/notfound" component={waitFor(NotFound)}/>121 <Route path="/error500" component={waitFor(Error500)}/>122 <Route path="/maintenance" component={waitFor(Maintenance)}/>123 </Switch>124 </Suspense>125 </BasePage>126 )127 }128 else {129 return (130 // Layout component wrapper131 // Use <BaseHorizontal> to change layout132 <Base>133 <TransitionGroup>134 <CSSTransition key={currentKey} timeout={timeout} classNames={animationName} exit={false}>135 <div>136 <Suspense fallback={<PageLoader/>}>137 <Switch location={location}>138 {/* WATTBA */}139 {/*Dashboard*/}140 <Route path="/lessons" component={waitFor(LessonsView)}/>141 <Route path="/lessons-all" component={waitFor(AllLessonsView)}/>142 <Route path="/lesson-detail" component={waitFor(LessonDetailView)}/>143 <Route path="/lesson-author" component={waitFor(AuthorLessonView)}/>144 <Route path="/core-competencies" component={waitFor(CoreCompetenciesView)}/>145 {/*Dashboard*/}146 <Route path="/dashboardv1" component={waitFor(DashboardV1)}/>147 <Route path="/dashboardv2" component={waitFor(DashboardV2)}/>148 <Route path="/dashboardv3" component={waitFor(DashboardV3)}/>149 {/*Widgets*/}150 <Route path="/widgets" component={waitFor(Widgets)}/>151 {/*Elements*/}152 <Route path="/buttons" component={waitFor(Buttons)}/>153 <Route path="/notifications" component={waitFor(Notifications)}/>154 <Route path="/sweetalert" component={waitFor(SweetAlert)}/>155 <Route path="/carousel" component={waitFor(BsCarousel)}/>156 <Route path="/spinners" component={waitFor(Spinner)}/>157 <Route path="/dropdown" component={waitFor(DropdownAnimation)}/>158 <Route path="/nestable" component={waitFor(Nestable)}/>159 <Route path="/sortable" component={waitFor(Sortable)}/>160 <Route path="/cards" component={waitFor(Cards)}/>161 <Route path="/grid" component={waitFor(Grid)}/>162 <Route path="/grid-masonry" component={waitFor(GridMasonry)}/>163 <Route path="/typography" component={waitFor(Typography)}/>164 <Route path="/icons-font" component={waitFor(FontIcons)}/>165 <Route path="/icons-weather" component={waitFor(WeatherIcons)}/>166 <Route path="/colors" component={waitFor(Colors)}/>167 {/*Forms*/}168 <Route path="/form-standard" component={waitFor(FormStandard)}/>169 <Route path="/form-extended" component={waitFor(FormExtended)}/>170 <Route path="/form-validation" component={waitFor(FormValidation)}/>171 <Route path="/form-wizard" component={waitFor(FormWizard)}/>172 <Route path="/form-upload" component={waitFor(FormUpload)}/>173 <Route path="/form-cropper" component={waitFor(FormCropper)}/>174 {/*Charts*/}175 <Route path="/chart-flot" component={waitFor(ChartFlot)}/>176 <Route path="/chart-radial" component={waitFor(ChartRadial)}/>177 <Route path="/chart-chartjs" component={waitFor(ChartChartJS)}/>178 <Route path="/chart-morris" component={waitFor(ChartMorris)}/>179 <Route path="/chart-chartist" component={waitFor(ChartChartist)}/>180 {/*Table*/}181 <Route path="/table-standard" component={waitFor(TableStandard)}/>182 <Route path="/table-extended" component={waitFor(TableExtended)}/>183 <Route path="/table-datatable" component={waitFor(Datatable)}/>184 <Route path="/table-datagrid" component={waitFor(DataGrid)}/>185 {/*Maps*/}186 <Route path="/map-google" component={waitFor(MapsGoogle)}/>187 <Route path="/map-vector" component={waitFor(MapsVector)}/>188 {/*Extras*/}189 <Route path="/mailbox" component={waitFor(Mailbox)}/>190 <Route path="/timeline" component={waitFor(Timeline)}/>191 <Route path="/calendar" component={waitFor(Calendar)}/>192 <Route path="/invoice" component={waitFor(Invoice)}/>193 <Route path="/search" component={waitFor(Search)}/>194 <Route path="/todo" component={waitFor(Todo)}/>195 <Route path="/profile" component={waitFor(Profile)}/>196 <Route path="/ecommerce-orders" component={waitFor(EcommerceOrder)}/>197 <Route path="/ecommerce-order-view" component={waitFor(EcommerceOrderView)}/>198 <Route path="/ecommerce-products" component={waitFor(EcommerceProduct)}/>199 <Route path="/ecommerce-product-view" component={waitFor(EcommerceProductView)}/>200 <Route path="/ecommerce-checkout" component={waitFor(EcommerceCheckout)}/>201 <Route path="/blog-list" component={waitFor(BlogList)}/>202 <Route path="/blog-post" component={waitFor(BlogPost)}/>203 <Route path="/blog-articles" component={waitFor(BlogArticle)}/>204 <Route path="/blog-article-view" component={waitFor(BlogArticleView)}/>205 <Route path="/bug-tracker" component={waitFor(BugTracker)}/>206 <Route path="/contact-details" component={waitFor(ContactDetails)}/>207 <Route path="/contacts" component={waitFor(Contacts)}/>208 <Route path="/faq" component={waitFor(Faq)}/>209 <Route path="/file-manager" component={waitFor(FileManager)}/>210 <Route path="/followers" component={waitFor(Followers)}/>211 <Route path="/help-center" component={waitFor(HelpCenter)}/>212 <Route path="/plans" component={waitFor(Plans)}/>213 <Route path="/project-details" component={waitFor(ProjectDetails)}/>214 <Route path="/projects" component={waitFor(Projects)}/>215 <Route path="/settings" component={waitFor(Settings)}/>216 <Route path="/social-board" component={waitFor(SocialBoard)}/>217 <Route path="/team-viewer" component={waitFor(TeamViewer)}/>218 <Route path="/vote-links" component={waitFor(VoteLinks)}/>219 <Route path="/forum" component={waitFor(ForumHome)}/>220 <Redirect to="/dashboardv1"/>221 </Switch>222 </Suspense>223 </div>224 </CSSTransition>225 </TransitionGroup>226 </Base>227 )228 }229}...

Full Screen

Full Screen

browser_forms.js

Source:browser_forms.js Github

copy

Full Screen

...21function testMouseEvents() {22 // Sending a synthesized event directly on content should not work - we23 // don't want web content to be able to open the form helper without the24 // user consent, so we have to pass through the canvas tile-container25 AsyncTests.waitFor("Test:Click", {}, function(json) {26 is(json.result, false, "Form Assistant should stay closed");27 });28 AsyncTests.waitFor("Test:Focus", { value: "#root" }, function(json) {29 is(json.result, false, "Form Assistant should stay closed");30 });31 AsyncTests.waitFor("Test:FocusRedirect", { value: "*[tabindex='0']" }, function(json) {32 is(json.result, false, "Form Assistant should stay closed");33 testOpenUIWithSyncFocus();34 });35};36function waitForFormAssist(aCallback) {37 messageManager.addMessageListener("FormAssist:Show", function(aMessage) {38 messageManager.removeMessageListener(aMessage.name, arguments.callee);39 setTimeout(function() {40 ok(FormHelperUI._open, "Form Assistant should be open");41 setTimeout(aCallback, 0);42 });43 });44};45function testOpenUIWithSyncFocus() {46 AsyncTests.waitFor("Test:Open", { value: "*[tabindex='0']" }, function(json) {});47 waitForFormAssist(testOpenUI);48};49function testOpenUI() {50 AsyncTests.waitFor("Test:Open", { value: "*[tabindex='0']" }, function(json) {});51 waitForFormAssist(testOpenUIWithFocusRedirect);52};53function testOpenUIWithFocusRedirect() {54 AsyncTests.waitFor("Test:OpenWithFocusRedirect", { value: "*[tabindex='0']" }, function(json) {});55 waitForFormAssist(testShowUIForSelect);56};57function testShowUIForSelect() {58 AsyncTests.waitFor("Test:CanShowUI", { value: "#select"}, function(json) {59 ok(json.result, "canShowUI for select element'");60 });61 AsyncTests.waitFor("Test:CanShowUI", { value: "#select", disabled: true }, function(json) {62 is(json.result, false, "!canShowUI for disabled select element'");63 });64 AsyncTests.waitFor("Test:CanShowUI", { value: "#option"}, function(json) {65 ok(json.result, "canShowUI for option element'");66 });67 AsyncTests.waitFor("Test:CanShowUISelect", { value: "#option", disabled: true }, function(json) {68 is(json.result, false, "!canShowUI for option element with a disabled parent select element'");69 });70 AsyncTests.waitFor("Test:CanShowUI", { value: "#option", disabled: true }, function(json) {71 is(json.result, false, "!canShowUI for disabled option element'");72 testShowUIForElements();73 });74}75function testShowUIForElements() {76 AsyncTests.waitFor("Test:CanShowUI", { value: "*[tabindex='1']" }, function(json) {77 ok(json.result, "canShowUI for input type='text'");78 });79 AsyncTests.waitFor("Test:CanShowUI", { value: "*[tabindex='1']", disabled: true }, function(json) {80 is(json.result, false, "!canShowUI for disabled input type='text'");81 });82 AsyncTests.waitFor("Test:CanShowUI", { value: "*[tabindex='2']" }, function(json) {83 ok(json.result, "canShowUI for input type='password'");84 });85 AsyncTests.waitFor("Test:CanShowUI", { value: "*[tabindex='2']", disabled: true }, function(json) {86 is(json.result, false, "!canShowUI for disabled input type='password'");87 });88 AsyncTests.waitFor("Test:CanShowUI", { value: "*[tabindex='8']" }, function(json) {89 ok(json.result, "canShowUI for contenteditable div");90 });91 AsyncTests.waitFor("Test:CanShowUI", { value: "*[tabindex='8']", disabled: true }, function(json) {92 is(json.result, false, "!canShowUI for disabled contenteditable div");93 });94 AsyncTests.waitFor("Test:CanShowUI", { value: "*[tabindex='3']" }, function(json) {95 is(json.result, false, "!canShowUI for input type='submit'");96 });97 AsyncTests.waitFor("Test:CanShowUI", { value: "*[tabindex='4']" }, function(json) {98 is(json.result, false, "!canShowUI for input type='file'");99 });100 AsyncTests.waitFor("Test:CanShowUI", { value: "*[tabindex='5']" }, function(json) {101 is(json.result, false, "!canShowUI for input button type='submit'");102 });103 AsyncTests.waitFor("Test:CanShowUI", { value: "*[tabindex='6']" }, function(json) {104 is(json.result, false, "!canShowUI for input div@role='button'");105 });106 AsyncTests.waitFor("Test:CanShowUI", { value: "*[tabindex='6']" }, function(json) {107 is(json.result, false, "!canShowUI for input type='image'");108 });109 // Open the Form Helper110 AsyncTests.waitFor("Test:Open", { value: "*[tabindex='1']" }, function(json) {111 ok(json.result, "Form Assistant should be open");112 testTabIndexNavigation();113 });114};115function testTabIndexNavigation() {116 AsyncTests.waitFor("Test:Previous", { value: "*[tabindex='0']" }, function(json) {117 is(json.result, false, "Focus should not have changed");118 });119 AsyncTests.waitFor("Test:Next", { value: "*[tabindex='2']" }, function(json) {120 is(json.result, true, "Focus should be on element with tab-index : 2");121 });122 AsyncTests.waitFor("Test:Previous", { value: "*[tabindex='1']" }, function(json) {123 is(json.result, true, "Focus should be on element with tab-index : 1");124 });125 AsyncTests.waitFor("Test:Next");126 AsyncTests.waitFor("Test:Next");127 AsyncTests.waitFor("Test:Next");128 AsyncTests.waitFor("Test:Next");129 AsyncTests.waitFor("Test:Next");130 AsyncTests.waitFor("Test:Next", { value: "*[tabindex='7']" }, function(json) {131 is(json.result, true, "Focus should be on element with tab-index : 7");132 });133 AsyncTests.waitFor("Test:Next", { value: "*[tabindex='8']" }, function(json) {134 is(json.result, true, "Focus should be on element with tab-index : 8");135 });136 AsyncTests.waitFor("Test:Next", { value: "*[tabindex='0']" }, function(json) {137 is(json.result, true, "Focus should be on element with tab-index : 0");138 });139 let ids = ["next", "select", "dumb", "reset", "checkbox", "radio0", "radio4", "last", "last"];140 for (let i = 0; i < ids.length; i++) {141 let id = ids[i];142 AsyncTests.waitFor("Test:Next", { value: "#" + id }, function(json) {143 is(json.result, true, "Focus should be on element with #id: " + id + "");144 });145 };146 FormHelperUI.hide();147 let container = document.getElementById("content-navigator");148 is(container.hidden, true, "Form Assistant should be close");149 AsyncTests.waitFor("Test:Open", { value: "*[tabindex='0']" }, function(json) {150 ok(FormHelperUI._open, "Form Assistant should be open");151 testFocusChanges();152 });153};154function testFocusChanges() {155 AsyncTests.waitFor("Test:Focus", { value: "*[tabindex='1']" }, function(json) {156 ok(json.result, "Form Assistant should be open");157 });158 AsyncTests.waitFor("Test:Focus", { value: "#select" }, function(json) {159 ok(json.result, "Form Assistant should stay open");160 });161 AsyncTests.waitFor("Test:Focus", { value: "*[type='hidden']" }, function(json) {162 ok(json.result, "Form Assistant should stay open");163 loadNestedIFrames();164 });165}166function loadNestedIFrames() {167 AsyncTests.waitFor("Test:Iframe", { }, function(json) {168 is(json.result, true, "Iframe should have loaded");169 navigateIntoNestedIFrames();170 });171}172function navigateIntoNestedIFrames() {173 AsyncTests.waitFor("Test:IframeOpen", { }, function(json) {174 is(json.result, true, "Form Assistant should have been opened");175 });176 AsyncTests.waitFor("Test:IframePrevious", { value: 0 }, function(json) {177 is(json.result, true, "Focus should not have move");178 });179 AsyncTests.waitFor("Test:IframeNext", { value: 1 }, function(json) {180 is(json.result, true, "Focus should have move");181 });182 AsyncTests.waitFor("Test:IframeNext", { value: 1 }, function(json) {183 is(json.result, true, "Focus should not have move");184 // Close the form assistant185 FormHelperUI.hide();186 // Close our tab when finished187 Browser.closeTab(newTab);188 // We must finalize the tests189 finish();190 });...

Full Screen

Full Screen

Wait.js

Source:Wait.js Github

copy

Full Screen

1/*2Siesta 1.1.83Copyright(c) 2009-2013 Bryntum AB4http://bryntum.com/contact5http://bryntum.com/products/siesta/license6*/7/**8@class Siesta.Test.Action.Wait9@extends Siesta.Test.Action10This action can be included in the `t.chain` call with "wait" or "delay" shortcuts:11 t.chain(12 {13 action : 'wait', // or "delay"14 delay : 1000 // 1 second15 }16 )17Alternatively, for convenience, this action can be included in the chain using "waitFor" config (the "action" property can be omitted):18 t.chain(19 {20 waitFor : 'selector', // or any other waitFor* method name21 args : [ '.x-grid-row' ] // an array of arguments for the specified method22 }23 )24 25 t.chain(26 {27 waitFor : 'rowsVisible', // or any other waitFor* method name28 args : [ grid ] // an array of arguments for the specified method29 }30 )31 32 t.chain(33 {34 waitFor : 'waitForRowsVisible', // full method name is also ok35 args : grid // a single value will be converted to array automatically36 }37 )38 39In the latter case, this action will perform a call to the one of the `waitFor*` methods of the test instance.40The name of the method is computed by prepending the uppercased value of `waitFor` config with the string "waitFor" 41(unless it doesn't already starts with "waitFor").42The arguments for method call can be provided as the "args" array. Any non-array value for "args" will be converted to an array with one element.43* **Note**, that this action will provide a `callback`, `scope`, and `timeout` arguments for `waitFor*` methods - you should not specify them. 44As a special case, the value of `waitFor` config can be a Number or Function - that will trigger the call to {@link Siesta.Test#waitFor} method with provided value:45 t.chain(46 {47 waitFor : 50048 },49 // same as50 {51 waitFor : '',52 args : [ 500 ] 53 },54 {55 waitFor : function () { return document.body.className.match(/someClass/) }56 }57 )58*/59Class('Siesta.Test.Action.Wait', {60 61 isa : Siesta.Test.Action,62 63 has : {64 /**65 * @cfg {Number} delay66 * 67 * A number of milliseconds to wait before continuing.68 */69 delay : 1000,70 71 /**72 * @cfg {Number} timeout73 * 74 * The maximum amount of time to wait for the condition to be fulfilled. Defaults to the {@link Siesta.Test.ExtJS#waitForTimeout} value. 75 */76 timeout : null,77 /**78 * @cfg {Array} args79 * 80 * The array of arguments to pass to waitForXXX method. You should omit the 3 last parameters: callback, scope, timeout. Any non-array value will be converted to 81 * a single-value array. 82 */83 args : null,84 /**85 * @cfg {String} waitFor86 * 87 * The name of the `waitFor` method to call. You can omit the leading "waitFor":88 * 89 t.chain(90 {91 waitFor : 'selector',92 ...93 },94 // same as95 {96 waitFor : 'waitForSelector',97 ...98 }99 )100 * 101 */102 waitFor : null103 },104 105 methods : {106 107 process : function () {108 var waitFor = this.waitFor;109 var test = this.test110 if (test.typeOf(waitFor) === 'Number' || test.typeOf(waitFor) === 'Function') {111 // Caller supplied a function returning true when done waiting or112 // a number of milliseconds to wait for.113 this.args = [ waitFor ];114 waitFor = '';115 }116 117 if (waitFor == null) {118 this.args = [ this.delay ];119 waitFor = '';120 }121 122 if (test.typeOf(this.args) !== "Array") {123 this.args = [ this.args ];124 }125 // also allow full method names126 waitFor = waitFor.replace(/^waitFor/, '')127 var methodName = 'waitFor' + Joose.S.uppercaseFirst(waitFor);128 129 if (!test[methodName]){130 throw 'Could not find a waitFor method named ' + methodName;131 }132 // If using simple waitFor statement, use the object notation to be able to pass a description133 // which gives better debugging help than "Waited too long for condition to be fulfilled".134 if (methodName === 'waitFor') {135 test[methodName]({136 method : this.args[ 0 ],137 callback : this.next,138 scope : test,139 timeout : this.timeout || test.waitForTimeout,140 description : this.desc || ''141 });142 } else {143 test[methodName].apply(test, this.args.concat(this.next, test, this.timeout || test.waitForTimeout));144 }145 }146 }147});148Joose.A.each(['wait', 'delay'], function(name) {149 Siesta.Test.ActionRegistry.registerAction(name, Siesta.Test.Action.Wait);...

Full Screen

Full Screen

PostingView.test.js

Source:PostingView.test.js Github

copy

Full Screen

...25 <Router history={history}>26 <PostingView match={_mockData.eventId} setUser={jest.fn()} />27 </Router>28 );29 await waitFor(() =>30 expect(apiCalls.getSinglePosting).toHaveBeenCalledTimes(1)31 );32 await waitFor(() => expect(apiCalls.getUser).toHaveBeenCalledTimes(1));33 await act(() => Promise.resolve());34 });35 it('should render correctly', async () => {36 const history = createMemoryHistory();37 render(38 <Router history={history}>39 <PostingView match={_mockData.eventId} setUser={jest.fn()} />40 </Router>41 );42 await waitFor(() =>43 expect(screen.getByText('Food Delivery')).toBeInTheDocument()44 );45 await waitFor(() =>46 expect(screen.getByAltText('return-home-button')).toBeInTheDocument()47 );48 await waitFor(() =>49 expect(screen.getByText('Description')).toBeInTheDocument()50 );51 await waitFor(() =>52 expect(53 screen.getByText('Deliver food for a memorial hospital')54 ).toBeInTheDocument()55 );56 await waitFor(() =>57 expect(screen.getByText('Open Positions')).toBeInTheDocument()58 );59 await waitFor(() => expect(screen.getByText('driver')).toBeInTheDocument());60 await waitFor(() =>61 expect(screen.getByText('Open Spots: 2')).toBeInTheDocument()62 );63 await waitFor(() => expect(screen.getByText('cook')).toBeInTheDocument());64 await waitFor(() =>65 expect(screen.getByText('Open Spots: 3')).toBeInTheDocument()66 );67 await waitFor(() =>68 expect(screen.getByText('Sign me up!')).toBeInTheDocument()69 );70 await waitFor(() =>71 expect(screen.getByText('Feb 05 2021')).toBeInTheDocument()72 );73 await waitFor(() =>74 expect(screen.getByText('Organization')).toBeInTheDocument()75 );76 await waitFor(() =>77 expect(screen.getByText('Individual')).toBeInTheDocument()78 );79 await waitFor(() =>80 expect(screen.getByText('Category')).toBeInTheDocument()81 );82 await waitFor(() =>83 expect(screen.getByText('Healthcare')).toBeInTheDocument()84 );85 await waitFor(() =>86 expect(screen.getByText('Location')).toBeInTheDocument()87 );88 await waitFor(() =>89 expect(90 screen.getByText('123 Goose Blv., Denver, CO, 80208')91 ).toBeInTheDocument()92 );93 await waitFor(() =>94 expect(screen.getByText('Duration')).toBeInTheDocument()95 );96 await waitFor(() => expect(screen.getByText(3)).toBeInTheDocument());97 await act(() => Promise.resolve());98 });99 it('should be able to sign up for one job per event and return to postings page', async () => {100 apiCalls.getSinglePosting.mockResolvedValue(_mockData.updatedEvent);101 const history = createMemoryHistory();102 render(103 <Router history={history}>104 <PostingView match={_mockData.eventId} setUser={jest.fn()} />105 </Router>106 );107 await waitFor(() => screen.getByText('driver').click());108 await waitFor(() =>109 screen.getByRole('button', { name: 'Sign me up!' }).click()110 );111 await waitFor(() =>112 expect(screen.getByText('Open Spots: 1')).toBeInTheDocument()113 );114 await waitFor(() =>115 expect(screen.getByText('Sign me up!')).toHaveAttribute('disabled')116 );117 await waitFor(() =>118 expect(119 screen.queryByRole('button', { name: 'Sign me up!' })120 ).not.toBeInTheDocument()121 );122 await waitFor(() =>123 expect(124 screen.getByText('You have already signed up for this event!')125 ).toBeInTheDocument()126 );127 await waitFor(() =>128 userEvent.click(screen.getByAltText('return-home-button'))129 );130 await waitFor(() => expect(history.location.pathname).toBe('/postings'));131 await act(() => Promise.resolve());132 });...

Full Screen

Full Screen

page-hotkeys-mic-first.js

Source:page-hotkeys-mic-first.js Github

copy

Full Screen

...13 async test() {14 await this.createBBBMeeting();15 await this.joinAudioMicrophone();16 await this.page.screenshot({ path: 'screenshots/test-hotkeys-mic-first-0.png' });17 await this.page.waitFor(e.whiteboard);18 await this.page.waitFor(e.options);19 await this.page.waitFor(e.userList);20 await this.page.waitFor(e.toolbox);21 await this.page.waitFor(e.leaveAudio);22 await this.page.waitFor(e.chatButton);23 await this.page.waitFor(e.firstUser);24 await this.page.waitFor(e.screenShare);25 await this.page.waitFor(e.videoMenu);26 await this.page.waitFor(e.actions);27 await this.page.waitFor(e.nextSlide);28 await this.page.waitFor(e.prevSlide);29 // Leave/Join Audio as Listen Only30 await this.elementRemoved(e.alerts);31 await this.page.click(e.title);32 await this.tab(this.tabCounts.audioMic);33 await this.enter();34 await this.enter();35 await this.page.waitFor(e.listenButton);36 await this.tab(3);37 await this.enter();38 await this.elementRemoved(e.audioDialog);39 await helper.sleep(500);40 await this.page.screenshot({ path: 'screenshots/test-hotkeys-mic-first-1.png' });41 // Leave/Join Audio with Microphone42 await this.elementRemoved(e.alerts);43 await this.page.click(e.title);44 await this.tab(this.tabCounts.audioNoMic);45 await this.enter();46 await this.enter();47 await this.page.waitFor(e.microphoneButton);48 await this.tab(2);49 await this.enter();50 await this.page.waitFor(e.echoYes);51 await helper.sleep(500); // Echo test confirmation sometimes fails without this52 await this.tab(1);53 await this.enter();54 await this.elementRemoved(e.audioDialog);55 await helper.sleep(500);56 await this.page.screenshot({ path: 'screenshots/test-hotkeys-mic-first-2.png' });57 }58}...

Full Screen

Full Screen

nthen_test.js

Source:nthen_test.js Github

copy

Full Screen

...6 var lastI = 0;7 var chk = function() { t.equal(i, ++lastI); };8 nThen(function(waitFor) {9 // Obvious path.10 setTimeout(waitFor(function() {11 i++;12 }), 1);13 }).nThen(function(waitFor) {14 // Traditional chained calls should work.15 chk();16 setTimeout(waitFor(function() {17 chk();18 setTimeout(waitFor(function() {19 chk();20 i++;21 }), 1);22 i++;23 }), 1);24 i++;25 }).nThen(function(waitFor) {26 chk();27 i++;28 // no callback should still work29 }).nThen(function(waitFor) {30 chk();31 i++;32 // This will timeout.33 setTimeout(waitFor(function() {34 // never run.35 i = 10000;36 }), 100);37 }).nThen(function(waitFor) {38 t.notOk(1);39 }).nThen(function(waitFor) {40 t.notOk(1);41 }).nThen(function(waitFor) {42 t.notOk(1);43 }).nThen(function(waitFor) {44 t.notOk(1);45 }).orTimeout(function(waitFor) {46 chk();47 setTimeout(waitFor(function() {48 i++;49 }), 1);50 }, 30).nThen(function(waitFor) {51 chk();52 setTimeout(waitFor(function() {53 i++;54 }), 1);55 }).nThen(function(waitFor) {56 chk();57 t.equals(lastI, 8);58 clearTimeout(to);59 t.end();60 });61});62test("no callback first function", function (t) {63 var to = setTimeout(function() {64 t.notOk(1);65 t.end();66 }, 100);...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { waitFor } from '@testing-library/react-hooks'2import { waitForElementToBeRemoved } from '@testing-library/dom'3import { waitForElement } from '@testing-library/dom'4import { waitFor } from '@testing-library/react-hooks'5import { waitForElementToBeRemoved } from '@testing-library/dom'6import { waitForElement } from '@testing-library/dom'7import { waitFor } from '@testing-library/react-hooks'8import { waitForElementToBeRemoved } from '@testing-library/dom'9import { waitForElement } from '@testing-library/dom'10import { waitFor } from '@testing-library/react-hooks'11import { waitForElementToBeRemoved } from '@testing-library/dom'12import { waitForElement } from '@testing-library/dom'13import { waitFor } from '@testing-library/react-hooks'14import { waitForElementToBeRemoved } from '@testing-library/dom'15import { waitForElement } from '@testing-library/dom'16import { waitFor } from '@testing-library/react-hooks'17import { waitForElementToBeRemoved } from '@testing-library/dom'18import { waitForElement } from '@testing-library/dom'19import { waitFor } from '@testing

Full Screen

Using AI Code Generation

copy

Full Screen

1import { waitFor } from '@testing-library/react-hooks';2import { waitForElementToBeRemoved } from '@testing-library/react-hooks';3import { waitForDomChange } from '@testing-library/react-hooks';4import { waitForElement } from '@testing-library/react-hooks';5import { waitForValueToChange } from '@testing-library/react-hooks';6import { renderHook } from '@testing-library/react-hooks';7import { act } from '@testing-library/react-hooks';8import { cleanup } from '@testing-library/react-hooks';9import { configure } from '@testing-library/react-hooks';10import { renderHook } from '@testing-library/react-hooks';11import { act } from '@testing-library/react-hooks';12import { cleanup } from '@testing-library/react-hooks';13import { configure } from '@testing-library/react-hooks';14import { renderHook } from '@testing-library/react-hooks';15import { act } from '@testing-library/react-hooks';16import { cleanup } from '@testing-library/react-hooks';17import { configure } from '@testing-library/react-hooks';18import { renderHook } from '@testing-library/react-hooks';19import { act } from '@testing-library/react-hooks';20import { cleanup } from '@testing-library/react-hooks';21import { configure } from '@testing-library/react-hooks';

Full Screen

Using AI Code Generation

copy

Full Screen

1import { waitFor } from '@testing-library/react-hooks';2import { waitFor } from '@testing-library/react-hooks';3import { waitFor } from '@testing-library/react-hooks';4import { waitFor } from '@testing-library/react-hooks';5import { waitFor } from '@testing-library/react-hooks';6const { getByText, getByTestId, queryByTestId } = render(<App />);7const button = getByTestId("button");

Full Screen

Using AI Code Generation

copy

Full Screen

1import { renderHook, act } from '@testing-library/react-hooks'2import { useCounter } from './useCounter'3describe('useCounter', () => {4 test('should increment counter', () => {5 const { result } = renderHook(() => useCounter())6 act(() => {7 result.current.increment()8 })9 expect(result.current.count).toBe(1)10 })11 test('should decrement counter', () => {12 const { result } = renderHook(() => useCounter())13 act(() => {14 result.current.decrement()15 })16 expect(result.current.count).toBe(-1)17 })18 test('should set counter to 0', () => {19 const { result } = renderHook(() => useCounter())20 act(() => {21 result.current.reset()22 })23 expect(result.current.count).toBe(0)24 })25})26import { renderHook, act, waitForElementToBeRemoved } from '@testing-library/react-hooks'27import { useCounter } from './useCounter'28describe('useCounter', () => {29 test('should increment counter', () => {30 const { result } = renderHook(() => useCounter())31 act(() => {32 result.current.increment()33 })34 expect(result.current.count).toBe(1)35 })36 test('should decrement counter', () => {37 const { result } = renderHook(() => useCounter())38 act(() => {39 result.current.decrement()40 })41 expect(result.current.count).toBe(-1)42 })43 test('should set counter to 0', () => {44 const { result } = renderHook(() => useCounter())45 act(() => {46 result.current.reset()47 })48 expect(result.current.count).toBe(0)49 })50})51import { renderHook, act, waitForDomChange } from '@testing-library/react-hooks'52import { useCounter } from './useCounter'53describe('useCounter', () => {54 test('should increment counter', () => {55 const { result } = renderHook(() => useCounter())56 act(() => {57 result.current.increment()58 })59 expect(result.current.count).toBe(1)60 })61 test('should decrement counter', () => {

Full Screen

Using AI Code Generation

copy

Full Screen

1import { renderHook } from '@testing-library/react-hooks'2import { useFetch } from './useFetch'3test('should fetch data', async () => {4 await waitFor(() => result.current.data !== null)5 expect(result.current.data.name).toBe('Luke Skywalker')6})7import { useState, useEffect } from 'react'8export const useFetch = (url) => {9 const [data, setData] = useState(null)10 const [loading, setLoading] = useState(true)11 useEffect(() => {12 const fetchData = async () => {13 const response = await fetch(url)14 const data = await response.json()15 setData(data)16 setLoading(false)17 }18 fetchData()19 }, [url])20 return { data, loading }21}22import { renderHook } from '@testing-library/react-hooks'23import { useFetch } from './useFetch'24test('should fetch data', async () => {25 const { result, waitForElementToBeRemoved } = renderHook(() =>26 await waitForElementToBeRemoved(() => result.current.loading)27 expect(result.current.data.name).toBe('Luke Skywalker')28})29import { useState, useEffect } from 'react'30export const useFetch = (url) => {31 const [data, setData] = useState(null)32 const [loading, setLoading] = useState(true)33 useEffect(() => {34 const fetchData = async () => {35 const response = await fetch(url)36 const data = await response.json()37 setData(data)38 setLoading(false)39 }40 fetchData()41 }, [url])42 return { data, loading }43}44import { renderHook } from '@testing-library/react-hooks'45import { useFetch } from './useFetch'46test('should fetch data', async () => {47 const { result, waitForValueToChange } = renderHook(() =>48 await waitForValueToChange(() => result.current.data)

Full Screen

Using AI Code Generation

copy

Full Screen

1import { waitFor } from '@testing-library/react-hooks'2import { useFetch } from './useFetch'3test('useFetch', async () => {4 await waitForNextUpdate()5 expect(result.current).toEqual('test')6})7import { waitForElement } from '@testing-library/react-hooks'8import { useFetch } from './useFetch'9test('useFetch', async () => {10 await waitForNextUpdate()11 await waitForElement(() => result.current)12 expect(result.current).toEqual('test')13})14When testing, code that causes React state updates should be wrapped into act(...):15act(() => {16});17 in TestHook (at useFetch.js:10)18import { useFetch } from './useFetch'19import { renderHook } from '@testing-library

Full Screen

Using AI Code Generation

copy

Full Screen

1import { renderHook } from '@testing-library/react-hooks'2import { useFetch } from './useFetch'3import { waitFor } from '@testing-library/react'4test('should fetch data', async () => {5 await waitForNextUpdate()6 expect(result.current.data).toEqual({ name: 'Luke Skywalker' })7})8import { useState, useEffect } from 'react'9import axios from 'axios'10export const useFetch = (url) => {11 const [data, setData] = useState(null)12 const [loading, setLoading] = useState(true)13 useEffect(() => {14 const fetchData = async () => {15 try {16 const response = await axios.get(url)17 setData(response.data)18 setLoading(false)19 } catch (error) {20 console.log(error)21 }22 }23 fetchData()24 }, [url])25 return { data, loading }26}

Full Screen

Using AI Code Generation

copy

Full Screen

1import { renderHook } from "@testing-library/react-hooks";2import { useFetch } from "./useFetch";3import { waitFor } from "@testing-library/react";4test("should return data", async () => {5 const { result, waitForNextUpdate } = renderHook(() => useFetch());6 await waitForNextUpdate();7 expect(result.current.data).toBe("data");8});9import { useState, useEffect } from "react";10export const useFetch = () => {11 const [data, setData] = useState(null);12 useEffect(() => {13 const fetchData = async () => {14 const data = await Promise.resolve("data");15 setData(data);16 };17 fetchData();18 }, []);19 return { data };20};

Full Screen

Using AI Code Generation

copy

Full Screen

1import { renderHook, act } from '@testing-library/react-hooks';2import { waitFor } from '@testing-library/react';3import { useFetch } from './useFetch';4describe('useFetch', () => {5 it('should return data', async () => {6 await waitForNextUpdate();7 expect(result.current).toEqual({ userId: 1, id: 1, title: 'sunt aut facere repellat provident occaecati excepturi optio reprehenderit', body: 'quia et suscipit↵suscipit recusandae consequuntur expedita et cum↵reprehenderit molestiae ut ut quas totam↵nostrum rerum est autem sunt rem eveniet architecto' });8 });9});10import { useState, useEffect } from 'react';11const useFetch = (url) => {12 const [data, setData] = useState(null);13 useEffect(() => {14 fetch(url)15 .then((response) => response.json())16 .then((data) => setData(data));17 }, [url]);18 return data;19};20export { useFetch };

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run testing-library-react-hooks 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