pioneer
pioneer copied to clipboard
How to access app files from tests?
I'm using react.js for the UI and RCSS for css. In this way I get out of the way the dirty CSS. So no hard-coded classes are set in the UI. But in order to get the root class I need to get access to my component.
My app is using webpack as module loader and this should be considered when requiring files. So this is what I would need from a test file:
require('myApp/ui/Component')
I'm also thinking of putting test related things into the component for keeping everything in the same place. I dont't want to replicate the same component hierarchy both in ui and test folder.
var a = require('myApp/ui/Component')
var at = a.getTestData()
at.checkThatItExists()
at.anotherCustomMethod(someArg)
I see that the context of where the tests are running is not the browser because alert
is undefined. You might add this to your documentation because I would expect my tests to run in the browser environment.
Figured out how to get the context and use the browser api:
this.driver.executeScript('alert("test")')
But I would like to inspect the this
, which is the context of the test to better understand it.
Also would be nice to be able to debug some tests.
Related to https://github.com/mojotech/pioneer/issues/289