Skip to content

Fix Wrong Order with async MetaSteps #3393

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

Merged
merged 2 commits into from
Aug 20, 2022

Conversation

dwentland24
Copy link
Contributor

@dwentland24 dwentland24 commented Aug 19, 2022

The reporters loose track of the meta step information which results in a wrong order of the steps in the report.

Root Cause

When a meta step gets executed it prepends a before listener to add the meta step information to a step. This works well with sync functions because it is finished after all steps inside the meta step are executed. And after that the prepended listener gets removed.
With an async function a promise gets returned before the all steps are executed inside the meta step. Now the prepended listener gets removed before the steps were executed and the steps do not getting its meta step information properly.

Proposed Solution

I implemented a differentiation between async und sync functions. Async functions are handled with then() and catch() to make sure all steps were executed before the listener gets removed.
Sync functions are handled like before.

Additional changes

Fixed a bug in the runners pageobject test as it was failing with my changes.

Resolves #3131
Resolves #3132

Applicable helpers:

  • WebDriver
  • Puppeteer
  • Nightmare
  • REST
  • FileHelper
  • Appium
  • Protractor
  • TestCafe
  • Playwright

Applicable plugins:

  • allure
  • autoDelay
  • autoLogin
  • customLocator
  • pauseOnFail
  • coverage
  • retryFailedStep
  • screenshotOnFail
  • selenoid
  • stepByStepReport
  • stepTimeout
  • wdio
  • subtitles

Type of change

  • 🔥 Breaking changes
  • 🚀 New functionality
  • 🐛 Bug fix
  • 📋 Documentation changes/updates
  • ♨️ Hot fix
  • 🔨 Markdown files fix - not related to source code
  • 💅 Polish code

Checklist:

  • Tests have been added
  • Documentation has been added (Run npm run docs)
  • Lint checking (Run npm run lint)
  • Local tests are passed (Run npm test)

@DavertMik
Copy link
Contributor

Thank you!

@DavertMik DavertMik merged commit 91ade67 into codeceptjs:3.x Aug 20, 2022
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

Successfully merging this pull request may close these issues.

I.say folding in Allure report async steps reset metaStep
2 participants