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

Taking screenshots in Electron and Chrome #97

Merged
merged 5 commits into from
Feb 19, 2020
Merged

Conversation

bahmutov
Copy link
Contributor

and storing them as artifacts and printing image dimensions for #88

@bahmutov
Copy link
Contributor Author

Some numbers from action https://github.com/cypress-io/github-action/runs/456437849?check_suite_focus=true

Electron,

Run npx image-size cypress/screenshots/**/*.png
1000x4823 - cypress/screenshots/spec.js/fullPage.png (png)
1280x720 - cypress/screenshots/spec.js/runner.png (png)
1000x660 - cypress/screenshots/spec.js/viewport.png (png)

Chrome headed

1000x4823 - cypress/screenshots/spec.js/fullPage.png (png)
1280x604 - cypress/screenshots/spec.js/runner.png (png)
1000x604 - cypress/screenshots/spec.js/viewport.png (png)

Chrome headless

1000x4823 - cypress/screenshots/spec.js/fullPage.png (png)
1280x720 - cypress/screenshots/spec.js/runner.png (png)
1000x660 - cypress/screenshots/spec.js/viewport.png (png)

See file examples/chrome/cypress/plugins/index.js

const os = require('os')
module.exports = on => {
  on('before:browser:launch', (browser, launchOptions) => {
    console.log('before launching browser')
    console.log(browser)

    if (browser.name === 'chrome') {
      // https://www.ghacks.net/2013/10/06/list-useful-google-chrome-command-line-switches/
      launchOptions.args.push('--window-size=1280,720')

      console.log('chrome launch args:')
      console.log(launchOptions.args.join(os.EOL))
      return launchOptions
    }
  })
}

@bahmutov
Copy link
Contributor Author

@bahmutov
Copy link
Contributor Author

Note, by using --window-size=1280,1024 I could get entire runner with the same resolution

1000x4823 - cypress/screenshots/spec.js/fullPage.png (png)
1280x1024 - cypress/screenshots/spec.js/runner.png (png)
1000x660 - cypress/screenshots/spec.js/viewport.png (png)

@bahmutov bahmutov merged commit 50a1dff into master Feb 19, 2020
@github-actions
Copy link

github-actions bot commented Mar 3, 2020

🎉 This PR is included in version 1.23.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@emilyrohrbough emilyrohrbough deleted the set-chrome-size branch March 9, 2023 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant