Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
kb-kerem committed Apr 9, 2024
1 parent c5608f9 commit 2e12882
Show file tree
Hide file tree
Showing 53 changed files with 4,946 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/java-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Java (build)

on:
push:
paths:
- 'visual-java/**'
pull_request:
paths:
- 'visual-java/**'

defaults:
run:
working-directory: visual-java

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

22 changes: 22 additions & 0 deletions .github/workflows/java-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Java (Release)

on:
workflow_dispatch:
inputs:
releaseType:
description: 'Release type - major, minor or patch'
required: true
default: 'minor'
options:
- 'major'
- 'minor'
- 'patch'

defaults:
run:
working-directory: visual-java

jobs:
build:
runs-on: ubuntu-latest

3 changes: 3 additions & 0 deletions visual-java/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
target/
.idea/
.DS_Store
Binary file added visual-java/.mvn/wrapper/maven-wrapper.jar
Binary file not shown.
18 changes: 18 additions & 0 deletions visual-java/.mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
56 changes: 56 additions & 0 deletions visual-java/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Sauce Labs Visual for Java

Sauce Labs Visual for Java expose Sauce Labs Visual Testing for your Java project with Selenium.

## Installation

Add [sauce visual](https://central.sonatype.com/artifact/com.saucelabs.visual/java-client) dependency to your project

*Latest available version can be found [here](https://central.sonatype.com/artifact/com.saucelabs.visual/java-client)*

- Maven

```xml

<dependency>
<groupId>com.saucelabs.visual</groupId>
<artifactId>java-client</artifactId>
<version>LATEST VERSION</version>
<scope>test</scope>
</dependency>
```

- Gradle

```
testImplementation group: 'com.saucelabs.visual', name: 'java-client', version: 'LATEST VERSION'
```

- Gradle (short)

```
testImplementation 'com.saucelabs.visual:java-client:LATEST VERSION'
```

## How to use

- Instantiate `VisualClient` object
```java
import com.saucelabs.visual.DataCenter;
//...
DataCenter dataCenter = DataCenter.US_WEST_1;
var visualClient = await VisualClient.Create(Driver, datacenter);
```

- Invoke Visual Testing
```java
var checkOptions = new VisualCheckOptions() { CaptureDom = true };
await visualClient.VisualCheck("Home Page", checkOptions);
```

- Get results of Visual Tests and run assertions on it
```java
var results = await visualClient.VisualResults(visualBuild.Id);
// verify that no differences have been detected
Assert.AreEqual(0, results[DiffStatus.Approved]);
```
Loading

0 comments on commit 2e12882

Please sign in to comment.