Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-62514

Random behat failure (Mary Smith)

XMLWordPrintable

    • MOODLE_33_STABLE, MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE
    • MOODLE_35_STABLE, MOODLE_36_STABLE
    • MDL-62514-master
    • Hide

      Regression testing is covered by the enrol_manual behat tests

      Setup

      This test requires that we have requests that take a much longer time to complete that later requests would, to simulate that we will modify the core_enrol_get_potential_users external function to take a minimum of 10 seconds. We will do that by adding the following lines of code to the get_potential_users method in /enrol/externallib.php:

      if (strlen($search) === 1) {
          sleep(10);
      }
      

      You can do it by applying the following patches, that are attached below one for each branch:

      1. For master: MDL-62194-master-simulate-long-request.diff

        git apply MDL-62194-master-simulate-long-request.diff
        

      2. For Moodle 3.6: MDL-62194-36-simulate-long-request.diff

        git apply MDL-62194-36-simulate-long-request.diff
        

      3. For Moodle 3.5: MDL-62194-35-simulate-long-request.diff

        git apply MDL-62194-35-simulate-long-request.diff
        

      Prerequisites

      • A course (Course 1)
      • An Teacher enrolled on Course 1
      • Three users that have a matching start character in their name but then differentiate:
        • Jane Eyre
        • John Smith
        • James Peach

      Testing that the autocomplete works

      1. Navigate to the Course 1 as Teacher
      2. In the hamburger menu select Participants
      3. Press Enrol users
      4. In the Select users search box start typing J
      5. Wait a second or two
      6. Then type ane so that the text in the box is Jane
      7. Stop typing
      8. Around 10 seconds after you completed step 4 you should see a list of users containing Jane Eyre, John Smith and James Peach (It may only show for half a second)
      9. Shortly after this the list of users should change to display Jane Eyre, verify that it no longer displays John Smith nor James Peach
      Show
      Regression testing is covered by the enrol_manual behat tests Setup This test requires that we have requests that take a much longer time to complete that later requests would, to simulate that we will modify the core_enrol_get_potential_users external function to take a minimum of 10 seconds. We will do that by adding the following lines of code to the get_potential_users method in /enrol/externallib.php: if ( strlen ( $search ) === 1) { sleep(10); } You can do it by applying the following patches, that are attached below one for each branch: For master: MDL-62194-master-simulate-long-request.diff git apply MDL-62194-master-simulate-long-request.diff For Moodle 3.6: MDL-62194-36-simulate-long-request.diff git apply MDL-62194-36-simulate-long-request.diff For Moodle 3.5: MDL-62194-35-simulate-long-request.diff git apply MDL-62194-35-simulate-long-request.diff Prerequisites A course ( Course 1 ) An Teacher enrolled on Course 1 Three users that have a matching start character in their name but then differentiate: Jane Eyre John Smith James Peach Testing that the autocomplete works Navigate to the Course 1 as Teacher In the hamburger menu select Participants Press Enrol users In the Select users search box start typing J Wait a second or two Then type ane so that the text in the box is Jane Stop typing Around 10 seconds after you completed step 4 you should see a list of users containing Jane Eyre , John Smith and James Peach (It may only show for half a second) Shortly after this the list of users should change to display Jane Eyre , verify that it no longer displays John Smith nor James Peach

      The cohort/tests/behat/upload_cohort_users.feature feature randomly fails, particularly on CI.

      The issues seems to be that the incorrect cohort is when setting up the enrolment sync, and as a result the test fails because the wrong students are enrolled.

      001 Scenario: Upload users and assign them to a course with cohort enrolment method enabled # /var/www/html/cohort/tests/behat/upload_cohort_users.feature:8
            And I should see "Mary Smith"                                                         # /var/www/html/cohort/tests/behat/upload_cohort_users.feature:44
              "Mary Smith" text was not found in the page (Behat\Mink\Exception\ExpectationException)
      

            dobedobedoh Andrew Lyons
            dobedobedoh Andrew Lyons
            Jun Pataleta Jun Pataleta
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Janelle Barcega Janelle Barcega
            Votes:
            1 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 50 minutes
                50m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.