setup for e2e tests outside of docs #9527
Description
Hi,
right now we sometimes misuse our docs to create examples for edge cases so that we can have e2e tests for those cases, instead of creating very simple examples and testing those.
Let's change our setup so that we can create e2e tests outside of the docs. Here is a first proposal:
Folder structure:
e2e_tests
templates
header_jquery.html
header_jqlite.html
fixtures
myFixture.html
myFixtures.js
tests
myTest.js
The header_jquery.html
resp header_jqlite.html
would contain the following:
<html>
<head>
<script src="<path to jquery.js resp jqlite.js>"></script>
<script src="<path to angular.js>"></script>
</head>
</body>
We would configure our http server to serve a url like http://localhost:8000/e2e/myTest.html?jquery
as follows:
header_jquery.html
- +
<script src="myTest.js"></script>
(via naming convention) - +
myTest.html
- +
</body></html>
When we run the tests via protractor we set a configuration variable env
to either jquery
or jqlite
and provide a helper function that returns the url for the html file given the __filename
of the e2e test using a naming convention.
E.g. within myTest.js
:
beforeEach(function() {
browser.get(fixtureFor(__filename)); // -> would result in `http://localhost:8000/e2e/myTest.html?jquery`
});
...
A first good candidate for this would be the e2e test for ngCsp
.
@petebacondarwin @caitp What do you think?
/cc @IgorMinar