Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to access app files from tests? #292

Open
bitplanets opened this issue Dec 15, 2014 · 0 comments
Open

How to access app files from tests? #292

bitplanets opened this issue Dec 15, 2014 · 0 comments

Comments

@bitplanets
Copy link

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 #289

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant