• Development

    Simple OAuth Token Handling with Cypress

    Here’s a quick (and dirty?) way to handle requesting an access token and using it in a subsequent request.

    You should probably pull the client_secret from an environment variable (not shown below).

    commands.js

     

    some-tests.spec.js

     

  • Development

    NightwatchJS Command to Repeat a Keystroke

    Here’s a simple custom command that lets you repeat a specific key (single or combo) N number of times.

    In the Drupal world you want to place this in your “Commands” directory (as defined in DRUPAL_NIGHTWATCH_SEARCH_DIRECTORY in web/core/.env).

    You’d want to change “sitename” to be your site’s name (so it feels namespaced).

    /tests/Nightwatch/Commands/sitenameRepeatKeystroke.js

     

    Using this in /tests/Nightwatch/Tests/misc.js with a 1000ms pause between each keystroke: