faltest icon indicating copy to clipboard operation
faltest copied to clipboard

getAttribute may not work?

Open NullVoxPopuli opened this issue 6 years ago • 5 comments

I have this code in a page object:

  get inviteUrl() {
    let dataAttr = 'data-clipboard-text';
    let element = this._create(`[${dataAttr}]`);

    return element.getAttribute(dataAttr);
  }

and I placed a breakpoint on the return, and in the VS Code console, I did:

element.getAttribute('[data-clipboard-text]').then(console.log)
Promise { pending }
element.getAttribute('data-clipboard-text').then(console.log)
Promise { pending }
// results:
undefined
undefined

so, the element exists, and is selectable by attribute, but I can't get the attribute value? maybe?

anything look obviously wrong? I have a WIP PR: here: https://github.com/NullVoxPopuli/emberclear/pull/279

something unrelated, (if anyone tries to debug this), is that I have interactions that don't seem to finish before moving on to the next step, but also somehow don't fail? I seem to only be able to get the test moving along by setting these breakpoints: image

any help is much appreciated <3

NullVoxPopuli avatar Jan 12 '20 23:01 NullVoxPopuli

If you convert to this, does it work?

  async inviteUrl() {
    let dataAttr = 'data-clipboard-text';
    let pageObject = this._create(`[${dataAttr}]`);

    return await pageObject.getAttribute(dataAttr);
  }

kellyselden avatar Jan 13 '20 10:01 kellyselden

Is that the same as awaiting at the call site?

https://github.com/NullVoxPopuli/emberclear/pull/279/files#diff-06c4d850dcc0e9d111008e627c52f949R48

let [aInviteUrl, bInviteUrl] = await Promise.all([
    a.addFriend.inviteUrl,
    b.addFriend.inviteUrl,
]);

NullVoxPopuli avatar Jan 13 '20 10:01 NullVoxPopuli

my version isn't a getter, so you would have to invoke it.

kellyselden avatar Jan 13 '20 10:01 kellyselden

doh.

anywho, the plot thickens.

I did: pageObject.isExisting().then(console.log) and got true. :-\

however, the return value of the attribute is still undefined: image

Just added some more console logs:

    console.log(await pageObject.getText());
    console.log(await pageObject.getElement());
    console.log(await pageObject.waitForVisible());

image

but then:

      New users can add each other and then communicate
         fresh users can begin communicating with each other:
     waitForVisible: waitForVisible([data-clipboard-text]): element ("[data-clipboard-text]") still not displayed after 30000ms

NullVoxPopuli avatar Jan 14 '20 03:01 NullVoxPopuli

the value exists: image

NullVoxPopuli avatar Jan 14 '20 03:01 NullVoxPopuli