Skip to content
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

in BDD or Gherkin mode, the After is not synchronous where next scenario starts (while the After is still executing) #4288

Open
nnanoob opened this issue Apr 4, 2024 · 7 comments

Comments

@nnanoob
Copy link

nnanoob commented Apr 4, 2024

What are you trying to achieve?

In BDD / Gherkin mode, After to be synchronous so it run to completion before the next scenario starts

Scenario 1
After --- run completely before Scenario 2 start
Scenario 2

What do you get instead?

After is asynchronous so it might still running while the next scenario already starting
It seems that the After implementation is based on event which is independent from the promise chain.

Details

  • CodeceptJS version: 3.5.13
  • NodeJS Version: v18.19.0
  • Operating System: macOS
  • webdriverio 8.32.0
@nnanoob
Copy link
Author

nnanoob commented Apr 4, 2024

this is closely related to this #3870 but in this case, we are on After where we requires teardown of certain UI steps (which means we need to use the I and the approach of recorder doesn't work for us) before proceeding to next scenario

@myrepojuly1987
Copy link

Agreed… this is really troubling a lot especially handling the after test events in the UI. Would be great if @kobenguyent you can fix this. I believe there was a similar issue with WebdriverIO and they fixed it.

@myrepojuly1987
Copy link

@DavertMik would you be able to help us with this issue? Pls let us of you need more info…

@DavertMik
Copy link
Contributor

It seems that the After implementation is based on event which is independent from the promise chain.

@nnanoob @myrepojuly1987

sorry, I don't think I can provide a quick fix on this

maybe you could use recorder to synchonize actions inside it?

After(() => {
recorder.add(() => {
   // my actions
  })
})

If you have better suggestion, please send a PR

@myrepojuly1987
Copy link

myrepojuly1987 commented Apr 13, 2024

@DavertMik Adding the actions to the recorder does not work and it just hangs. Sure, will check for better suggestions.

Copy link

This issue is stale because it has been open for 90 days with no activity.

@github-actions github-actions bot added the stale label Jul 13, 2024
@myrepojuly1987
Copy link

@DavertMik @kobenguyent - could you please address this? At least if we could use the “I” object in the hooks, it would help us. Currently, adding the “I” object to the recorder inside a hook does nothing and just hangs.

@github-actions github-actions bot removed the stale label Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants