Nightwatch: Pageobjects overwrite parameter of custom command

Created on 21 Dec 2015  路  3Comments  路  Source: nightwatchjs/nightwatch

Hi,
I'm trying to use this custom command:

https://github.com/maxgalbu/nightwatch-custom-commands-assertions/blob/0ad46de1009bafdfbe7154a5c54f8932f3dc87cf/js/commands/waitForText.js

When i call it without page objects it works: (see here: https://github.com/maxgalbu/nightwatch-custom-commands-assertions/blob/0ad46de1009bafdfbe7154a5c54f8932f3dc87cf/tests/runTests.js#L109-L118)

But when I call it with a page object, the second parameter of the command is not the variable I'm expecting, but this nightwatch function:

function () {
            parent.client.locateStrategy = prevLocateStrategy;
            if (callback) {
              callback.apply(parent.client, arguments);
            }
          }

This is an example:

var pageObject = browser.page.test();
browser.url("http://localhost/waitForText");
    pageObject.waitForText("@textWaitCss", function (text) {
        return text === "something else";
    });

This is the page object:

module.exports = {
    elements: {
        textWaitCss: {
            selector: '#div',
            locateStrategy: "css",
        }
    },
}
bug needs more info stale

All 3 comments

OMG!!! @maxgalbu I think that the jqueryClick custom command is not working as well when using a page object.

I am trying to do the following:
````
pageObject:
command(externalLinkText){
client.jqueryClick("'(@externalLink):contains(externalLinkText)')");
}
@externalLink: 'a[href^="http"]'

console:
$('a[href^="http"]:contains(text)')

````

@beatfactor which "more info" is required here?
馃憥 馃憥 Too bad that this is open for 3 years now. >_< .

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

@nekoyama I think this was fixed in https://github.com/nightwatchjs/nightwatch/commit/e7416d3ca96de62a6b6aee368da32e7e2c04d5a9 so I'll close this. Please let me know if you think this is a bug in nightwatch or my custom commands

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MateuszJeziorski picture MateuszJeziorski  路  3Comments

aking1012 picture aking1012  路  4Comments

manjero picture manjero  路  4Comments

willli666 picture willli666  路  3Comments

t00f picture t00f  路  3Comments