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

Element - take screenshot #2795

Merged
merged 15 commits into from
May 27, 2021
Merged

Element - take screenshot #2795

merged 15 commits into from
May 27, 2021

Conversation

alon-ha
Copy link
Contributor

@alon-ha alon-ha commented May 24, 2021

Closes #2659. Added element screenshot functionality in iOS

@@ -105,8 +108,9 @@ class InternalExpect extends Expect {
}

class Element {
constructor(invocationManager, matcher) {
constructor(invocationManager, matcher, emitter) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would advise putting emitter before matcher (keeping matcher as the last arg)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why does it matter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

NVM, did so

}
};

expect(invocationManager.execute).toHaveBeenCalledWith(jsonOutput);
Copy link
Collaborator

Choose a reason for hiding this comment

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

nice!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(: @noomorph helped


await element(by.id('switchOrientation')).tap();

const bitmapPath = await element(by.id('fancyElement')).takeScreenshot('fancy-element');
expectBitmapsToBeEqual(bitmapPath, screenshotAssetPath);
});

it('should fail to take a screenshot of an off-screen element', async () => {
it(':android: should fail to take a screenshot of an off-screen element', async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@alon-ha Can we do this for iOS as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, but I don't see the reason. It's also an argument if to allow taking a screenshot of an element which is not visible on the screen. Should we do it or not? There are few questions here.. Let's discuss today

detox/src/ios/expectTwo.js Outdated Show resolved Hide resolved
Copy link
Collaborator

@noomorph noomorph left a comment

Choose a reason for hiding this comment

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

No huge objections so far except for linting issues – but I plan to auto fix this after my PR with new lint rules passes.

@d4vidi d4vidi force-pushed the element-take-screenshot branch from 6e42fdf to 4d0beeb Compare May 27, 2021 13:13
@d4vidi d4vidi closed this May 27, 2021
@d4vidi d4vidi reopened this May 27, 2021
@d4vidi d4vidi merged commit 4531220 into master May 27, 2021
@d4vidi d4vidi deleted the element-take-screenshot branch May 27, 2021 15:35
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.

Element screenshot support for iOS
3 participants