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

Error: using waitForElementVisible after to have switch from 0.7.11 to 0.8.0 #903

Closed
GBeauny opened this issue Mar 17, 2016 · 15 comments
Closed

Comments

@GBeauny
Copy link

GBeauny commented Mar 17, 2016

Hi,

We have just got an error on the command waitForElementVisible after a switch version (0.7.11 to 0.8.0).

Here:

�[0;31mError while running waitForElementVisible command: undefined is not a function
    at ElementsByRecursion.command (.../node_modules/nightwatch/lib/api/element-commands/_elementsByRecursion.js:66:32)
    at Object.Actions.elements (.../node_modules/nightwatch/lib/api/protocol.js:238:50)
    at F.WaitForElement.getProtocolCommand (/node_modules/nightwatch/lib/api/element-commands/_waitForElement.js:226:24)
    at F.WaitForElement.checkElement (.../node_modules/nightwatch/lib/api/element-commands/_waitForElement.js:204:8)
    at F.commandFn [as command] (.../node_modules/nightwatch/lib/api/element-commands/_waitForElement.js:142:8)
    at Object.commandFn (.../node_modules/nightwatch/lib/core/api.js:287:24)
    at AsyncTree.runCommand (.../node_modules/nightwatch/lib/core/queue.js:157:30)
    at AsyncTree.runChildNode (.../node_modules/nightwatch/lib/core/queue.js:117:8)
    at AsyncTree.walkDown (.../node_modules/nightwatch/lib/core/queue.js:83:10)
    at AsyncTree.walkUp (.../node_modules/nightwatch/lib/core/queue.js:100:8)
    at AsyncTree.walkDown (.../node_modules/nightwatch/lib/core/queue.js:93:12)�[0m

We have added that option in global.js:
waitForConditionTimeout:10000;
abortOnAssertFailure:true;

In the test file, it's a simple call of the command: .waitForElementVisible('selector');

The nodejs version used is 0.12.7 same error with the version 0.12.9.

Have you an idea?

Thanks.

@beatfactor
Copy link
Member

Can you give us some details about your test?

On Thu, Mar 17, 2016 at 12:09 PM, GBeauny [email protected] wrote:

Hi,

We have just got an error on the command waitForElementVisible after a
switch version (0.7.11 to 0.8.0).

Here:

�[0;31mError while running waitForElementVisible command: undefined is not a function
at ElementsByRecursion.command (.../node_modules/nightwatch/lib/api/element-commands/_elementsByRecursion.js:66:32)
at Object.Actions.elements (.../node_modules/nightwatch/lib/api/protocol.js:238:50)
at F.WaitForElement.getProtocolCommand (/node_modules/nightwatch/lib/api/element-commands/_waitForElement.js:226:24)
at F.WaitForElement.checkElement (.../node_modules/nightwatch/lib/api/element-commands/_waitForElement.js:204:8)
at F.commandFn as command
at Object.commandFn (.../node_modules/nightwatch/lib/core/api.js:287:24)
at AsyncTree.runCommand (.../node_modules/nightwatch/lib/core/queue.js:157:30)
at AsyncTree.runChildNode (.../node_modules/nightwatch/lib/core/queue.js:117:8)
at AsyncTree.walkDown (.../node_modules/nightwatch/lib/core/queue.js:83:10)
at AsyncTree.walkUp (.../node_modules/nightwatch/lib/core/queue.js:100:8)
at AsyncTree.walkDown (.../node_modules/nightwatch/lib/core/queue.js:93:12)�[0m

We have added that option in global.js:
waitForConditionTimeout:10000;
abortOnAssertFailure:true;

In the test file, it's a simple call of the command:
.waitForElementVisible('selector');

The nodejs version used is 0.12.7 same error with the version 0.12.9.

Have you an idea?

Thanks.


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#903

@alesanu
Copy link

alesanu commented Mar 17, 2016

I did the same update of the nightwatch but the version was from 0.7.9 to 0.8.0 (and 0.8.18). I got the same error in the test suit and looks like this: While I don't have failure on assertion everything it's ok, but after I got a failure in the next test cases I received an error related to waitForElement

@GBeauny
Copy link
Author

GBeauny commented Mar 17, 2016

Here an example of the test case:

  "test case" : function(client) {
    var widget = client.page.Action();
    var widgetSections = client.page.Sections();
    var channels = widgetSections.section.channels;
    client
     .init()
     .waitForElementVisible("body"); -> The error appear at this moment, the command is undefined
    widget
     .Login(Cred.tests.name, Cred.tests.password);
    widget
     .goToWidget("1", "channels");
    channels
     .click("@filters")
     .expect.element("@periodFilter").to.be.visible.before(1000);
    channels
     .expect.element("@mediaTypesFilter").to.be.visible;
    channels
     .expect.element("@topicsFilter").to.be.visible;
    channels
     .expect.element("@sentimentsFilter").to.be.visible;
    channels
     .expect.element("@countriesFilter").to.be.visible;
    channels
     .expect.element("@languagesFilter").to.be.visible;
    channels
     .click("@favoritesFilter")
     .expect.element("@favoritesFilterContainer").to.be.visible.before(1000);
    client
     .end();
  }

Another tests using the same command just after init() passed which is really strange.

In the settings, we have added also this properties: "skip_testcases_on_fail" : false.

@GBeauny
Copy link
Author

GBeauny commented Mar 17, 2016

Hi,

@beatfactor, so, apparently we have this error, only when we have .assert.containsText(); before that fail.
In my case, i have one test which contain an .assert.containsText() and an another test i've paste just below.

When i execute both tests, the .assert.containsText(); fail and then i got the error on the second test with the waitForElementVisible command.

I will you know i have also the error when the .assert.containsText() doesn't fail.

For now, we have replaced the .assert by .verify on every assert and it works with the last version of nightwatch.

@GBeauny
Copy link
Author

GBeauny commented Mar 18, 2016

Hi @beatfactor,

An example of the test reduced:

One section File, called sections.js:

module.exports = {
  sections : {
      test : {
      selector : "body",
      elements : {
        testGoogle : {
          selector : "#_eEe"
        }
      }
    }
  }
};

The test file:

module.exports = {
  tags: ['test'], 

  "test 1" : function(client) {
    var widgetSections = client.page.sections();
    var test = widgetSections.section.test;
    client
     .init("https://google.com")
     .waitForElementVisible("body");
    test
       .assert.containsText("@testGoogle", "test")
    client
     .end();
  },
    "test 2" : function(client) {
    client
     .init("https://google.com")
     .waitForElementVisible("body");
    client
     .end();
  }
};

While executing the tests, you'll get an error on the first tests with the assert.contains() command. On the second tests, you'll get an error on the command waitForElementVisible, the same, i gave to you in the first message.

This error appear also with expect..

Important: You can reproduce it, since the nightwatch version: 0.8.0.
Looks like also, without section i can't reproduce it.
This issue is very annoying, most of our tests got wrong failure. In the mean time, we could replace assert by verify but the expect are still providing the error.

Thanks

@GBeauny
Copy link
Author

GBeauny commented Mar 21, 2016

Hi @beatfactor

You could reproduce the issue? Tell me if you need anything.

Thanks

@beatfactor
Copy link
Member

Thanks, we'll look into it soon.

@GBeauny
Copy link
Author

GBeauny commented Mar 29, 2016

Any news?

Thanks.

@Jezternz
Copy link

Jezternz commented Apr 1, 2016

I think I am seeing the same thing, just to clarify, there is reported failure, but appears to just hang, and doesn't return control?

@GBeauny
Copy link
Author

GBeauny commented Apr 5, 2016

and return an : undefined is not a function. Yes.
Waiting for a feedback from @beatfactor.
Can't wait. ^_^

@beatfactor beatfactor added the bug label Apr 5, 2016
@GBeauny
Copy link
Author

GBeauny commented Jun 1, 2016

Any news about this bug, this is very annoying? Thanks

@GBeauny
Copy link
Author

GBeauny commented Jun 28, 2016

@beatfactor, plz do you have any update on this bug? The bug is still reproducible on the last version 9.5.0.
Thanks.

@Jezternz
Copy link

@GBeauny I am not sure if its the case for you, but I think I solved this by calling .end() only when all tests in a file are completed, not after each individual test.

eg:

{
  test1: ...,
  test2: ...,
  "after": function(browser)
  {
    browser.end();
  }
}

If this is your problem, a positive change to Nightwatchjs would be to throw a more readable error when .end() is called twice, something like ".end() has been called twice, .end() can only be called once per test file."

@GBeauny
Copy link
Author

GBeauny commented Jun 30, 2016

@Jezternz Yes, thank you, it's working. But if it was working before then it's a regression. :).

@stale
Copy link

stale bot commented Nov 14, 2018

This issue has been automatically marked as stale because it has not had any recent activity.
If possible, please retry using the latest Nightwatch version and update the issue with any relevant details. If no further activity occurs, it will be closed. Thank you for your contribution.

@stale stale bot added the stale label Nov 14, 2018
@stale stale bot closed this as completed Nov 21, 2018
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

4 participants