Polymer / tattoo

Test All The Things Over and Over
BSD 3-Clause "New" or "Revised" License
12 stars 3 forks source link

Make sure we include PSK #9

Open justinfagnani opened 8 years ago

justinfagnani commented 8 years ago

PSK says they get broken a lot...

samccone commented 8 years ago

:+1: good idea :)

usergenic commented 7 years ago

So this is an interesting issue, because the way tattoo works right now is that it treats all the repositories under test as web components in the same flat namespace... however, the Polymer Starter Kit is an App, so running wct inside of it without the bower_components folder inside of it leads to a sad:

tattoo PolymerElements/polymer-starter-kit -f
Getting Repo details from GitHub...      [=============================================] 100%
Cloning/Updating repos...                [=============================================] 100%
Installing dependencies with bower...    [=============================================] 100%
Testing 1 repo(s)...                     [=============================================] 100%
---
PolymerElements/polymer-starter-kit output:
Installing and starting Selenium server for local browsers
Selenium server running on port 64105
Web server running on port 2000 and serving from /Users/brendanb/src/scratch/tat/tattoo_workspace/polymer-starter-kit
chrome 54                Beginning tests via http://localhost:2000/components/polymer-starter-kit/generated-index.html?cli_browser_id=0
chrome failed to maximize
404 GET /components/polymer-starter-kit/bower_components/webcomponentsjs/webcomponents-lite.js
404 GET /components/polymer-starter-kit/bower_components/polymer/polymer.html
chrome 54                ✖ Test Suite Initialization

  Polymer is not defined
    <unknown> at   <unknown> at /components/polymer-starter-kit/src/my-view1.html:33:0

chrome 54                ✖ test/my-view1.html » my-view1 tests » Number in circle should be 1

  Polymer is not defined
    <unknown> at   Context.<anonymous> at my-view1.html:41:0

404 GET /components/polymer-starter-kit/bower_components/webcomponentsjs/webcomponents-lite.js
404 GET /components/polymer-starter-kit/bower_components/polymer/polymer.html
chrome 54                ✖ Test Suite Initialization

  Polymer is not defined
    <unknown> at   <unknown> at /components/polymer-starter-kit/src/my-view1.html:33:0

chrome 54                ✖ test/my-view1.html » my-view1 tests » Number in circle should be 1

  Polymer is not defined
    <unknown> at   Context.<anonymous> at my-view1.html:41:0

chrome 54                Tests failed: 4 failed tests
Test run ended in failure: 4 failed tests

chrome 54 (0/0/4)

Error: 4 failed tests
---
FAILED: PolymerElements/polymer-starter-kit

0 / 1 tests passed. 0 skipped.

However, if I have a short pre-processing step and run ln -s .. tattoo_workspace/polymer-starter-key/bower_components before tattoo executes wct...

Getting Repo details from GitHub...      [=============================================] 100%
Cloning/Updating repos...                [=============================================] 100%
Installing dependencies with bower...    [=============================================] 100%
Testing 1 repo(s)...                     [=============================================] 100%
---
PASSED: PolymerElements/polymer-starter-kit

1 / 1 tests passed. 0 skipped.

While the circularity of the link in this approach is a little concerning and we probably would want to inspect apps for a ".bowerrc" to check that they don't expect something other than "bower_components", it certainly expands tattoo's usefulness if it can test apps, even multiple apps, in a single run.

It remains to decide what the condition is for whether to do the symlink when setting up the repo. Do we require a user-specified flag for the repo, like -a/--app or do we use a heuristic, or do we always make the symlink.

Also, what about environments without symlink support? Thats no good.

What may be good (convenient for tattoo, maybe not as useful to others, but maybe) would be for wct to support a flag like --components-path which we would provide the tattoo_workspace path as the value and wct would serve out components that were not present in the repos local components path, essentially acting as a failover, but serving the purpose of providing components form an alternate source, and this would require us to not use symlinks or copy files etc.

Once we add local filesystem path specifications for repos to test, the following tattoo invocation could be made from within the polymer-starter-kit folder, though this approach would limit tattoo to testing only one app at a time, so not super great.

tattoo . --workspace-dir=bower_components -r Polymer/polymer#2.0-preview
usergenic commented 7 years ago

@justinfagnani @rictic since polyserve support a -c option for specifying component directory, can the new wct which uses polyserve provide a --polyserve-flags option that would enable tattoo to send it a -c?

usergenic commented 7 years ago

if polyserve obeyed .bowerrc to obtain the directory to use in the URL, tattoo could simply hand every wct invocation the -c flag pointing to the tattoo_workspace, and then apps would test as easily as elements with no additional work. The suggestion to use .bowerrc of the test repo was mentioned here in polyserve issue about specifying the url for the components: https://github.com/PolymerLabs/polyserve/issues/101