GithubHelp home page GithubHelp logo

Selenium IDE about turbolinks-compatibility HOT 8 CLOSED

reed avatar reed commented on July 18, 2024
Selenium IDE

from turbolinks-compatibility.

Comments (8)

reed avatar reed commented on July 18, 2024

Hey,

It seems like this (dealing with ajax) is a common issue for automated javascript testing frameworks. I'm not all that familiar with selenium, so you might want to take my advice with a grain of salt.

Is there a way to fix this without changing hundreds of lines in my test suites?

It might be possible for you to extend Selenium with your own custom code, but even then, you'd probably still have to change the syntax of your tests in some way.

If not, is there a reliable selenium method that can test that a turbolinked page has fully loaded?

Again, you might be able to write your own, but as far as native functions go, I'd think your best bet would be to use the waitForElement function. So your example would look something like this:

Open /
click link=Sign in
waitForElement id=session_email
type id=session_email [email protected]

Would that work?

from turbolinks-compatibility.

obromios avatar obromios commented on July 18, 2024

I will get in contact with the Selenium project and see if there is any interest in extending the code.

I will try the waitForElement and let you know the result.

Chris

from turbolinks-compatibility.

obromios avatar obromios commented on July 18, 2024

Hi

I tried the waitForElement but it is not valid Selenese. However, it led me to the waitForElementPresent command, which is valid and appear to do the same thing. In one of my test suites, I added this command after every clickAndWait (as indicated in the previous comment) and it worked in every case, apart from one place. This was the only place I have javascript, and it was a standard confirm after delete command. So the code looked like:

clickAndWait link=Delete
waitForElementPresent Are you Sure?
assertConfirmation   Are you Sure?

and the waitForElementPresent could not find the "Are you Sure".

I deleted the waitForElementPresent line just at this place in the test i.e it the code went back to

clickAndWait link=Delete
assertConfirmation   Are you Sure?

and the test passed. However, I am not sure if this is reliable, or whether waitForElementPresent is not neeed with the Javascript confirmation?

Overall it looks like this is on the right track, although the Selenium IDE loses much of its spontanaity as it is no longer possible to make and edit a test suite by recording mouse clicks when running turbolinks. I will take this up with the Selenium project.

Chris

from turbolinks-compatibility.

reed avatar reed commented on July 18, 2024

In my suggestion, I changed the clickAndWait command to just click because the waiting will be done on the next line. I don't know if that helps or changes anything, but it seems more logical to me.

I would think that the waitForElementPresent Are you Sure? command wouldn't work because the text isn't an element. Isn't there a waitForTextPresent command that would be better?

from turbolinks-compatibility.

obromios avatar obromios commented on July 18, 2024

You are correct, there is a waitForTextPresent command. However, this did not help. When I put it in, the test stalled at that point, and if I looked at the browser I could not see the delete confirmation message. Somehow the waitForTextPresent seems to be stopping or delaying the display of the confirmation. If I take out the waitForTextPresent it works fine. I wonder given it is a javascript message, whether the clickAndWait is sufficient?

You are correct about click being sufficient when followed by the waitForElementPresent.

I have posted a new topic concerning Turbolinks on the Selenium User group but have yet to have a response.

from turbolinks-compatibility.

reed avatar reed commented on July 18, 2024

Yeah, you're right, waitForTextPresent wouldn't work. If you take a look at the documentation here, I think you'll see that how you're doing it is sufficient.

I would think that how you have your tests now is how you should keep them. You wouldn't want them to be tailored for Turbolinks. You'd want them to pass regardless of whether Turbolinks is enabled.

from turbolinks-compatibility.

obromios avatar obromios commented on July 18, 2024

OK, then I understand an approach to make the Selenium IDE work under turbolinks. The only problem is that by the time I change all my tests, I will be so familiar with the Selenium language, then I may as well just work with Selenium language directly rather than work with IDE replay facility. But I guess we all have to grow up sometime.

Thank you for your help. I will post a summary, pointing to this issue report, on my Stack Overflow Turbolinks/Selenium question. If the Selenium project comes up with any information on this I will let you know.

from turbolinks-compatibility.

reed avatar reed commented on July 18, 2024

You're welcome. I'm glad I could help you.

from turbolinks-compatibility.

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.