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

fix(playwright): session doesn't respect the context options #4111

Conversation

kobenguyent
Copy link
Collaborator

Motivation/Description of the PR

Before:

Helpers: Playwright
Plugins: screenshotOnFail, tryTo, retryFailedStep, retryTo, eachElement

Repro --
    [1]  Starting recording promises
    Timeouts: 
 › [Session] Starting singleton browser session
  Reproduce issue
    I am on page "https://example.com"
 › [New Context] {}
 › [Browser:Error] Failed to load resource: the server responded with a status of 404 ()
    user1: I am on page "https://example.com"
    user1: I execute script () => {
      return { width: window.screen.width, height: window.screen.height };
    }
sessionScreen is {"width":1280,"height":720}
    [1] <session:user1> Error | AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:

  assert(sessionScreen.width === 375)
 undefined...
    [1] <teardown> Stopping recording promises
 › <screenshotOnFail> Test failed, try to save a screenshot
 › Screenshot is saving to /Users/t/Desktop/projects/codeceptjs-playwright-device-bug-reproduction/output/Reproduce_issue.failed.png
 › user1 - Screenshot is saving to /Users/t/Desktop/projects/codeceptjs-playwright-device-bug-reproduction/output/user1_Reproduce_issue.failed.png
  ✖ FAILED in 1542ms

    [2]  Starting recording promises

-- FAILURES:

  1) Repro
       Reproduce issue:

      AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:

  assert(sessionScreen.width === 375)

      + expected - actual

      -false
      +true
      
      at /Users/t/Desktop/projects/codeceptjs-playwright-device-bug-reproduction/repro_test.js:16:5
  
  
  Artifacts:
  - screenshot: /Users/t/Desktop/projects/codeceptjs-playwright-device-bug-reproduction/output/Reproduce_issue.failed.png


  FAIL  | 0 passed, 1 failed   // 3s

After:

Helpers: Playwright
Plugins: screenshotOnFail, tryTo, retryFailedStep, retryTo, eachElement

Repro --
    [1]  Starting recording promises
    Timeouts: 
 › [Session] Starting singleton browser session
  Reproduce issue
    I am on page "https://example.com"
    › [Browser:Error] Failed to load resource: the server responded with a status of 404 ()
 › [New Context] {}
    user1: I am on page "https://example.com"
    user1: I execute script () => {
      return { width: window.screen.width, height: window.screen.height };
    }
sessionScreen is {"width":375,"height":667}
  ✔ OK in 1890ms


  OK  | 1 passed   // 4s

Applicable helpers:

  • Playwright

Type of change

  • 🐛 Bug fix

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)

@kobenguyent kobenguyent changed the title fix: session doesn't respect the context options fix(playwright): session doesn't respect the context options Jan 8, 2024
@kobenguyent kobenguyent merged commit 2bfe7d1 into 3.x Jan 12, 2024
12 checks passed
@kobenguyent kobenguyent deleted the 4109-playwright-helper-does-not-respect-the-device-emulation-setting-when-it-opens-a-new-session branch January 12, 2024 05:07
@kobenguyent kobenguyent mentioned this pull request Jan 25, 2024
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.

Playwright helper does not respect the device emulation setting when it opens a new session
2 participants