Skip to content

Commit

Permalink
add imports for java examples for Sauce Visual
Browse files Browse the repository at this point in the history
  • Loading branch information
Kerem Beygo committed Nov 8, 2023
1 parent e1eb773 commit 925ef24
Showing 1 changed file with 36 additions and 9 deletions.
45 changes: 36 additions & 9 deletions docs/visual-testing/integrations/java.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Don't forget to quit the WebDriver in `@AfterAll` section, or `@AfterSuite` if y

```java
import org.junit.jupiter.api.AfterAll;

@AfterAll
public static void tearDown() {
if (driver != null) {
Expand Down Expand Up @@ -121,15 +121,42 @@ Don't forget to quit the WebDriver in `@AfterAll` section, or `@AfterSuite` if y
### Step 3: Add visual tests in your tests

Add a check to one of your tests:
```java
@Test
void checkLoginLooksTheSame() {
var loginPage = new LoginPage(driver);
loginPage.open();

visual.sauceVisualCheck("Before Login");
}
```
<Tabs
defaultValue="JUnit"
  values={[
    {label: 'JUnit', value: 'JUnit'},
    {label: 'TestNG', value: 'TestNG'},
  ]}>
<TabItem value="JUnit">

```java
import org.junit.jupiter.api.Test;

@Test
void checkLoginLooksTheSame() {
var loginPage = new LoginPage(driver);
loginPage.open();

visual.sauceVisualCheck("Before Login");
}
```
</TabItem>
<TabItem value="TestNG">

```java
import org.testng.annotations.Test;

@Test
void checkLoginLooksTheSame() {
var loginPage = new LoginPage(driver);
loginPage.open();

visual.sauceVisualCheck("Before Login");
}
```
</TabItem>
</Tabs>

### Step 4: Configure your Sauce Labs credentials

Expand Down

0 comments on commit 925ef24

Please sign in to comment.