Giter Site home page Giter Site logo

Comments (15)

vsheyanov avatar vsheyanov commented on July 20, 2024

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

from polymer_elements.

jakemac53 avatar jakemac53 commented on July 20, 2024

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.

from polymer_elements.

jakemac53 avatar jakemac53 commented on July 20, 2024

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.

from polymer_elements.

vsheyanov avatar vsheyanov commented on July 20, 2024

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

from polymer_elements.

jakemac53 avatar jakemac53 commented on July 20, 2024

great!

from polymer_elements.

vsheyanov avatar vsheyanov commented on July 20, 2024

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.

from polymer_elements.

vsheyanov avatar vsheyanov commented on July 20, 2024

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

from polymer_elements.

ErikGrimes avatar ErikGrimes commented on July 20, 2024

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.

from polymer_elements.

jakemac53 avatar jakemac53 commented on July 20, 2024

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.

from polymer_elements.

jakemac53 avatar jakemac53 commented on July 20, 2024

@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 :)

from polymer_elements.

jakemac53 avatar jakemac53 commented on July 20, 2024

@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.

from polymer_elements.

vsheyanov avatar vsheyanov commented on July 20, 2024

@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!

from polymer_elements.

vsheyanov avatar vsheyanov commented on July 20, 2024

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...

from polymer_elements.

jakemac53 avatar jakemac53 commented on July 20, 2024

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.

from polymer_elements.

jakemac53 avatar jakemac53 commented on July 20, 2024

closed by #23

from polymer_elements.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.