diff --git a/.github/workflows/acceptance.yml b/.github/workflows/acceptance.yml index ace8d2d2a..35b9a772f 100644 --- a/.github/workflows/acceptance.yml +++ b/.github/workflows/acceptance.yml @@ -153,7 +153,7 @@ jobs: - name: Initialise moodle-plugin-ci run: | - composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^4.4 + composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^4.5 echo $(cd ci/bin; pwd) >> $GITHUB_PATH echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH sudo locale-gen en_AU.UTF-8 diff --git a/local_moodleappbehat/templates/mobile.mustache b/local_moodleappbehat/templates/mobile.mustache index d56f2fe4f..c73bd7fcd 100644 --- a/local_moodleappbehat/templates/mobile.mustache +++ b/local_moodleappbehat/templates/mobile.mustache @@ -3,8 +3,7 @@ - What is the answer to the Ultimate Question of Life, The Universe, and Everything? - + That is correct! diff --git a/src/addons/messages/tests/behat/snapshots/test-basic-usage-of-messages-in-app-view-recent-conversations-and-contacts_30.png b/src/addons/messages/tests/behat/snapshots/test-basic-usage-of-messages-in-app-view-recent-conversations-and-contacts_30.png index 80a903af6..c324279ef 100644 Binary files a/src/addons/messages/tests/behat/snapshots/test-basic-usage-of-messages-in-app-view-recent-conversations-and-contacts_30.png and b/src/addons/messages/tests/behat/snapshots/test-basic-usage-of-messages-in-app-view-recent-conversations-and-contacts_30.png differ diff --git a/src/addons/mod/assign/components/submission/submission.ts b/src/addons/mod/assign/components/submission/submission.ts index 9e6011c32..420b69701 100644 --- a/src/addons/mod/assign/components/submission/submission.ts +++ b/src/addons/mod/assign/components/submission/submission.ts @@ -449,7 +449,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can this.feedback, this.submitId, ); - } catch (error) { + } catch { // Error ocurred, consider there are no changes. return false; } diff --git a/src/addons/mod/assign/tests/behat/marking_workflow.feature b/src/addons/mod/assign/tests/behat/marking_workflow.feature index 5bb39e488..2e9b33534 100755 --- a/src/addons/mod/assign/tests/behat/marking_workflow.feature +++ b/src/addons/mod/assign/tests/behat/marking_workflow.feature @@ -100,6 +100,7 @@ Feature: Test marking workflow in assignment activity in app And I press "Grade" in the app When I set the field "Grade out of 100" to "60" in the app And I press "Done" in the app + And I wait loading to finish in the app And I press "Student1" in the app And I press "Grade" in the app Then I should find "60 / 100" within "Current grade in assignment" "ion-item" in the app @@ -112,6 +113,7 @@ Feature: Test marking workflow in assignment activity in app And I press "Grade" in the app When I set the field "Grade out of 100" to "80" in the app And I press "Done" in the app + And I wait loading to finish in the app And I press "Student3" in the app And I press "Grade" in the app Then I should find "80" within "Current grade in gradebook" "ion-item" in the app diff --git a/src/addons/mod/bigbluebuttonbn/tests/behat/basic_usage.feature b/src/addons/mod/bigbluebuttonbn/tests/behat/basic_usage.feature index 84e49873b..9ca94cf76 100755 --- a/src/addons/mod/bigbluebuttonbn/tests/behat/basic_usage.feature +++ b/src/addons/mod/bigbluebuttonbn/tests/behat/basic_usage.feature @@ -49,6 +49,8 @@ Feature: Test basic usage of BBB activity in app And I should be able to press "Join session" in the app When I press "Join session" in the app + # TODO: This step will make behat github actions work but we should find a better way to wait for the room to start. + And I wait "3" seconds And I wait for the BigBlueButton room to start And I switch back to the app Then I should find "The session is in progress." in the app @@ -68,6 +70,8 @@ Feature: Test basic usage of BBB activity in app And I should be able to press "Join session" in the app When I press "Join session" in the app + # TODO: This step will make behat github actions work but we should find a better way to wait for the room to start. + And I wait "3" seconds And I wait for the BigBlueButton room to start And I switch back to the app Then I should find "The session is in progress." in the app diff --git a/src/addons/mod/book/tests/behat/snapshots/test-basic-usage-of-book-activity-in-app-open-chapters-from-table-of-contents_11.png b/src/addons/mod/book/tests/behat/snapshots/test-basic-usage-of-book-activity-in-app-open-chapters-from-table-of-contents_11.png index 1a1b3c1de..2f932c02b 100644 Binary files a/src/addons/mod/book/tests/behat/snapshots/test-basic-usage-of-book-activity-in-app-open-chapters-from-table-of-contents_11.png and b/src/addons/mod/book/tests/behat/snapshots/test-basic-usage-of-book-activity-in-app-open-chapters-from-table-of-contents_11.png differ diff --git a/src/addons/mod/quiz/tests/behat/basic_usage.feature b/src/addons/mod/quiz/tests/behat/basic_usage.feature index d02d3e1e2..0c6b90692 100755 --- a/src/addons/mod/quiz/tests/behat/basic_usage.feature +++ b/src/addons/mod/quiz/tests/behat/basic_usage.feature @@ -167,12 +167,16 @@ Feature: Attempt a quiz in app And I press "Three" in the app And I set the field "Answer" to "Berlin" in the app And I press "Next" in the app + And I wait loading to finish in the app And I set the field "Answer" to "testing" in the app And I press "Next" in the app + And I wait loading to finish in the app And I set the field "Answer" to "5" in the app And I press "Next" in the app + And I wait loading to finish in the app And I set the field "Answer" to "Testing an essay" in the app And I press "Next" "ion-button" in the app + And I wait loading to finish in the app And I press "quick" ".drag" in the app And I click on ".place1.drop" "css" And I press "fox" ".drag" in the app @@ -180,26 +184,33 @@ Feature: Attempt a quiz in app And I press "lazy" ".drag" in the app And I click on ".place3.drop" "css" And I press "Next" in the app + And I wait loading to finish in the app And I press "True" in the app And I press "Next" in the app + And I wait loading to finish in the app And I set the field "frog" to "amphibian" in the app And I set the field "newt" to "insect" in the app And I set the field "cat" to "mammal" in the app And I press "Next" in the app + And I wait loading to finish in the app Then I should find "Text of the eighth question" in the app When I press "Next" in the app + And I wait loading to finish in the app And I set the field "Blank 1" to "cat" in the app And I set the field "Blank 2" to "mat" in the app And I press "Next" in the app + And I wait loading to finish in the app And I press "abyssal" ".drag" in the app And I click on ".place6.dropzone" "css" And I press "trench" ".drag" in the app And I click on ".place3.dropzone" "css" And I press "Next" in the app + And I wait loading to finish in the app And I press "Railway station" ".marker" in the app And I click on "img.dropbackground" "css" And I press "Submit" in the app + And I wait loading to finish in the app Then I should find "Answer saved" in the app And I should find "Incomplete answer" within "10" "ion-item" in the app But I should not find "Not yet answered" in the app @@ -224,8 +235,10 @@ Feature: Attempt a quiz in app When I press "True" in the app And I press "Next" in the app + And I wait loading to finish in the app And I press "False" in the app And I press "Submit" in the app + And I wait loading to finish in the app And I press "Submit all and finish" in the app Then I should find "Once you submit" in the app But I should not find "Questions without a response" in the app diff --git a/src/addons/mod/quiz/tests/behat/snapshots/attempt-a-quiz-in-app-submit-a-quiz--review-a-quiz-attempt_40.png b/src/addons/mod/quiz/tests/behat/snapshots/attempt-a-quiz-in-app-submit-a-quiz--review-a-quiz-attempt_42.png similarity index 100% rename from src/addons/mod/quiz/tests/behat/snapshots/attempt-a-quiz-in-app-submit-a-quiz--review-a-quiz-attempt_40.png rename to src/addons/mod/quiz/tests/behat/snapshots/attempt-a-quiz-in-app-submit-a-quiz--review-a-quiz-attempt_42.png diff --git a/src/core/features/login/tests/behat/snapshots/test-basic-usage-of-login-in-app-add-a-new-account-in-the-app--site-name-in-displayed-when-adding-a-new-account_13.png b/src/core/features/login/tests/behat/snapshots/test-basic-usage-of-login-in-app-add-a-new-account-in-the-app--site-name-in-displayed-when-adding-a-new-account_13.png index 7e3e37007..5fa063d00 100644 Binary files a/src/core/features/login/tests/behat/snapshots/test-basic-usage-of-login-in-app-add-a-new-account-in-the-app--site-name-in-displayed-when-adding-a-new-account_13.png and b/src/core/features/login/tests/behat/snapshots/test-basic-usage-of-login-in-app-add-a-new-account-in-the-app--site-name-in-displayed-when-adding-a-new-account_13.png differ diff --git a/src/core/features/login/tests/behat/snapshots/test-basic-usage-of-login-in-app-add-a-new-account-in-the-app--site-name-in-displayed-when-adding-a-new-account_9.png b/src/core/features/login/tests/behat/snapshots/test-basic-usage-of-login-in-app-add-a-new-account-in-the-app--site-name-in-displayed-when-adding-a-new-account_9.png index 1d2c22c52..dc3db50c8 100644 Binary files a/src/core/features/login/tests/behat/snapshots/test-basic-usage-of-login-in-app-add-a-new-account-in-the-app--site-name-in-displayed-when-adding-a-new-account_9.png and b/src/core/features/login/tests/behat/snapshots/test-basic-usage-of-login-in-app-add-a-new-account-in-the-app--site-name-in-displayed-when-adding-a-new-account_9.png differ diff --git a/src/core/services/utils/utils.ts b/src/core/services/utils/utils.ts index 5783ca169..1a6cc9a28 100644 --- a/src/core/services/utils/utils.ts +++ b/src/core/services/utils/utils.ts @@ -1185,7 +1185,7 @@ export class CoreUtilsProvider { if (options.showBrowserWarning || options.showBrowserWarning === undefined) { try { await CoreWindow.confirmOpenBrowserIfNeeded(originaUrl); - } catch (error) { + } catch { return; // Cancelled, stop. } } diff --git a/src/testing/services/behat-blocking.ts b/src/testing/services/behat-blocking.ts index 57329ba71..716ed4438 100644 --- a/src/testing/services/behat-blocking.ts +++ b/src/testing/services/behat-blocking.ts @@ -196,10 +196,13 @@ export class TestingBehatBlockingService { await CoreUtils.nextTick(); const blockingElements = Array.from( - document.querySelectorAll('div.core-loading-container, ion-loading, .click-block-active'), + document.querySelectorAll('div.core-loading-container, ion-loading'), ); const isBlocked = blockingElements.some(element => { + // @TODO Fix ion-loading present check with CoreDom.isElementVisible. + // ion-loading never has offsetParent since position is fixed. + // Using isElementVisible solve the problem but will block behats (like BBB). if (!element.offsetParent) { return false; } diff --git a/src/testing/services/behat-runtime.ts b/src/testing/services/behat-runtime.ts index 265d7e3de..c030715a6 100644 --- a/src/testing/services/behat-runtime.ts +++ b/src/testing/services/behat-runtime.ts @@ -159,11 +159,19 @@ export class TestingBehatRuntimeService { */ async waitLoadingToFinish(): Promise { await NgZone.run(async () => { - const elements = Array.from(document.body.querySelectorAll('core-loading')) - .filter((element) => CoreDom.isElementVisible(element)); + const coreLoadingsPromises: Promise[] = + Array.from(document.body.querySelectorAll('core-loading')) + .filter((element) => CoreDom.isElementVisible(element)) + .map(element => CoreDirectivesRegistry.waitDirectiveReady(element, CoreLoadingComponent)); - await Promise.all(elements.map(element => - CoreDirectivesRegistry.waitDirectiveReady(element, CoreLoadingComponent))); + const ionLoadingsPromises: Promise[] = + Array.from(document.body.querySelectorAll('ion-loading')) + .filter((element) => CoreDom.isElementVisible(element)) + .map(element => element.onDidDismiss()); + + const promises = coreLoadingsPromises.concat(ionLoadingsPromises); + + await Promise.all(promises); }); }