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

Conversation

lucaboesch
Copy link
Contributor

fix #522 .

Dear @mchurchward this pull request lets pass the automated tests again.

Best,
Luca

@rezeau
Copy link
Contributor

rezeau commented Oct 16, 2023

Just tested this PR on my local Moodle site running Moodle 4.3. PR Works as expected, the first scenario (Check questionnaire completion feature in web for Moodle ≤ 4.2) is skipped and the "Check questionnaire completion feature in web for Moodle ≥ 4.3" scenario is passed OK.
A very minor grievance: I am running those behat tests on my Windows box, with profile=geckodriver and the test begins to show in an Acceptance text site window but, when scenario 1 is skipped, then that window closes and does not re-open. However, if I add the --format=pretty parameter I can follow all the steps in my Windows shell window, so that's OK.

@mchurchward
Copy link
Contributor

@lucaboesch thanks for this. Do you know why we need to add "xpath" for 4.3? This seems to be something that would not be desirable.

@lucaboesch
Copy link
Contributor Author

And I click on "3" radio wouldn't execute any more, @mchurchward, I tried it...

@mchurchward
Copy link
Contributor

mchurchward commented Oct 31, 2023

But it does work in other places, like:

  • add_feedback.feature
  • add_multi_feedback_with_sections.feature

That makes me think there is something wrong with the display of that radio. There may need to be a fix in the display code.

@mchurchward
Copy link
Contributor

Also, the error that was highlighted here was for "Completion tracking". So the radio error came up after that was fixed?

@mchurchward
Copy link
Contributor

@lucaboesch I just tested this locally, and the only change it needs is for the "Completion tracking". The radio buttons work fine.

@lucaboesch
Copy link
Contributor Author

It would be of great help if you could paste in the modified lines here, @mchurchward

@lucaboesch lucaboesch force-pushed the completionconditionsbehattests branch from 6bd800d to 37804f2 Compare October 31, 2023 16:56
@lucaboesch
Copy link
Contributor Author

I had it run again.
The Moodle Plugin CI run error states

001 Scenario: Check questionnaire completion feature in web for Moodle ≥ 4.3. # /home/runner/work/moodle-mod_questionnaire/moodle-mod_questionnaire/moodle/mod/questionnaire/tests/behat/questionnaire_activity_completion.feature:70
      And I click on "Yes" "radio"                                            # /home/runner/work/moodle-mod_questionnaire/moodle-mod_questionnaire/moodle/mod/questionnaire/tests/behat/questionnaire_activity_completion.feature:111
        Behat\Mink\Exception\UnsupportedDriverActionException: Behat\Mink\Driver\BrowserKitDriver supports clicking on links and submit or reset buttons only. But "input" provided in /home/runner/work/moodle-mod_questionnaire/moodle-mod_questionnaire/moodle/vendor/behat/mink-browserkit-driver/src/BrowserKitDriver.php:468

| Max. text length | 15 |
| Question Text | Enter some text |
Then I should see "[Text Box] (Q8)"
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.

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 with xpath "//input[@type='radio' and @id='auto-rb0001']" to "1"
Copy link
Contributor

Choose a reason for hiding this comment

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

The code:
And I click on "Yes" "radio"
And I click on "Three" "radio"
still works for me running Behat locally. I don't think this and the next change are needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if its due to "master". The CI should be changed to MOODLE_403_STABLE now that it has been released.

@mchurchward
Copy link
Contributor

mchurchward commented Oct 31, 2023

I had it run again. The Moodle Plugin CI run error states

001 Scenario: Check questionnaire completion feature in web for Moodle ≥ 4.3. # /home/runner/work/moodle-mod_questionnaire/moodle-mod_questionnaire/moodle/mod/questionnaire/tests/behat/questionnaire_activity_completion.feature:70
      And I click on "Yes" "radio"                                            # /home/runner/work/moodle-mod_questionnaire/moodle-mod_questionnaire/moodle/mod/questionnaire/tests/behat/questionnaire_activity_completion.feature:111
        Behat\Mink\Exception\UnsupportedDriverActionException: Behat\Mink\Driver\BrowserKitDriver supports clicking on links and submit or reset buttons only. But "input" provided in /home/runner/work/moodle-mod_questionnaire/moodle-mod_questionnaire/moodle/vendor/behat/mink-browserkit-driver/src/BrowserKitDriver.php:468

I wonder if that is a Chrome issue with Behat? Maybe try changing the CI behat line:
run: moodle-plugin-ci behat
(drop the --profile chrome part)?

@lucaboesch lucaboesch force-pushed the completionconditionsbehattests branch 2 times, most recently from 72e745b to 20e0d2d Compare October 31, 2023 17:26
@mchurchward
Copy link
Contributor

@lucaboesch I figured out the problem. Radio buttons should not use "I click". They need a "Set field to" instead. But, they do work if "@javascript" is specified, and it wasn't for the new 4.3 scenario. In any case, the correct fix is to use "set field to".
See my commit here. It does the "set field" and additionally I simplified the scenarios by moving the duplicate steps to the background. If you want to update your PR accordingly, I will merge it in.

@lucaboesch lucaboesch force-pushed the completionconditionsbehattests branch 3 times, most recently from db646a1 to bf709ec Compare November 2, 2023 20:32
@lucaboesch lucaboesch force-pushed the completionconditionsbehattests branch from bf709ec to 40037f0 Compare November 2, 2023 21:09
@lucaboesch
Copy link
Contributor Author

Yeah, @mchurchward, but the point was to make the test passing for Moodle ≥ 4.3 as well as Moodle ≤ 4.2 so you don't resolve in leaving out those versions in ci.yml.
This updated pull request fits all needs and supports PHP 7.4, 8.0 and 8.1.

Best,
Luca

@mchurchward
Copy link
Contributor

Thanks Luca. Of course once we add PHP8.2 to the CI, there will be a huge mess. :-0

@mchurchward mchurchward merged commit e8607f8 into PoetOS:MOODLE_401_STABLE Nov 7, 2023
3 checks passed
@lucaboesch lucaboesch deleted the completionconditionsbehattests branch January 19, 2024 04:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Have the MOODLE_401_STABLE branch pass automated tests
3 participants