MOBILE-3947 behat: Add step to wait for Toast to dismiss
parent
7287a9b298
commit
b52681e2b2
|
@ -1211,4 +1211,13 @@ class behat_app extends behat_app_helper {
|
||||||
$this->resize_app_window($width, $height);
|
$this->resize_app_window($width, $height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wait until Toast disappears.
|
||||||
|
*
|
||||||
|
* @When I wait toast to dismiss in the app
|
||||||
|
*/
|
||||||
|
public function i_wait_toast_to_dismiss_in_the_app() {
|
||||||
|
$this->runtime_js('waitToastDismiss()');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,19 +23,19 @@ Feature: Set a new reminder on course
|
||||||
# Default set
|
# Default set
|
||||||
When I press "Set a reminder for \"Course 1\" (Course end date)" in the app
|
When I press "Set a reminder for \"Course 1\" (Course end date)" in the app
|
||||||
Then I should find "Reminder set for " in the app
|
Then I should find "Reminder set for " in the app
|
||||||
And I should find "Reminder set for" in the app
|
|
||||||
|
|
||||||
# Set from list
|
# Set from list
|
||||||
When I press "Set a reminder for \"Course 1\" (Course end date)" in the app
|
When I wait toast to dismiss in the app
|
||||||
|
And I press "Set a reminder for \"Course 1\" (Course end date)" in the app
|
||||||
Then I should find "Set a reminder" in the app
|
Then I should find "Set a reminder" in the app
|
||||||
And "At the time of the event" should be selected in the app
|
And "At the time of the event" should be selected in the app
|
||||||
But "12 hours before" should not be selected in the app
|
But "12 hours before" should not be selected in the app
|
||||||
When I press "12 hours before" in the app
|
When I press "12 hours before" in the app
|
||||||
Then I should find "Reminder set for " in the app
|
Then I should find "Reminder set for " in the app
|
||||||
And I should find "Reminder set for" in the app
|
|
||||||
|
|
||||||
# Custom set
|
# Custom set
|
||||||
When I press "Set a reminder for \"Course 1\" (Course end date)" in the app
|
When I wait toast to dismiss in the app
|
||||||
|
And I press "Set a reminder for \"Course 1\" (Course end date)" in the app
|
||||||
Then I should find "Set a reminder" in the app
|
Then I should find "Set a reminder" in the app
|
||||||
And "At the time of the event" should not be selected in the app
|
And "At the time of the event" should not be selected in the app
|
||||||
But "12 hours before" should be selected in the app
|
But "12 hours before" should be selected in the app
|
||||||
|
@ -46,10 +46,10 @@ Feature: Set a new reminder on course
|
||||||
| Units | hours |
|
| Units | hours |
|
||||||
And I press "Set reminder" in the app
|
And I press "Set reminder" in the app
|
||||||
Then I should find "Reminder set for " in the app
|
Then I should find "Reminder set for " in the app
|
||||||
And I should find "Reminder set for" in the app
|
|
||||||
|
|
||||||
# Remove
|
# Remove
|
||||||
When I press "Set a reminder for \"Course 1\" (Course end date)" in the app
|
When I wait toast to dismiss in the app
|
||||||
|
And I press "Set a reminder for \"Course 1\" (Course end date)" in the app
|
||||||
Then "2 hours before" should be selected in the app
|
Then "2 hours before" should be selected in the app
|
||||||
When I press "Delete reminder" in the app
|
When I press "Delete reminder" in the app
|
||||||
Then I should find "Reminder deleted" in the app
|
Then I should find "Reminder deleted" in the app
|
||||||
|
|
|
@ -18,7 +18,7 @@ import { CoreCustomURLSchemes, CoreCustomURLSchemesProvider } from '@services/ur
|
||||||
import { ONBOARDING_DONE } from '@features/login/constants';
|
import { ONBOARDING_DONE } from '@features/login/constants';
|
||||||
import { CoreConfig } from '@services/config';
|
import { CoreConfig } from '@services/config';
|
||||||
import { EnvironmentConfig } from '@/types/config';
|
import { EnvironmentConfig } from '@/types/config';
|
||||||
import { LocalNotifications, makeSingleton, NgZone } from '@singletons';
|
import { LocalNotifications, makeSingleton, NgZone, ToastController } from '@singletons';
|
||||||
import { CoreNetwork, CoreNetworkService } from '@services/network';
|
import { CoreNetwork, CoreNetworkService } from '@services/network';
|
||||||
import { CorePushNotifications, CorePushNotificationsProvider } from '@features/pushnotifications/services/pushnotifications';
|
import { CorePushNotifications, CorePushNotificationsProvider } from '@features/pushnotifications/services/pushnotifications';
|
||||||
import { CoreCronDelegate, CoreCronDelegateService } from '@services/cron';
|
import { CoreCronDelegate, CoreCronDelegateService } from '@services/cron';
|
||||||
|
@ -33,6 +33,7 @@ import { Swiper } from 'swiper';
|
||||||
import { LocalNotificationsMock } from '@features/emulator/services/local-notifications';
|
import { LocalNotificationsMock } from '@features/emulator/services/local-notifications';
|
||||||
import { GetClosureArgs } from '@/core/utils/types';
|
import { GetClosureArgs } from '@/core/utils/types';
|
||||||
import { CoreIframeComponent } from '@components/iframe/iframe';
|
import { CoreIframeComponent } from '@components/iframe/iframe';
|
||||||
|
import { CoreUtils } from '@services/utils/utils';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Behat runtime servive with public API.
|
* Behat runtime servive with public API.
|
||||||
|
@ -745,6 +746,15 @@ export class TestingBehatRuntimeService {
|
||||||
return 'OK';
|
return 'OK';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wait for toast to be dismissed in the app.
|
||||||
|
*
|
||||||
|
* @returns Promise resolved when toast has been dismissed.
|
||||||
|
*/
|
||||||
|
async waitToastDismiss(): Promise<void> {
|
||||||
|
await CoreUtils.ignoreErrors(ToastController.dismiss());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const TestingBehatRuntime = makeSingleton(TestingBehatRuntimeService);
|
export const TestingBehatRuntime = makeSingleton(TestingBehatRuntimeService);
|
||||||
|
|
Loading…
Reference in New Issue