Skip to content

fix: puppeteer basic auth fix #2178

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

ian-bartholomew
Copy link
Contributor

Motivation/Description of the PR

Noticed an issue with basic auth in the puppeteer helper when running multiple sessions. The authentication would be sent in the first scenario, but in subsequent scenarios it wouldn't get sent.

Applicable helpers:

  • Webdriver

  • Puppeteer

  • Nightmare

  • REST

  • Appium

  • Protractor

  • TestCafe

  • Description of this PR, which problem it solves
    I found that the isAuthenticated boolean wasn't getting reset to false, so this adds that reset in _stopBrowser. This also adds an await to the authenticate call so that it doesn't set isAutheticated before successfully authenticating.

Type of change

  • Breaking changes
  • New functionality
  • Bug fix
  • Documentation changes/updates
  • Hot fix
  • Markdown files fix - not related to source 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)

@@ -22,7 +22,7 @@ describe('Puppeteer - BasicAuth', () => {
global.codecept_dir = path.join(__dirname, '/../data');

I = new Puppeteer({
url: 'http://localhost:8000',
url: siteUrl,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small fix for running tests (locally at least). I found that when running docker-compose run --rm test-helpers test/helper/Puppeteer_test.js that using localhost would error out with Error: net::ERR_CONNECTION_REFUSED at http://localhost:8000/basic_auth

@ian-bartholomew ian-bartholomew changed the title Bugfix/puppeteer basic auth fix fix: puppeteer basic auth fix Jan 31, 2020
@DavertMik
Copy link
Contributor

Codacy Here is an overview of what got changed by this pull request:

Clones added
============
- test/helper/Puppeteer_test.js  2
         

See the complete overview on Codacy

@DavertMik
Copy link
Contributor

Thank you!

@DavertMik DavertMik merged commit 048e01d into codeceptjs:master Feb 5, 2020
kobenguyent added a commit that referenced this pull request Feb 6, 2020
we have #2178 to fix puppeteer helper, so this patch will be applied in Playwright as well.
DavertMik added a commit that referenced this pull request Feb 11, 2020
* udpated changelog

* initial Playwright implementation

* (fix): add wait for actions call

* (fix): more failed webapi tests

* (test): trigger playwright tests on CI

* (lint): please hound ^^

* (fix): remove wrongly use .only

* (fix): setCookie method to parse param as array

* (fix): change to setCookies

* (fix): tabs tests

* (fix): please hound

* (fix): remove unused console.log

* updated Playwright to make all tests pass

* updated playwright tests to start a server

* upated server start

* Create playwright.md

* (fix): update based on comments

* add playwright option to init cmd

* add option to show browser when initialising

* (fix): basic auth

we have #2178 to fix puppeteer helper, so this patch will be applied in Playwright as well.

* enable describe('Playwright - BasicAuth') test

* updated to playwright 0.10.0

* fixed tests, updated docs

* updated docs

* ported patch from #2181

Co-authored-by: Peter Nguyen Tr <peter.nguyentr@gmail.com>
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