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

Behat: No way to test key shortcuts with letter keys

XMLWordPrintable

    • MOODLE_310_STABLE
    • MOODLE_310_STABLE, MOODLE_311_STABLE, MOODLE_39_STABLE
    • MDL-72152-master
    • Hide

      This step is not yet used in core, so to test it you need to:

      1. Place the attached mdl72152.feature in the folder lib/tests/behat
      2. Run Behat init

        php admin/tool/behat/cli/init.php

        or

        mdk behat

      3. Run behat using --tags=mdl72152

        php admin/tool/behat/cli/run.php --tags=@mdl72152

      The expected result is that at least one of the two test scenarios passes. Ideally both scenarios will pass but depending on browser/OS it's possible that the 'advanced' one will fail, which is probably OK. Here is an example successful run

      Moodle 4.0dev (Build: 20210709), c3577797226da11e21a0ad5c61394acc239bd9c7
      Php: 7.3.27, pgsql: 11.3, OS: Windows NT 10.0 AMD64
      Run optional tests:
      - Accessibility: No
      Server OS "WINNT", Browser: "firefox"
      Started at 15-07-2021, 16:40
      .................
       
      2 scenarios (2 passed)
      17 steps (17 passed)
      1m28.93s (54.66Mb)
      

      Show
      This step is not yet used in core, so to test it you need to: Place the attached mdl72152.feature in the folder lib/tests/behat Run Behat init php admin/tool/behat/cli/init.php or mdk behat Run behat using --tags=mdl72152 php admin/tool/behat/cli/run.php --tags=@mdl72152 The expected result is that at least one of the two test scenarios passes. Ideally both scenarios will pass but depending on browser/OS it's possible that the 'advanced' one will fail, which is probably OK. Here is an example successful run Moodle 4.0dev (Build: 20210709), c3577797226da11e21a0ad5c61394acc239bd9c7 Php: 7.3.27, pgsql: 11.3, OS: Windows NT 10.0 AMD64 Run optional tests: - Accessibility: No Server OS "WINNT", Browser: "firefox" Started at 15-07-2021, 16:40 .................   2 scenarios (2 passed) 17 steps (17 passed) 1m28.93s (54.66Mb)

      There is currently no way to press a key shortcut with a letter key in Behat, such as Ctrl+C or Ctrl+Q.

      It is probably not a good idea to do this for triggering browser functionality, but in a local plugin we have some code which uses special shortcuts with letters like this (to be handled via normal javascript on the webpage, cancelling any browser behaviour) and it would be good to test them.

      This would probably also allow testing of certain Atto features, for instance.

      At present, a step already exists which allows you to press various special keys, e.g.:

      And I press the Ctrl Tab key
      

      But it only allows special key names (like 'Tab' or 'Enter'), not letters.

      I propose changing it to also allow normal keys by specifying a single character:

      And I press the Ctrl L key
      

      This is a simple change.

            quen Sam Marshall
            quen Sam Marshall
            Huong Nguyen Huong Nguyen
            Andrew Lyons Andrew Lyons
            Ferran Recio Ferran Recio
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 10 minutes
                1h 10m

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