Skip to content

Fix highlight element js handle context problem #3779

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

Conversation

philkas
Copy link
Contributor

@philkas philkas commented Jul 25, 2023

Motivation/Description of the PR

When elements in a frame were located and should be highlighted an Unexpected promise rejection terminates the test. So first step to fix it was, to add an .catch on the evaluate method because a promise is returned and the Promise Rejection was not handled by the try-catch block.
The second step was to fix the root of the problem which - in my optipn - was the context passed to highlightElement function. I changed it to _getContext() and so my tests run without a problem and elements in frames were highlighted correctly.

I applied the same changes for playwright, but I could test it only with puppeteer in my project. I am not sure if it is an issue for the WebDriver helper, too.

Applicable helpers:

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

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)

philkas added 3 commits July 25, 2023 13:45
- evalute returns a promise and the try-catch does not handle rejected
  promise exception correctly. Not sure if it is realy necessary to
  print the exception via console.error
- so the highlighting also works for elements in frames and shoulg
  prevent throwing promise rection exception when calling evaluate
  method of the passed context
@philkas philkas marked this pull request as ready for review July 25, 2023 19:45
@Arhell Arhell requested a review from DavertMik July 27, 2023 00:14
@DavertMik DavertMik merged commit dd82327 into codeceptjs:3.x Aug 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants