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

Mobile Behat tests fail since app 3.8.2

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 3.8.3
    • Fix Version/s: None
    • Labels:
      None
    • Testing Instructions:
      Hide

      You will need a working Moodle Mobile developer installation (either a local installation or using Docker), and a Moodle installation that is configured to run Behat tests for the app. See documentation https://docs.moodle.org/dev/Acceptance_testing_for_the_mobile_app

      1 Start app version 3.8.1.

      If running the app in a raw developer environment, you can do this as follows:

      Warning: The first command throws away any changes you have made!

      • git reset --hard
      • git checkout v3.8.1
      • npm install
      • ionic build
      • ionic serve -b

      It's probably easier if you prefer to use Docker - I can't give exact commands because we're not allowed to use it, but this is the documentation on selecting a specific version https://docs.moodle.org/dev/Acceptance_testing_for_the_mobile_app#Setting_up_the_environment_using_Docker

      2 Run Behat

      • Place the attached file mdl68967.feature into the Moodle lib/tests/behat directory.
      • Run php admin/tool/behat/cli/init.php - note it should show the app version 3.8.1 (possibly twice) as part of the output.
      • Run the command given to start Behat, with any necessary profile options and selecting the tag 'mdl68967'. For example, my command is:
        vendor/bin/behat --config (mypath)/behat.yml --profile=chrome --tags=mdl68967

      EXPECTED: The test should pass (and you should see it logging into the mobile app).

      3 Start app version 3.8.2

      First stop the 3.8.1 version running - in a raw developer environment you can just press Ctrl+C.

      The rest is the same as step 1, you can do this:

      • git reset --hard
      • git checkout v3.8.2
      • npm install
      • ionic build
      • ionic serve -b

      Again it is probably easier in Docker.

      4 Run Behat

      • Re-run php admin/tool/behat/cli/init.php - this time it should show app version 3.8.2 as part of the output.
      • Run the command given to start Behat, with any necessary profile options and selecting the tag 'mdl68967'. For example, my command is:
        vendor/bin/behat --config (mypath)/behat.yml --profile=chrome --tags=mdl68967

       EXPECTED: The test should pass (and you should see it logging into the mobile app).

      Show
      You will need a working Moodle Mobile developer installation (either a local installation or using Docker), and a Moodle installation that is configured to run Behat tests for the app. See documentation https://docs.moodle.org/dev/Acceptance_testing_for_the_mobile_app 1 Start app version 3.8.1. If running the app in a raw developer environment, you can do this as follows: Warning: The first command throws away any changes you have made! git reset --hard git checkout v3.8.1 npm install ionic build ionic serve -b It's probably easier if you prefer to use Docker - I can't give exact commands because we're not allowed to use it, but this is the documentation on selecting a specific version https://docs.moodle.org/dev/Acceptance_testing_for_the_mobile_app#Setting_up_the_environment_using_Docker 2 Run Behat Place the attached file mdl68967.feature into the Moodle lib/tests/behat directory. Run php admin/tool/behat/cli/init.php - note it should show the app version 3.8.1 (possibly twice) as part of the output. Run the command given to start Behat, with any necessary profile options and selecting the tag 'mdl68967'. For example, my command is: vendor/bin/behat --config (mypath)/behat.yml --profile=chrome --tags=mdl68967 EXPECTED: The test should pass (and you should see it logging into the mobile app). 3 Start app version 3.8.2 First stop the 3.8.1 version running - in a raw developer environment you can just press Ctrl+C. The rest is the same as step 1, you can do this: git reset --hard git checkout v3.8.2 npm install ionic build ionic serve -b Again it is probably easier in Docker. 4 Run Behat Re-run php admin/tool/behat/cli/init.php - this time it should show app version 3.8.2 as part of the output. Run the command given to start Behat, with any necessary profile options and selecting the tag 'mdl68967'. For example, my command is: vendor/bin/behat --config (mypath)/behat.yml --profile=chrome --tags=mdl68967  EXPECTED: The test should pass (and you should see it logging into the mobile app).
    • Affected Branches:
      MOODLE_38_STABLE
    • Pull Master Branch:
      MDL-68967-master

      Description

      Since the Moodle app version 3.8.2, mobile Behat tests are all failing, because the screen where you enter a site was changed slightly.

      We noticed this because we have mobile app Behat tests for several of our in-house plugins. (Although we didn't notice it straight away because our CI infrastructure was broken for ages, but leaving that aside...)

      I will submit a fix. As part of this, presently there is no way for the Behat PHP code to behave differently based on the app version, so I will add a mechanism for this. (Behat scenarios can already use the special tags to enable/disable themselves for app versions, but you can't do that in PHP code.) As a result, the fixed Behat tests should work against both app 3.8.1 (or anything prior) and 3.8.2 (or later).

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              quen Sam Marshall
              Reporter:
              quen Sam Marshall
              Participants:
              Component watchers:
              Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: