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

Behat: Mobile app testing does not load CSS files from plugins/site

    XMLWordPrintable

Details

    • MOODLE_37_STABLE
    • MOODLE_37_STABLE
    • MDL-64967-master
    • Hide

      You must have a developer setup with Behat working, including Behat mobile app testing, with a Chrome browser profile - see https://docs.moodle.org/dev/Acceptance_testing_for_the_mobile_app

      1. There are 2 test files attached to this issue, mdl64967.feature and .css. Download both these files.
      2. Put the files into lib/tests/behat folder.
      3. Edit the .feature file - there is a line about mobilecssurl. Change this line so that the URL is correct for your server.
      4. Run Behat init (php admin/tool/behat/cli/init.php)
      5. Look at the reported location for the behat.yml file, and open the file
      6. In the file, scroll down until you find the Chrome profile area (beginning 'chrome:' at the start of a line).
        • This should include under 'switches:' the switch '--disable-web-security'.
      7. Run Behat using a command line like: vendor/bin/behat --config PATH-TO-BEHAT-YML --profile=chrome --tags=mdl64967
        • This test should pass. (The test checks that the CSS file has taken effect.)
        • You also might notice that the header stripe has a pink-black gradient. 
      Show
      You must have a developer setup with Behat working, including Behat mobile app testing, with a Chrome browser profile - see https://docs.moodle.org/dev/Acceptance_testing_for_the_mobile_app There are 2 test files attached to this issue, mdl64967.feature and .css. Download both these files. Put the files into lib/tests/behat folder. Edit the .feature file - there is a line about mobilecssurl. Change this line so that the URL is correct for your server. Run Behat init (php admin/tool/behat/cli/init.php) Look at the reported location for the behat.yml file, and open the file In the file, scroll down until you find the Chrome profile area (beginning 'chrome:' at the start of a line). This should include under 'switches:' the switch '--disable-web-security'. Run Behat using a command line like: vendor/bin/behat --config PATH-TO-BEHAT-YML --profile=chrome --tags=mdl64967 This test should pass. (The test checks that the CSS file has taken effect.) You also might notice that the header stripe has a pink-black gradient. 

    Description

      When doing Behat testing of the mobile app, due to CORS security rules, the 'app' is not able to load CSS (and some other) files from the Moodle server on localhost. This includes the site-wide CSS if specified, and plugin CSS.

      The solution is simple, we need to ensure that Chrome web security is disabled for the Behat instance via the --disable-web-security flag.

       

      Attachments

        1. mdl64967.css
          0.2 kB
        2. mdl64967.feature
          0.5 kB

        Issue Links

          Activity

            People

              quen Sam Marshall
              quen Sam Marshall
              Mark Johnson Mark Johnson
              Andrew Lyons Andrew Lyons
              Jake Dallimore Jake Dallimore
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                20/May/19

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 hours, 30 minutes
                  2h 30m