Taiko confirm(func) doesn't work with gauge-js
Closed this issue · 4 comments
navel3 commented
Expected behavior
The callback function passed to confirm(func) is called.
Actual behavior
Actual confirm dialog is shown, and following message is printed in the console.
There is no handler registered for confirm popup displayed on the page file:///home/vagrant/dev/gauge-test/index.html.
This might interfere with your test flow. You can use Taiko's confirm API to
handle this popup.
Please visit https://docs.taiko.dev/#confirm for more details
Steps to reproduce
-
gauge init js
-
Create following files in the project directory.
[index.html]
<!DOCTYPE html>
<html lang="en">
<body>
<button onclick='window.confirm("test")'>Press</button>
</body>
</html>
[specs/confirm.spec]
# Confirm test
## Step
* Perform
[tests/confirm.js]
const { goto, click, button, confirm, accept } = require("taiko");
const { print } = require("./mod.js");
step("Perform", async () => {
const f = () => {};
console.log("1", typeof f, f instanceof Function); // 1 function true
print(f); // 2 function false
await goto("file:///<project-dir>/index.html");
confirm(async () => {
console.log("ok");
await accept();
});
await click(button("Press")); // actual confirm dialog is shown
});
[tests/mod.js]
const print = (f) => console.log("2", typeof f, f instanceof Function);
module.exports = { print };
- gauge run specs/confirm.spec
Note
- As commented in the above, it seems to a function passed to function which is defined in other module is not evaluated as instanceof Function.
- When run a javascript file with node command, a function passed to imported function is evaluated as instanceof Function normally.
- In Taiko REPL, confirm(func) is works normally.
- confirm("string or regex", func) is works normally even with gauge-js.
Versions
Gauge version: 1.1.1
Plugins
-------
html-report (4.0.12)
js (2.3.12)
screenshot (0.0.1)
navel3 commented
This behavior may relates.
NivedhaSenthil commented
Thanks for reporting, could replicate the issue we will look at fixing this.
NivedhaSenthil commented
Fixed in latest version of Taiko 1.0.23
navel3 commented
I have checked the latest version.
The issue is gone. Thank you!