Skip to content

Instantly share code, notes, and snippets.

@eliasnogueira
Last active February 11, 2021 13:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eliasnogueira/27344d639f5f1d6a96db42b90b1abb99 to your computer and use it in GitHub Desktop.
Save eliasnogueira/27344d639f5f1d6a96db42b90b1abb99 to your computer and use it in GitHub Desktop.
Test to take the device screenshot
@Test
void readQRCode() {
MobileElement qrCodeElement = driver.findElement(By.id("com.example.qrcode:id/imageView"));
File screenshot = driver.getScreenshotAs(OutputType.FILE);
String content = decodeQRCode(generateImage(qrCodeElement, screenshot));
assertThat(content).isEqualTo("f3ce8d4d-074f-483f-9fd0-45c7947fd40c");
}
@eliasnogueira
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment