Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questionnaire different ≤ 4.2 and ≥ 4.3 activity completion behat tests … #523

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
matrix:
include:
- php: '8.1'
moodle-branch: 'master'
moodle-branch: 'MOODLE_403_STABLE'
database: 'pgsql'
- php: '8.0'
moodle-branch: 'MOODLE_402_STABLE'
Expand Down
42 changes: 34 additions & 8 deletions tests/behat/questionnaire_activity_completion.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,32 @@ Feature: View activity completion information in the questionnaire activity
And the following "activities" exist:
| activity | name | introduction | course | idnumber | completion | completionview | completionpostsenabled | completionposts |
| questionnaire | Test questionnaire completion | Test questionnaire description | C1 | questionnaire2 | 2 | 1 | 1 | 1 |

@javascript
Scenario: Check questionnaire completion feature in web.
Given I log in as "teacher1"
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test questionnaire completion"
Then I click on "Add questions" "link"
And I click on "Add questions" "link"
And I add a "Yes/No" question and I fill the form with:
| Question Name | Q1 |
| Yes | y |
| Question Text | Are you still in School? |
Then I should see "[Yes/No] (Q1)"
And I add a "Radio Buttons" question and I fill the form with:
| Question Name | Q2 |
| Yes | y |
| Horizontal | Checked |
| Question Text | Select one choice |
| Possible answers | 1=One,2=Two,3=Three,4=Four |
Then I should see "[Radio Buttons] (Q2)"
And I add a "Text Box" question and I fill the form with:
| Question Name | Q8 |
| No | n |
| Input box length | 10 |
| Max. text length | 15 |
| Question Text | Enter some text |
Then I should see "[Text Box] (Q8)"

@javascript
Scenario: Check questionnaire completion feature in web for Moodle ≤ 4.2.
Given the site is running Moodle version 4.2 or lower
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I am on the "Test questionnaire completion" "questionnaire activity editing" page
And I set the following fields to these values:
| Completion tracking | Show activity as complete when conditions are met |
Expand All @@ -65,3 +65,29 @@ Feature: View activity completion information in the questionnaire activity
Then I should see "Thank you for completing this Questionnaire."
And I press "Continue"
Then I should see "View your response(s)"

Scenario: Check questionnaire completion feature in web for Moodle ≥ 4.3.
Given the site is running Moodle version 4.3 or higher
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I am on the "Test questionnaire completion" "questionnaire activity editing" page
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the lines below can be simplified to:

And I expand all fieldsets
And I set the following fields to these values:
  | Add requirements                                      | 1 |
  | Student must submit this questionnaire to complete it | 1 |

This is from examples in core.

And I click on "Expand all" "link" in the "region-main" "region"
And I set the following fields to these values:
| Add requirements | 1 |
| Student must submit this questionnaire to complete it | 1 |
And I press "Save and display"

And I am on the "Test questionnaire completion" "questionnaire activity" page
Then I should see "You are not eligible to take this questionnaire."

And I am on the "Test questionnaire completion" "questionnaire activity" page logged in as "student1"
And I click on "Answer the questions..." "link"
Then I should see "Are you still in School?"
And I should see "Select one choice"
And I should see "Enter some text"
And I set the field "Yes" to "1"
And I set the field "Three" to "1"
And I press "Submit questionnaire"
Then I should see "Thank you for completing this Questionnaire."
And I press "Continue"
Then I should see "View your response(s)"