This repository was archived by the owner on Jun 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Selenium Screenshots
Joshua Zenn edited this page Feb 26, 2022
·
1 revision
As part of our end-to-end(E2E) test suite, we have the capability of taking screenshots on every test run. This is useful for verifying that the design of a page did not break as a result of changes in other parts of the site that are otherwise difficult to test using only XPath in JUnit. When running tests locally, they can be found in the target/screenshots directory after running the full test suite. Note that you will need a compatible version of Google Chrome installed and full administrative privileges on the system you are running on (MacOS may also require permissions to record your screen).
- Open a pull request on GitHub and wait for the PR checks to complete.

- Click the
Detailslink next to theBuild / build (pull_request)entry in the checks field. - On the left, click
Summary.

- At the bottom of the page, there should be a section called Artifacts. Click the
screenshotsentry to download the ZIP file of the screen captures. Note that if you do not see any artifacts listed, it may be because artifacts are only hosted for three days after the pipeline job was run. You may need to re-run the job to see the artifacts appear again.


- In the ZIP file, you should see an image for every page listed in the screenshot capture test.

- Navigate to
src/test/java/com/virtudoc/web/E2EWalkthroughTest.javain your IDE of choice. - If your page is publicly accessible (i.e. does not require a login), add the relative URL to your page to the
@ValueSource(...)annotation for thescreenshotPublicPages(String)test. If your page requires authentication, you will need to create a new test that correctly goes through the login sequence before visiting your page. To take a screenshot, call thetakeScreenshot(String)function.