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

Selenium Bridge #3279

Open
nevir opened this issue Nov 11, 2014 · 8 comments
Open

Selenium Bridge #3279

nevir opened this issue Nov 11, 2014 · 8 comments

Comments

@nevir
Copy link
Contributor

nevir commented Nov 11, 2014

It's time.

Use cases:

@nevir nevir self-assigned this Nov 11, 2014
@nevir nevir assigned nevir and unassigned nevir Feb 3, 2015
@nevir nevir removed their assignment May 4, 2015
@indolering
Copy link

I don't want to sound ungrateful for the work you guys do, but this is blocking functional testing. I tried solving this problem from the other end, using a standard Selenium library, but the shadow-dom screws up the query selectors and I couldn't translate them manually.

Maybe I could dance a jig and get the priority elevated a bit? Going on 1.5 years 😢.

@justinfagnani
Copy link
Contributor

Cab you give more information on what you need? Trying to pick up these issues is difficult with so little context.

@indolering
Copy link

I need to simulate filling in a form, clicking on submit, and checking on what is sent to my REST API. Polymer's on-* data-bindings just won't kick in when I use .click(). I can't even get it to notice when a dropdown has changed, I tried JQuery's .change() and YUI's input simulation library.

I can unit test individual functions and parse the dom, but it's very unproductive and brittle. Functional testing let's me test lots of components all at once. I can refactor several functions and test that things are still working without having to rewrite all of my tests.

It would be great if you could let me use Webdriver.io from within WCT or provide access to a Polyfilled selector from Selenium. Sorry, that statement doesn't make a whole lot of sense ;P. Let me try again: we need to be able to send WebDriver commands for things like manipulating the UI that can't be accomplished without Selenium's abstractions. Selenium has a raw JS API, but you could look into porting some of WebDriver.io's API, which wraps WebDriver's native commands in useful commands.

@indolering
Copy link

@justinfagnani, just to provide some context: the problem with functional testing outside of WCT is that the selector Selenium uses is isolated from the browser environment. This means you can't navigate the dom on browsers that don't implement the shadow-dom natively. I tried creating selectors that should work on polyfilled browsers, but Safari and IE refused to cooperate.

Update: I took another look at my code, saw some obvious mistakes, and I got a hacked selector working in Safari. I still need to test in IE and Edge, but I think I'll be able to do functional testing through wd.io.

@kito99
Copy link
Contributor

kito99 commented May 20, 2016

@indolering, how did this go? Any tips?

@indolering
Copy link

indolering commented May 25, 2016

@kito99 Thanks for the ping, I've been meaning to write about this.

I think not supporting functional testing has created a blind spot.

For one, there are edge-cases which are falling through the cracks. In some instances, I can't get Chrome to click on buttons using Selenium directly. I have no idea why this only occurs in Chrome, it works in other browsers and I can get it working in Chrome using a naive implementation.

There are also plenty of utility functions from wd.io (like waitForExist) which are necessary when testing functionality that relies on data-binding. WCT could port most of the functionality from wd.io with minimal effort.

Finally, had Polymer supported functional testing from the get-go, I don't think we would have deprecated /deep/. I think deprecating deep is one of those decisions which sounded good to a committee but fails to give respect to people that just want to get things done. No longer can one just find an element on a page using a simple string of text (like waitForExist("controller /deep/ child /deep/ #data-bound-input")). No, we shouldn't use it everywhere, but it has its place.

@justinfagnani if Polymer wants to remove the need for frameworks to build modern web apps, well, we need to be able to test those apps functionally.

@indolering
Copy link

@kito99 Here's a function you can use to clean your selectors:

  function clean(selector){
    if(GLOBAL.nativeShadow){
      return selector;
    } else {
      return selector.replace(/\/deep\/|::shadow|>>>/g, "");
    }
  };

@aomarks aomarks transferred this issue from Polymer/web-component-tester Jan 3, 2019
@stale
Copy link

stale bot commented Mar 3, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Mar 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants