File tree 2 files changed +43
-1
lines changed
2 files changed +43
-1
lines changed Original file line number Diff line number Diff line change @@ -958,4 +958,46 @@ public function i_open_a_browser_tab_with_url(string $url) {
958
958
$ this ->getSession ()->switchToWindow ($ windowNames [1 ]);
959
959
}
960
960
961
+
962
+ /**
963
+ * Check if a notification has been triggered and is present.
964
+ *
965
+ * @Then /^a notification with title (".+") is( not)? present in the app$/
966
+ * @param string $title Notification title
967
+ * @param bool $not Whether assert that the notification was not found
968
+ */
969
+ public function notification_present_in_the_app (string $ title , bool $ not = false ) {
970
+ $ result = $ this ->runtime_js ("notificationIsPresentWithText( $ title) " );
971
+
972
+ if ($ not && $ result === 'YES ' ) {
973
+ throw new ExpectationException ("Notification is present " , $ this ->getSession ()->getDriver ());
974
+ }
975
+
976
+ if (!$ not && $ result === 'NO ' ) {
977
+ throw new ExpectationException ("Notification is not present " , $ this ->getSession ()->getDriver ());
978
+ }
979
+
980
+ if ($ result !== 'YES ' && $ result !== 'NO ' ) {
981
+ throw new DriverException ('Error checking notification - ' . $ result );
982
+ }
983
+
984
+ return true ;
985
+ }
986
+
987
+ /**
988
+ * Close a notification present in the app
989
+ *
990
+ * @Then /^I close a notification with title (".+") in the app$/
991
+ * @param string $title Notification title
992
+ */
993
+ public function close_notification_app (string $ title ) {
994
+ $ result = $ this ->runtime_js ("closeNotification( $ title) " );
995
+
996
+ if ($ result !== 'OK ' ) {
997
+ throw new DriverException ('Error closing notification - ' . $ result );
998
+ }
999
+
1000
+ return true ;
1001
+ }
1002
+
961
1003
}
Original file line number Diff line number Diff line change 6
6
7
7
defined ('MOODLE_INTERNAL ' ) || die;
8
8
9
- $ plugin ->version = 2022102000 ;
9
+ $ plugin ->version = 2022111100 ;
10
10
$ plugin ->requires = 2016052300 ;
11
11
$ plugin ->maturity = MATURITY_STABLE ;
12
12
$ plugin ->release = '4.1.0-dev ' ;
You can’t perform that action at this time.
0 commit comments