From 60dd6090dd4195c0062124e32ffa0c7ee0ed9439 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Tue, 8 Nov 2022 09:35:08 +0100 Subject: [PATCH] MOBILE-4100 bbb: Add behat tests for recordings --- .github/workflows/acceptance.yml | 3 + .../tests/behat/basic_usage.feature | 74 +++++++++++++++++++ .../tests/behat/groups.feature | 26 +++++++ 3 files changed, 103 insertions(+) diff --git a/.github/workflows/acceptance.yml b/.github/workflows/acceptance.yml index 19e816b09..d49371457 100644 --- a/.github/workflows/acceptance.yml +++ b/.github/workflows/acceptance.yml @@ -30,6 +30,7 @@ jobs: MOODLE_BRANCH: ${{ github.event.inputs.moodle_branch || 'master' }} MOODLE_REPOSITORY: ${{ github.event.inputs.moodle_repository || 'https://github.com/moodle/moodle' }} BEHAT_TAGS: ${{ github.event.inputs.behat_tags || '~@performance' }} + steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v3 @@ -50,6 +51,7 @@ jobs: export MOODLE_DOCKER_WWWROOT=$GITHUB_WORKSPACE/moodle cp $GITHUB_WORKSPACE/moodle-docker/config.docker-template.php $GITHUB_WORKSPACE/moodle/config.php sed -i "61i\$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 @@ -58,6 +60,7 @@ jobs: docker build --build-arg build_command="npm run build:test" -t moodlehq/moodleapp:behat . docker run -d --rm --name moodleapp moodlehq/moodleapp:behat docker network connect moodle-docker_default moodleapp --alias moodleapp + docker run --detach --name bbbmockserver --network moodle-docker_default moodlehq/bigbluebutton_mock:latest - name: Init Behat run: | export MOODLE_DOCKER_WWWROOT=$GITHUB_WORKSPACE/moodle diff --git a/src/addons/mod/bigbluebuttonbn/tests/behat/basic_usage.feature b/src/addons/mod/bigbluebuttonbn/tests/behat/basic_usage.feature index 5462396c2..92b32be1c 100755 --- a/src/addons/mod/bigbluebuttonbn/tests/behat/basic_usage.feature +++ b/src/addons/mod/bigbluebuttonbn/tests/behat/basic_usage.feature @@ -97,3 +97,77 @@ Feature: Test basic usage of BBB activity in app When I close all opened windows And I press "Join session" in the app Then the app should have opened a browser tab with url "blindsidenetworks.com" + + @lms_from4.1 + Scenario: Display right info based on instance type + Given the following "activities" exist: + | activity | name | course | idnumber | type | + | bigbluebuttonbn | Room & recordings | C1 | bbb1 | 0 | + | bigbluebuttonbn | Room only | C1 | bbb2 | 1 | + | bigbluebuttonbn | Recordings only | C1 | bbb3 | 2 | + And I entered the bigbluebuttonbn activity "Room & recordings" on course "Course 1" as "student1" in the app + Then I should find "This room is ready. You can join the session now." in the app + And I should be able to press "Join session" in the app + And I should find "Recordings" in the app + And I should find "There are no recordings available." in the app + + When I press the back button in the app + And I press "Room only" in the app + Then I should find "This room is ready. You can join the session now." in the app + And I should be able to press "Join session" in the app + But I should not find "Recordings" in the app + + When I press the back button in the app + And I press "Recordings only" in the app + Then I should find "Recordings" in the app + But I should not find "This room is ready. You can join the session now." in the app + And I should not be able to press "Join session" in the app + + # Test recordings requires a BBB mock server. If you're using docker, you can run the BBB mock server with this command: + # + # docker run --name bbbmockserver -p 8001:80 moodlehq/bigbluebutton_mock:latest + # + # You also need to edit the config.php of your Moodle site to add this line: + # + # define('TEST_MOD_BIGBLUEBUTTONBN_MOCK_SERVER', 'http://bbbmockserver:8001/hash' . sha1($CFG->behat_wwwroot)); + Scenario: View recordings + Given a BigBlueButton mock server is configured + And the following "activities" exist: + | activity | name | course | idnumber | type | recordings_imported | + | bigbluebuttonbn | BBB | C1 | bbb1 | 0 | 0 | + And the following "mod_bigbluebuttonbn > meeting" exists: + | activity | BBB | + And the following "mod_bigbluebuttonbn > recordings" exist: + | bigbluebuttonbn | name | description | status | + | BBB | Recording 1 | Description 1 | 3 | + | BBB | Recording 2 | Description 2 | 3 | + And I entered the bigbluebuttonbn activity "BBB" on course "Course 1" as "student1" in the app + Then I should find "Presentation" in the app + And I should find "Recording 1" in the app + And I should find "Recording 2" in the app + But I should not find "Description 1" in the app + And I should not find "Description 2" in the app + + When I press "Recording 1" in the app + Then I should find "Description 1" in the app + And I should find "Presentation" within "Playback" "ion-item" in the app + And I should find "Recording 1" within "Name" "ion-item" in the app + And I should find "Date" in the app + And I should find "3600" within "Duration" "ion-item" in the app + But I should not find "Description 2" in the app + + When I press "Recording 1" in the app + Then I should not find "Description 1" in the app + + When I press "Recording 2" in the app + Then I should find "Description 2" in the app + And I should find "Presentation" within "Playback" "ion-item" in the app + And I should find "Recording 2" within "Name" "ion-item" in the app + But I should not find "Description 1" in the app + + # Test play button, but the mock server doesn't support viewing recordings. + When I press "Play" near "Recording 1" in the app + And I press "OK" in the app + And I switch to the browser tab opened by the app + And I log in as "student1" + Then I should see "The recording URL is invalid" diff --git a/src/addons/mod/bigbluebuttonbn/tests/behat/groups.feature b/src/addons/mod/bigbluebuttonbn/tests/behat/groups.feature index 3c87f29f0..80e41fbaa 100755 --- a/src/addons/mod/bigbluebuttonbn/tests/behat/groups.feature +++ b/src/addons/mod/bigbluebuttonbn/tests/behat/groups.feature @@ -81,3 +81,29 @@ Feature: Test usage of BBB activity with groups in app And I press "Group 2" in the app Then I should find "This room is ready. You can join the session now." in the app And I should be able to press "Join session" in the app + + Scenario: View recordings + Given a BigBlueButton mock server is configured + And the following "activities" exist: + | activity | name | course | idnumber | wait | groupmode | type | recordings_imported | + | bigbluebuttonbn | Test BBB | C1 | bbb1 | 0 | 2 | 0 | 0 | + And the following "mod_bigbluebuttonbn > meeting" exists: + | activity | Test BBB | + And the following "mod_bigbluebuttonbn > meetings" exist: + | activity | group | + | Test BBB | G1 | + | Test BBB | G2 | + And the following "mod_bigbluebuttonbn > recordings" exist: + | bigbluebuttonbn | name | description | status | group | + | Test BBB | Recording 1 | Description 1 | 3 | G1 | + | Test BBB | Recording 2 | Description 2 | 3 | G2 | + And I entered the bigbluebuttonbn activity "Test BBB" on course "Course 1" as "student1" in the app + When I press "Visible groups" in the app + And I press "Group 1" in the app + Then I should find "Recording 1" in the app + But I should not find "Recording 2" in the app + + When I press "Visible groups" in the app + And I press "Group 2" in the app + Then I should find "Recording 2" in the app + But I should not find "Recording 1" in the app