@@ -467,7 +467,7 @@ public function i_enter_the_activity_in_the_app(string $activity, string $activi
467467 /**
468468 * Presses standard buttons in the app.
469469 *
470- * @When /^I press the (back|more menu|page menu|user menu|main menu ) button in the app$/
470+ * @When /^I press the (back|more menu|page menu|user menu) button in the app$/
471471 * @param string $button Button type
472472 * @throws DriverException If the button push doesn't work
473473 */
@@ -485,6 +485,51 @@ public function i_press_the_standard_button_in_the_app(string $button) {
485485 $ this ->wait_for_pending_js ();
486486 }
487487
488+ /**
489+ * Presses go back repeatedly in the app.
490+ *
491+ * @When /^I go back( (\d+) times)? in the app$/
492+ * @param int $times
493+ * @throws DriverException If the navigation doesn't work
494+ */
495+ public function i_go_back_x_times_in_the_app (?string $ unused = null , ?int $ times = 1 ) {
496+ if ($ times < 1 ) {
497+ return ;
498+ }
499+
500+ $ this ->spin (function () use ($ times ) {
501+ $ result = $ this ->runtime_js ("goBackTimes( $ times) " );
502+
503+ if ($ result !== 'OK ' ) {
504+ throw new DriverException ('Error navigating back - ' . $ result );
505+ }
506+
507+ return true ;
508+ });
509+
510+ $ this ->wait_for_pending_js ();
511+ }
512+
513+ /**
514+ * Presses go back repeatedly until the app is in the main menu.
515+ *
516+ * @When /^I go back to the root page in the app$/
517+ * @throws DriverException If the navigation doesn't work
518+ */
519+ public function i_go_back_to_root_in_the_app () {
520+ $ this ->spin (function () {
521+ $ result = $ this ->runtime_js ("goBackToRoot() " );
522+
523+ if ($ result !== 'OK ' ) {
524+ throw new DriverException ('Error navigating to root - ' . $ result );
525+ }
526+
527+ return true ;
528+ });
529+
530+ $ this ->wait_for_pending_js ();
531+ }
532+
488533 /**
489534 * Receives push notifications.
490535 *
0 commit comments