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

make the screenshot actions act the same as Chrome commands #863

Merged
merged 8 commits into from Jul 12, 2021

Commits on Jul 12, 2021

  1. screenshot: get node's position relative to its document

    Before this change, it's relative to the viewport. So it will get
    the wrong position if the page scrolls.
    
    Fixes chromedp#844.
    ZekeLu committed Jul 12, 2021
    Copy the full SHA
    8601120 View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    b5b7347 View commit details
    Browse the repository at this point in the history
  3. screenshot: make it act the same as Chrome commands

    Here is the list of actions and the coresponding commands:
    
    - FullScreenshot: Capture full size screenshot
    - CaptureScreenshot: Capture screenshot
    - Screenshot: Capture node screenshot
    ZekeLu committed Jul 12, 2021
    Copy the full SHA
    d0af60e View commit details
    Browse the repository at this point in the history
  4. screenshot: extract screenshot.go

    Reasons:
    
    - CaptureScreenshot has nothing to do with navigation, so it's ok
    to move it out of the nav.go file.
    - FullScreenshot does not use emulate action any more, so it's ok
    to move it out of the emulate.go file.
    - query.go is a little big and I'm planning to add more unit test
    for the screenshot feature, so it's better to move the feature to
    another file.
    
    This change is a simple refactor, and does not change any behavior
    of the source code.
    ZekeLu committed Jul 12, 2021
    Copy the full SHA
    94ce628 View commit details
    Browse the repository at this point in the history
  5. screenshot: compare images with pixelmatch

    github.com/orisano/pixelmatch is a go port of pixelmatch,
    which is used by puppeteer to compare images.
    ZekeLu committed Jul 12, 2021
    Copy the full SHA
    a40cf97 View commit details
    Browse the repository at this point in the history
  6. screenshot: add unit test for FullScreenshot

    This unit test is copied from puppeteer:
    - testdata/grid.html
    - testdata/digits/[0-9].png
    - testdata/screenshots/grid-fullpage.png
    ZekeLu committed Jul 12, 2021
    Copy the full SHA
    d8c4817 View commit details
    Browse the repository at this point in the history
  7. screenshot: replace the unit test for CaptureScreenshot

    This unit test is copied from puppeteer:
    - testdata/screenshots/sanity.png
    ZekeLu committed Jul 12, 2021
    Copy the full SHA
    3357b6f View commit details
    Browse the repository at this point in the history
  8. screenshot: replace the unit test for Screenshot

    This unit test is copied from puppeteer.
    
    The Screenshot action is updated to handle fractional dimensions
    properly too.
    ZekeLu committed Jul 12, 2021
    Copy the full SHA
    52c74ed View commit details
    Browse the repository at this point in the history