Skip to content

Commit 56e5774

Browse files
committed
Fixed axe gradle dependency & updated readme
1 parent 433bd9f commit 56e5774

2 files changed

Lines changed: 78 additions & 0 deletions

File tree

README.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,75 @@ In this section, we will run the test cases to test the internally hosted websit
497497
gradle allureServe
498498
```
499499
500+
# Percy
501+
502+
[Percy](https://percy.io) provides a visual review platform.
503+
504+
## Prerequisites
505+
506+
- Sign up with your BrowserStack account, or create a new [BrowserStack account](https://www.browserstack.com/users/sign_up).
507+
- Create a new Percy project.
508+
- Go to the Project's Settings page, identify your Percy Token, and export them as environment variables using the following commands.
509+
510+
### Installation
511+
512+
1. Install the Percy CLI.
513+
514+
```shell
515+
npm install @percy/cli
516+
```
517+
518+
### Export the Percy Token
519+
520+
- For \*nix based and Mac machines:
521+
522+
```sh
523+
export PERCY_TOKEN=[your-project-token]
524+
```
525+
526+
- For Windows:
527+
528+
```shell
529+
set PERCY_TOKEN=[your-project-token]
530+
```
531+
532+
## Run your first Visual Test
533+
534+
In this section, we will run the test cases to detect the visual differences. We run the test first, then toggle the property that instructs our test to change some CSS.
535+
536+
1. Run the test.
537+
Maven:
538+
```sh
539+
npx percy exec -- mvn clean test -P percy
540+
```
541+
542+
Gradle:
543+
```sh
544+
npx percy exec -- gradle clean percy
545+
```
546+
547+
2. Set the `changeCSS` property in the `src/test/java/com/browserstack/test/login/LoginVisuaalTest` directory to true.
548+
549+
3. Run the test again.
550+
551+
4. View your Project in the Percy dashboard and verify the differences.
552+
553+
## Run the Ignore Region Test
554+
555+
In this section, we will run the test that ignores a specific area of a webpage. In a real-world situation, you can think of dynamic content and advertisements where this use case applies.
556+
557+
1. Run the test.
558+
Maven:
559+
```sh
560+
npx percy exec -- mvn clean test -P percy-ignore
561+
```
562+
Gradle:
563+
```sh
564+
npx percy exec -- gradle clean percy-ignore
565+
```
566+
2. View your Project in the Percy dashboard and verify the differences.
567+
568+
500569
## Additional Resources
501570

502571
- View your test results on the [BrowserStack Automate dashboard](https://www.browserstack.com/automate)

build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ dependencies {
1818
implementation 'org.seleniumhq.selenium:selenium-java:3.141.59'
1919
implementation 'com.browserstack:browserstack-local-java:1.0.6'
2020
implementation 'io.percy:percy-java-selenium:1.0.0'
21+
implementation 'com.deque.html.axe-core:selenium:4.3.1'
2122
implementation 'org.testng:testng:7.1.0'
2223
implementation 'io.qameta.allure:allure-testng:2.13.8'
2324
implementation 'com.googlecode.json-simple:json-simple:1.1.1'
@@ -105,6 +106,14 @@ tasks.register('percy', Test) {
105106
}
106107
}
107108

109+
tasks.register('percy-ignore', Test) {
110+
useTestNG() {}
111+
include '**/IgnoreRegionVisualTest.class'
112+
testLogging {
113+
events "PASSED", "FAILED", "SKIPPED"
114+
}
115+
}
116+
108117
tasks.register('bstack-local', Test) {
109118
useTestNG() {
110119
listeners.add("com.browserstack.test.utils.BrowserstackTestStatusListener")

0 commit comments

Comments
 (0)