-
Notifications
You must be signed in to change notification settings - Fork 39
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
Unable to run async functions within a step table #570
Comments
It's not under active development anymore. Please read getgauge/gauge#1732 PR's to fix issues will be accepted. |
@zabil I want to submit a fix for this issue, but the contribution repo is not up to date with the gauge-js master (https://github.com/getgauge-contrib/gauge-jso). How do I get it up to date? Do I have to update it in my fork and submit a separate PR for that first? |
https://github.com/getgauge-contrib/gauge-jso is not the correct repo. You can fork this repo and send a pull request with your changes. |
The repo mentioned at Is wrong, please feel free to correct that too! |
…tions to resolve issue getgauge#570. Also had to bump the ecmaVersion to 8 in eslint to support async await Signed-off-by: Autumn Calhoun <[email protected]>
Signed-off-by: Autumn Calhoun <[email protected]>
#571) * Added another function to Table that will process async callback functions to resolve issue #570. Also had to bump the ecmaVersion to 8 in eslint to support async await Signed-off-by: Autumn Calhoun <[email protected]> * #570 updated per code review comments Signed-off-by: Autumn Calhoun <[email protected]> --------- Signed-off-by: Autumn Calhoun <[email protected]>
…e callback function is an AsyncFunction Signed-off-by: Autumn Calhoun <[email protected]>
…ck function is an AsyncFunction Signed-off-by: Autumn Calhoun <[email protected]>
Describe the bug
Steps are getting skipped, causing the test to fail, when you have an async function as your callback function in table.entries.
To Reproduce
Steps (or project) to reproduce the behavior:
I am using gauge-js with playwright-js. I have the following scenario that has a step with a table:
Create Multiple Orders In Single Test
Login as "user"
Open "site" "811811" from the home page
Create Order
The step implementation is as follows:
step("Create Order
", async function (table) {let order = new Order(gauge.dataStore.scenarioStore.get("page"))
})
When I run the test I get the following error: UnhandledPromiseRejectionWarning: page.click: Target closed. The page.click is happening in the createOrder async function
I was able to get past this by creating my own instance of the Table function and making async (see below), but am wondering if this can be officially supported or is it already and I just missed it somewhere?
Expected behavior
table.entries waits for the async callback function to complete before proceeding
Versions:
Gauge version: 1.4.3
Commit Hash: f98dd40
Plugins
flash (0.0.2)
html-report (4.1.4)
js (2.4.0)
python (0.3.17)
screenshot (0.1.0)
spectacle (0.1.4)
xml-report (0.2.3)
Additional context
I noticed that the Table entries function is not asynchronous, so I created my own instance and made it asynchronous and now the test runs as expected.
var AsyncTable = function (protoTable) {
Object.assign(this, protoTable);
};
module.exports = AsyncTable;
step("Create Order
let order = new Order(gauge.dataStore.scenarioStore.get("page"))
let async_table = new AsyncTable(table)
})
The text was updated successfully, but these errors were encountered: