-
Notifications
You must be signed in to change notification settings - Fork 3
feat: Add capturePermutations method to ScreenshotPageObject #213
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
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
6ef20f2
feat: Add capturePermutations method to ScreenshotPageObject
jperals 67121d9
Add test coverage
jperals 96c7a6e
Define permutations script outside of browser.execute call
jperals 46f7692
Exclude mobile-specific error branch from coverage
jperals b1377c8
Fix istanbul comment
jperals 9dec760
Again
jperals 0a3dd6f
Again
jperals 9c35ee6
Again
jperals cc10370
Again
jperals e91752d
Check for existance of permutations before taking screenshot
jperals File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,3 +3,4 @@ | |
| export * from './scroll'; | ||
| export * from './sizes'; | ||
| export * from './events-spy'; | ||
| export * from './permutations'; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| import { ElementOffset, ElementSize } from '../page-objects/types'; | ||
|
|
||
| export interface PermutationInfo extends ElementSize { | ||
| id: string; | ||
| offset: ElementOffset; | ||
| } | ||
|
|
||
| export interface PageDimensions { | ||
| pageHeight: number; | ||
| viewportHeight: number; | ||
| } | ||
|
|
||
| export function getPermutationSizes(): PermutationInfo[] { | ||
| var pixelRatio = window.devicePixelRatio || 1; | ||
| return Array.prototype.slice | ||
| .call(document.querySelectorAll('[data-permutation]')) | ||
| .map(function (element: HTMLElement) { | ||
| var rect = element.getBoundingClientRect(); | ||
| return { | ||
| id: element.getAttribute('data-permutation') || '', | ||
| width: rect.width * pixelRatio, | ||
| height: rect.height * pixelRatio, | ||
| offset: { | ||
| top: rect.top * pixelRatio, | ||
| left: rect.left * pixelRatio, | ||
| }, | ||
| }; | ||
| }); | ||
| } | ||
|
|
||
| export function getPageDimensions(): PageDimensions { | ||
| return { | ||
| pageHeight: document.documentElement.scrollHeight, | ||
| viewportHeight: window.innerHeight, | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| export { default as BasePageObject } from './base'; | ||
| export { default as ScreenshotPageObject } from './screenshot'; | ||
| export { default as ScreenshotPageObject, PermutationScreenshot } from './screenshot'; | ||
| export { default as EventsSpy } from './events-spy'; | ||
| export { ScreenshotWithOffset, ElementSize, ElementRect, ElementOffset } from './types'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title>Permutations test page</title> | ||
| <style> | ||
| body, | ||
| html { | ||
| margin: 0; | ||
| padding: 0; | ||
| } | ||
| .permutation { | ||
| width: 100px; | ||
| height: 50px; | ||
| background: #eee; | ||
| margin: 10px; | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <div class="permutation" data-permutation="perm-1">Permutation 1</div> | ||
| <div class="permutation" data-permutation="perm-2">Permutation 2</div> | ||
| <div class="permutation" data-permutation="perm-3">Permutation 3</div> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.