Skip to content
This repository has been archived by the owner on Dec 19, 2017. It is now read-only.

Port the gold-elements tests! #3

Closed
jakemac53 opened this issue Aug 5, 2015 · 15 comments
Closed

Port the gold-elements tests! #3

jakemac53 opened this issue Aug 5, 2015 · 15 comments

Comments

@jakemac53
Copy link
Contributor

Part of #1.

@vsheyanov
Copy link
Contributor

Hi Jacob,
Are there any examples how to create tests for elements that require to have some html (templates/custom components) and that more complex than current examples with iron_a11_*?
I'd like to help and looking for examples.
Thanks

@jakemac53
Copy link
Contributor Author

Here is the branch I have going for the iron tests, https://github.com/dart-lang/polymer_elements/tree/iron-tests All iron tests are now in master. I have added a few functions to the common.dart file under test. One of them is fixture, which works basically like the same method you see in the polymer js tests, although it doesn't require the extra wrapper element (just put the id right on the template tag). See https://github.com/dart-lang/polymer_elements/blob/master/test/iron_dropdown_test.dart#L28 and https://github.com/dart-lang/polymer_elements/blob/master/test/iron_dropdown_test.html#L25 for example usage.

I also added jsPromiseToFuture and wait which are useful for removing some boilerplate in tests. I can submit the changes I have this morning so those things will be available for you to use as well.

In terms of tests that require you to create an example element, those are usually tests for behaviors, which are blocked on dart-archive/polymer-dart#551. These can all be skipped for now. Other tests which create custom elements you can just keep the js custom element from the original test in most cases.

@jakemac53
Copy link
Contributor Author

Ok merged the iron-element tests that I have done into master so you can see a lot more examples there. The main piece missing right now is nice server mocking, so you may need to skip some tests until we have that, you can link #16 as the skip message for any of those.

@vsheyanov
Copy link
Contributor

Working on this one. It'll be ready soon.

@jakemac53
Copy link
Contributor Author

great!

@vsheyanov
Copy link
Contributor

Is there a server where tests for PolymerJS elements are running? Some of my tests are failing and I want to check results for original tests.

@vsheyanov
Copy link
Contributor

Actually, do you have any advice how should I run tests before creating pull request?
thanks!

vsheyanov added a commit to vsheyanov/polymer_elements that referenced this issue Aug 11, 2015
@ErikGrimes
Copy link
Contributor

I had the same question regarding the polymerjs tests.

@vsheyanov Some of the polymerjs tests are out of date. For example, it looks like the tests in polymerjs for gold-email-input don't match the current implementation of the element. The js tests check for display: none for the error, but the implementation is using visibility:hidden. You can toss elements into a demo app to help figure out if it's the test or the element that's the problem. You can also look at the issues in the element's repo to see known problems and sometimes if tests are failing.

@jakemac53
Copy link
Contributor Author

They do have a CI server, but I have noticed its not integrated into all of the repos. If any tests are failing please mark them as skip (its a named argument to the test method), and link a github issue as the message. I have found 4-5 other failing tests already and marked them this way. Once we have something in place for all the elements we can address the failing tests.

You can also check the original github repos and see if there is a more updated test.

@jakemac53
Copy link
Contributor Author

@vsheyanov running the js tests standalone is a bit of a pain, you will need to install node/npm and bower. Essentially the process is this:

  1. Clone the github repo, most live here, except the google-web-components which live here.
  2. Install node/npm, and then globally install bower using npm.
  3. Run bower update from the root of the github repo (bower is the package manager used for polymer js elements).
  4. Open up the html file for the test you want to run, and change the html imports/scripts to point into the bower_components folder instead of reaching out to the folder next to your repo. Alternatively you can clone the repos for all dependencies into the same top level folder, but I find that to be a bit painful (you will end up cloning a LOT of repos). I don't know why they don't point to the bower_components folder by default..... but none of them seem to.
  5. Run a server in the root of the repo, and open up the index.html file inside of the test folder in your browser. This will run the tests.

Doing this should give you a renewed appreciation for dart :)

@jakemac53
Copy link
Contributor Author

@vsheyanov To run all the tests on the dart side of things, just do pub run test -pdartium. If you want to run the compiled to js tests, you can run pub serve test, and then pub run test -pchrome --pub-serve=8080. The js tests you will usually have to run a few times, the bootstrapping we do breaks some assumptions in the test package today, so it times out during the dart2js compilation. Just keep running it until you no longer get the timeouts (leave pub serve running!). I would just run the dartium tests though for now.

@vsheyanov
Copy link
Contributor

@ErikGrimes thanks, issue with display:none is one of that I've found out. And wanted to ask if it should be changed to visibility :)

@jakemac53 I took all tests from original repo, so that should be fine.
As usual thanks for the update!

@vsheyanov
Copy link
Contributor

Hi guys, I'm trying to run all tests using pub run test -pdartium command but it throws timeout most of the time... sometime some of the test run, but half of them would timeout anyway.. and looks like tests are run not sequentially, but simultaneously which doesn't look good...
When I run test for specific file - no problems at all (usually).

When I run tests in chrome - they are executed sequentially as expected... and yes, it on Windows...

@jakemac53
Copy link
Contributor Author

I recently submitted some fixes for flaky timeouts relating to the iron-* and google-* tests, so if that's what you were seeing then you can try just rebasing on master and it will probably fix your issues.

@jakemac53
Copy link
Contributor Author

closed by #23

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

3 participants