CodeceptJS icon indicating copy to clipboard operation
CodeceptJS copied to clipboard

Playwright: Added possibility of creating of a context with a page

Open mirao opened this issue 3 years ago • 6 comments

Motivation/Description of the PR

  • I would like to be able to open page after restart of browser. I use this patch for a long time in my project and it works for me well.
  • Resolves #3248

Applicable helpers:

  • [ ] WebDriver
  • [ ] Puppeteer
  • [ ] Nightmare
  • [ ] REST
  • [ ] FileHelper
  • [ ] Appium
  • [ ] Protractor
  • [ ] TestCafe
  • [x] Playwright

Applicable plugins:

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

Type of change

  • [ ] :fire: Breaking changes
  • [ ] :rocket: New functionality
  • [x] :bug: Bug fix
  • [ ] :clipboard: Documentation changes/updates
  • [ ] :hotsprings: Hot fix
  • [ ] :hammer: Markdown files fix - not related to source code
  • [ ] :nail_care: Polish code

Checklist:

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

mirao avatar Aug 26 '22 18:08 mirao

Thanks, seems useful Could you add also usage documentation into https://github.com/codeceptjs/CodeceptJS/blob/3.x/docs/playwright.md

It would be also nice to have a more detailed example where you actually use _startBrowser and _startContextPage

This will help others to start using these custom methods

DavertMik avatar Aug 28 '22 19:08 DavertMik

Added an example into Playwright's docs, it's my use case for _createContextPage

mirao avatar Aug 31 '22 12:08 mirao

@mirao what do you think of adding restartBrowser into the Playwright helper?

Looks like it should belong there

DavertMik avatar Sep 13 '22 14:09 DavertMik

@DavertMik Yes, I can add the method restartBrowser() into the Playwright's helper. Or should I name it _restartBrowser()? I'm not sure about name convention.

mirao avatar Sep 13 '22 18:09 mirao

restartBrowser()

So user could call it natively from their tests, please update documentation accordingly to show simplified approach

DavertMik avatar Sep 14 '22 16:09 DavertMik

@DavertMik Done

mirao avatar Sep 14 '22 18:09 mirao

Thank you! Finally we have it!

DavertMik avatar Nov 29 '22 01:11 DavertMik