You can define custom properties in your intern config file and access then by requiring intern var intern = require('intern');
and using intern.config.{propertyName} to access the properties.
This isn’t obvious from the documentation but comes in handy when you need to dynamically set something based on the test config you’re running.
One example use case is if you’re running functional tests against browsers on both your local machine and browsers on mobile devices where your web app uses CORS headers. You might need to set the "Access-Control-Allow-Origin" header on your stubbed server responses dynamically based on which test suite you’re using due to the way mobile browsers access the intern proxy (through your machines IP).
Intern config for Mobile Browser functional testing
Intern config for Desktop Browser functional testing
Example wiremock module for stubbing out server responses using custom origin property for the value of the CORS header.
I took a ‘career break’ from April 2017 to April 2018, to travel, learn new skills, spend more time in bed and do stuff that I used to do before getting a de...
I had real trouble trying to find tutorials, or even solid documentation on how to get this setup, and even more trouble getting the Cloudformation scripts t...
If, like me, you want to run functional tests against a stub server, or fake server as some call it, the easiest way I’ve found is to simply start a wiremock...
Comments