diff --git a/.github/workflows/acceptance.yml b/.github/workflows/acceptance.yml index c23c2c183..36e30e05a 100644 --- a/.github/workflows/acceptance.yml +++ b/.github/workflows/acceptance.yml @@ -56,21 +56,13 @@ jobs: run: | export MOODLE_DOCKER_WWWROOT=$GITHUB_WORKSPACE/moodle cp $GITHUB_WORKSPACE/moodle-docker/config.docker-template.php $GITHUB_WORKSPACE/moodle/config.php - sed -i "61c\$CFG->behat_faildump_path = '/var/www/html/behatfaildumps';" $GITHUB_WORKSPACE/moodle/config.php - sed -i "61i\$CFG->behat_increasetimeout = 2;" $GITHUB_WORKSPACE/moodle/config.php - sed -i "61i\$CFG->behat_ionic_wwwroot = 'http://moodleapp';" $GITHUB_WORKSPACE/moodle/config.php - sed -i "61i\$CFG->behat_snapshots_path = '/var/www/html/local/moodleappbehat/tests/behat/snapshots';" $GITHUB_WORKSPACE/moodle/config.php + sed -i "69c\$CFG->behat_faildump_path = '/var/www/html/behatfaildumps';" $GITHUB_WORKSPACE/moodle/config.php + sed -i "69i\$CFG->behat_increasetimeout = 2;" $GITHUB_WORKSPACE/moodle/config.php + sed -i "69i\$CFG->behat_ionic_wwwroot = 'http://moodleapp';" $GITHUB_WORKSPACE/moodle/config.php echo "define('TEST_MOD_BIGBLUEBUTTONBN_MOCK_SERVER', 'http://bbbmockserver/hash' . sha1(\$CFG->behat_wwwroot));" >> $GITHUB_WORKSPACE/moodle/config.php $GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-compose pull $GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-compose up -d $GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-wait-for-db - - name: Install Imagick PHP extension - run: | - export MOODLE_DOCKER_WWWROOT=$GITHUB_WORKSPACE/moodle - ./moodle-docker/bin/moodle-docker-compose exec webserver apt-get update - ./moodle-docker/bin/moodle-docker-compose exec webserver apt-get install -y libmagickwand-dev --no-install-recommends - ./moodle-docker/bin/moodle-docker-compose exec webserver pecl install imagick - ./moodle-docker/bin/moodle-docker-compose exec webserver docker-php-ext-enable imagick - name: Compile & launch app with Docker run: | docker build --build-arg build_command="npm run build:test" -t moodlehq/moodleapp:behat . diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml index 47e3fbf71..4c2b20853 100644 --- a/.github/workflows/performance.yml +++ b/.github/workflows/performance.yml @@ -1,6 +1,6 @@ name: Performance -on: [ pull_request, workflow_dispatch ] +on: [ workflow_dispatch ] jobs: performance: diff --git a/src/addons/messages/tests/behat/basic_usage.feature b/src/addons/messages/tests/behat/basic_usage.feature index bd35f8756..db30ff172 100755 --- a/src/addons/messages/tests/behat/basic_usage.feature +++ b/src/addons/messages/tests/behat/basic_usage.feature @@ -38,12 +38,20 @@ Feature: Test basic usage of messages in app Given I entered the app as "student1" When I press "Messages" in the app - And I press "Contacts" in the app + And I replace "/.*/" within ".addon-message-last-message-date" with "[Date]" + Then I should find "Contacts" in the app + And the UI should match the snapshot + + When I press "Contacts" in the app And I press "Requests" in the app And I press "Teacher teacher" in the app And I press "Accept and add to contacts" in the app Then I should not find "Teacher teacher would like to contact you" in the app + When I replace "/.*/" within ".addon-messages-date" with "[Day]" + And I replace "/.*/" within ".message-time" with "[Date]" + Then the UI should match the snapshot + When I press the back button in the app And I press "Contacts" near "No contact requests" in the app Then the header should be "Contacts" in the app diff --git a/src/addons/messages/tests/behat/snapshots/test-basic-usage-of-messages-in-app-view-recent-conversations-and-contacts_22.png b/src/addons/messages/tests/behat/snapshots/test-basic-usage-of-messages-in-app-view-recent-conversations-and-contacts_22.png new file mode 100644 index 000000000..6447230cc Binary files /dev/null and b/src/addons/messages/tests/behat/snapshots/test-basic-usage-of-messages-in-app-view-recent-conversations-and-contacts_22.png differ 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 new file mode 100644 index 000000000..8e90e2a81 Binary files /dev/null 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/tests/behat/basic_usage.feature b/src/addons/mod/assign/tests/behat/basic_usage.feature index f89f072a3..bb031cbd7 100755 --- a/src/addons/mod/assign/tests/behat/basic_usage.feature +++ b/src/addons/mod/assign/tests/behat/basic_usage.feature @@ -61,6 +61,11 @@ Feature: Test basic usage of assignment activity in app Scenario: Edit/Add submission (online text) & Add new attempt from previous submission & Submit for grading # Submit first attempt as a student Given I entered the assign activity "assignment1" on course "Course 1" as "student1" in the app + Then I should find "assignment1" in the app + + When I replace "/Assignment is overdue by: .*/" within "addon-mod-assign-submission core-tabs ion-item:nth-child(2)" with "Assignment is overdue by: [Overdue date]" + Then the UI should match the snapshot + When I press "Add submission" in the app Then I set the field "Online text submissions" to "Submission test 1st attempt" in the app And I press "Save" in the app diff --git a/src/addons/mod/assign/tests/behat/snapshots/test-basic-usage-of-assignment-activity-in-app-editadd-submission-online-text--add-new-attempt-from-previous-submission--submit-for-grading_8.png b/src/addons/mod/assign/tests/behat/snapshots/test-basic-usage-of-assignment-activity-in-app-editadd-submission-online-text--add-new-attempt-from-previous-submission--submit-for-grading_8.png new file mode 100644 index 000000000..8ed651fac Binary files /dev/null and b/src/addons/mod/assign/tests/behat/snapshots/test-basic-usage-of-assignment-activity-in-app-editadd-submission-online-text--add-new-attempt-from-previous-submission--submit-for-grading_8.png differ diff --git a/src/addons/mod/book/tests/behat/basic_usage.feature b/src/addons/mod/book/tests/behat/basic_usage.feature index 65a09b54e..a20893125 100755 --- a/src/addons/mod/book/tests/behat/basic_usage.feature +++ b/src/addons/mod/book/tests/behat/basic_usage.feature @@ -83,6 +83,7 @@ Feature: Test basic usage of book activity in app When I press "Chapt 1" in the app Then I should find "Chapt 1" in the app And I should find "This is the first chapter" in the app + And the UI should match the snapshot But I should not find "This is the second chapter" in the app When I press the back button 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 new file mode 100644 index 000000000..c3aab4b99 Binary files /dev/null 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/forum/tests/behat/basic_usage.feature b/src/addons/mod/forum/tests/behat/basic_usage.feature index 7f7035095..d1fe3a64d 100755 --- a/src/addons/mod/forum/tests/behat/basic_usage.feature +++ b/src/addons/mod/forum/tests/behat/basic_usage.feature @@ -52,9 +52,17 @@ Feature: Test basic usage of forum activity in app Scenario: Reply a post Given I entered the forum activity "Test forum name" on course "Course 1" as "student1" in the app + When I replace "/.*/" within ".addon-mod-forum-discussion-author p" with "[Publication date]" + And I replace "/\d+ seconds ago/" within ".addon-mod-forum-discussion-more-info ion-note" with "[seconds] seconds ago" + Then the UI should match the snapshot + When I press "Initial discussion" in the app And I press "Reply" in the app - And I set the field "Message" to "ReplyMessage" in the app + And I scroll to "Post to forum" in the app + And I replace "/.*/" within ".addon-mod-forum-post-author p:last-child" with "[Publication date]" + Then the UI should match the snapshot + + When I set the field "Message" to "ReplyMessage" in the app And I press "Post to forum" in the app Then I should find "Initial discussion message" in the app And I should find "ReplyMessage" in the app diff --git a/src/addons/mod/forum/tests/behat/snapshots/test-basic-usage-of-forum-activity-in-app-reply-a-post_14.png b/src/addons/mod/forum/tests/behat/snapshots/test-basic-usage-of-forum-activity-in-app-reply-a-post_14.png new file mode 100644 index 000000000..b25411147 Binary files /dev/null and b/src/addons/mod/forum/tests/behat/snapshots/test-basic-usage-of-forum-activity-in-app-reply-a-post_14.png differ diff --git a/src/addons/mod/forum/tests/behat/snapshots/test-basic-usage-of-forum-activity-in-app-reply-a-post_9.png b/src/addons/mod/forum/tests/behat/snapshots/test-basic-usage-of-forum-activity-in-app-reply-a-post_9.png new file mode 100644 index 000000000..03499bae9 Binary files /dev/null and b/src/addons/mod/forum/tests/behat/snapshots/test-basic-usage-of-forum-activity-in-app-reply-a-post_9.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 66946304d..2364f040b 100755 --- a/src/addons/mod/quiz/tests/behat/basic_usage.feature +++ b/src/addons/mod/quiz/tests/behat/basic_usage.feature @@ -143,7 +143,10 @@ Feature: Attempt a quiz in app Scenario: Submit a quiz & Review a quiz attempt Given I entered the quiz activity "Quiz 1" on course "Course 1" as "student1" in the app When I press "Attempt quiz now" in the app - And I press "True" in the app + Then I should find "Text of the first question" in the app + And the UI should match the snapshot + + When I press "True" in the app And I press "Next" in the app And I press "False" in the app And I press "Submit" in the app @@ -151,6 +154,10 @@ Feature: Attempt a quiz in app And I press "OK" in the app Then I should find "Review" in the app + When I replace "/.*/" within "page-addon-mod-quiz-review core-loading > ion-card ion-item:nth-child(1) p:nth-child(2)" with "[Started on date]" + And I replace "/.*/" within "page-addon-mod-quiz-review core-loading > ion-card ion-item:nth-child(3) p:nth-child(2)" with "[Completed on date]" + Then the UI should match the snapshot + Given I entered the quiz activity "Quiz 1" on course "Course 1" as "teacher1" in the app When I press "Information" in the app And I press "Open in browser" 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_15.png b/src/addons/mod/quiz/tests/behat/snapshots/attempt-a-quiz-in-app-submit-a-quiz--review-a-quiz-attempt_15.png new file mode 100644 index 000000000..69d8e9072 Binary files /dev/null and b/src/addons/mod/quiz/tests/behat/snapshots/attempt-a-quiz-in-app-submit-a-quiz--review-a-quiz-attempt_15.png differ diff --git a/src/addons/mod/quiz/tests/behat/snapshots/attempt-a-quiz-in-app-submit-a-quiz--review-a-quiz-attempt_25.png b/src/addons/mod/quiz/tests/behat/snapshots/attempt-a-quiz-in-app-submit-a-quiz--review-a-quiz-attempt_25.png new file mode 100644 index 000000000..3b9400b48 Binary files /dev/null and b/src/addons/mod/quiz/tests/behat/snapshots/attempt-a-quiz-in-app-submit-a-quiz--review-a-quiz-attempt_25.png differ diff --git a/src/core/features/course/tests/behat/basic_usage.feature b/src/core/features/course/tests/behat/basic_usage.feature index 392feb76f..74b735629 100755 --- a/src/core/features/course/tests/behat/basic_usage.feature +++ b/src/core/features/course/tests/behat/basic_usage.feature @@ -91,7 +91,7 @@ Feature: Test basic usage of one course in app When I set "page-core-course-index .core-course-thumb" styles to "--course-color" "lightblue" And I set "page-core-course-index .core-course-thumb" styles to "--course-color-tint" "white" - # Then the UI should match the snapshot + Then the UI should match the snapshot When I press "Choice course 1" in the app Then the header should be "Choice course 1" in the app diff --git a/src/core/features/login/tests/behat/basic_usage.feature b/src/core/features/login/tests/behat/basic_usage.feature index d9687c675..f7d7a55d1 100755 --- a/src/core/features/login/tests/behat/basic_usage.feature +++ b/src/core/features/login/tests/behat/basic_usage.feature @@ -31,14 +31,14 @@ Feature: Test basic usage of login in app And I press "Connect to your site" in the app Then I should find "Acceptance test site" in the app And I replace "/.*/" within ".core-siteurl" with "https://campus.example.edu" - # And the UI should match the snapshot + And the UI should match the snapshot When I set the following fields to these values in the app: | Username | student1 | | Password | student1 | And I press "Log in" near "Forgotten your username or password?" in the app Then I should find "Acceptance test site" in the app - # And the UI should match the snapshot + And the UI should match the snapshot But I should not find "Log in" in the app Scenario: Add a non existing account diff --git a/src/core/features/user/tests/behat/basic_usage.feature b/src/core/features/user/tests/behat/basic_usage.feature index 4aa6b8401..eb189dc9d 100755 --- a/src/core/features/user/tests/behat/basic_usage.feature +++ b/src/core/features/user/tests/behat/basic_usage.feature @@ -51,3 +51,11 @@ Feature: Test basic usage of user features When I press "Reconnect" in the app Then I should find "Acceptance test site" in the app + + Scenario: View profile + Given I entered the app as "student1" + When I press the user menu button in the app + And I press "Student" in the app + Then I should find "student1@example.com" in the app + And I should find "Student Student" in the app + And the UI should match the snapshot diff --git a/src/core/features/user/tests/behat/snapshots/test-basic-usage-of-user-features-view-profile_7.png b/src/core/features/user/tests/behat/snapshots/test-basic-usage-of-user-features-view-profile_7.png new file mode 100644 index 000000000..0a73d48c8 Binary files /dev/null and b/src/core/features/user/tests/behat/snapshots/test-basic-usage-of-user-features-view-profile_7.png differ