vmi / selenese-runner-java

Selenium IDE native format (selenese and side) interpreter.
Other
140 stars 83 forks source link

Is it support template literals? #324

Open zhiburt opened 4 years ago

zhiburt commented 4 years ago

Hey there, as I see when we have this command

{
      "id": "87663521-6dd0-432f-9f85-84d9eebb7806",
      "comment": "",
      "command": "executeScript",
      "target": "let bar = \"123\"; return `${bar} hello`",
      "targets": [],
      "value": "seller_url"
    }, 

In selenium and in your runner the result is different

Selenese

[2020-11-13 20:04:22.297 +03:00] [INFO] <4> Command#4: executeScript("let bar = \"123\"; return `${bar} hello`", "seller_url")
[2020-11-13 20:04:22.328 +03:00] [INFO] - [null hello]

Selenium-IDE

image

It will be fair to say that I've been developing a similar tool as selenese for a while and bump into the same issue :( I didn't know about existent of this repo before.

Thanks for selenese

ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals

vmi commented 3 years ago

I fixed this problem and released version 3.33.0. Please test it.

zhiburt commented 3 years ago

Hey @vmi I've review your changes it's seems to work :+1:

I would only mention in a doc comment for replaceVars that it prioritize selenium vars after js vars if the names are the same.

zhiburt commented 3 years ago

Actually there's a major change in your code isn't it? In case if variable isn't present in environment there will be not emitted anything but for example in Selenium IDE as I remember it emits empty string.

zhiburt commented 3 years ago

In case if variable isn't present in environment there will be not emitted anything but for example in Selenium IDE as I remember it emits empty string.

Ultimately I was wrong I guess.

But it will be interesting to hear you according to it