Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<section name="Workbench">
<section name="MavenProjectImportWizardPage">
<list key="rootDirectory">
<item value="/Users/raja.rao/apps/tutorial-selenium-java-visualgrid"/>
<item value="/Users/raja.rao/apps/tutorial-selenium-java-ultrafastgrid"/>
</list>
<list key="projectNameTemplate">
<item value="[artifactId]"/>
Expand Down
6 changes: 3 additions & 3 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.processAnnotations=disabled
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.5
org.eclipse.jdt.core.compiler.source=1.8
50 changes: 25 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,45 @@

* [Install JDK](https://www.oracle.com/java/technologies/javase-downloads.html)

2. Maven is installed on your machine, JAVA_HOME environment variable is created, added to PATH, path to Maven is added to PATH too
2. Maven is installed on your machine, JAVA_HOME environment variable is created, path to Maven is added to environment variable PATH

* [Download Maven](https://maven.apache.org/download.cgi)

* [Install Maven, configure enviroment variables](https://maven.apache.org/install.html)

3. Chrome Webdriver is on your machine and is in the PATH. Here are some resources from the internet that'll help you.
3. Chrome browser is installed on your machine.

* [Install Chrome browser](https://support.google.com/chrome/answer/95346?co=GENIE.Platform%3DDesktop&hl=en&oco=0)

4. Chrome Webdriver is on your machine and is in the PATH. Here are some resources from the internet that'll help you.

* [Download Chrome Webdriver](https://chromedriver.chromium.org/downloads)
* https://splinter.readthedocs.io/en/0.1/setup-chrome.html
* https://stackoverflow.com/questions/38081021/using-selenium-on-mac-chrome
* https://www.youtube.com/watch?time_continue=182&v=dz59GsdvUF8

4. IntelliJ IDEA (or Eclipse) is installed on your machine if you want to run example from IDE.
5. Git is installed on your machine.

* [Install git](https://www.atlassian.com/git/tutorials/install-git)

6. IDE (IntelliJ IDEA for example) is installed on your machine.

* [Install IntelliJ IDEA](https://www.jetbrains.com/idea/download/) or [Install Eclipse](https://www.eclipse.org/downloads/)
* [Install IntelliJ IDEA](https://www.jetbrains.com/idea/download/)

6.1 Set Project SDK to your JDK (installed in Step 1) in Intellij - File > Project Structure > Project.



# Steps to run this example

1. Git clone this repo

* `git clone https://github.com/applitools/tutorial-selenium-java-ultrafastgrid.git`, or download [this as a Zip file](https://github.com/applitools/tutorial-selenium-java-ultrafastgrid/archive/master.zip) and unzip it

2. Navigate to just cloned folder tutorial-selenium-java-basic.

3. Get an API key by logging into Applitools > Person Icon > My API Key

4. Open in any editor file src\test\java\com\applitools\quickstarts\AppTest.java and set your ApiKey in string 'config.setApiKey("...")' (or comment the string and set APPLITOOLS_API_KEY environment variable)

5. Run 'mvn -Dtest=AppTest test'.

6. If you want to run example from IDE perform next steps:

6.1. Import the project as a *Maven* project in IntelliJ IDEA or Eclipse.

6.2 Set Project SDK to your JDK (installed in Pre-requisites) in Intellij - File > Project Structure > Project.

6.3 Run or Debug class AppTest or method test().



Read more here: https://www.applitools.com/tutorials/selenium-java.html

2. Get an API key by logging into Applitools > Person Icon > My API Key
3. Navigate to just cloned folder tutorial-selenium-java-basic.
5. Import the project as a *Maven* project in IntelliJ IDEA.
6. Navigate to AppTest class - src\test\java\com\applitools\quickstarts\AppTest in IntelliJ IDEA.
6. In IntelliJ IDEA or in any editor update file src\test\java\com\applitools\quickstarts\AppTest.java and set your ApiKey in string 'config.setApiKey("...")' (or comment the string and set APPLITOOLS_API_KEY environment variable)
7. Run class AppTest from IntelliJ IDEA - tap Run, choose 'AppTest'.

Read more here: https://www.applitools.com/tutorials/selenium-java.html
25 changes: 1 addition & 24 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,18 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.applitools.quickstarts</groupId>
<artifactId>Java-VisualGrid-Tutorial</artifactId>
<artifactId>Java-UltraFastGrid-Tutorial</artifactId>
<packaging>jar</packaging>
<version>1.0</version>
<name>Java-tutorial</name>
<url>http://maven.apache.org</url>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M4</version>
</plugin>

</plugins>
</build>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<dependencies>
<!-- This is the Applitools Selenium Java SDK -->
<dependency>
<groupId>com.applitools</groupId>
<artifactId>eyes-selenium-java3</artifactId>
<version>RELEASE</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.6.2</version>
<scope>test</scope>
</dependency>

</dependencies>
</project>
38 changes: 21 additions & 17 deletions src/test/java/com/applitools/quickstarts/AppTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.junit.jupiter.api.Test;

/**
* Unit test for simple App.
*/
public class AppTest {

@Test
public void test() {
public static void main(String[] args) {
// Create a new chrome web driver
WebDriver webDriver = new ChromeDriver();

Expand Down Expand Up @@ -74,26 +72,32 @@ public static void setUp(Eyes eyes) {

public static void ultraFastTest(WebDriver webDriver, Eyes eyes) {

// Navigate to the url we want to test
webDriver.get("https://demo.applitools.com");
try {

// Navigate to the url we want to test
webDriver.get("https://demo.applitools.com");

// Call Open on eyes to initialize a test session
eyes.open(webDriver, "Demo App", "Ultrafast grid demo", new RectangleSize(800, 600));
// Call Open on eyes to initialize a test session
eyes.open(webDriver, "Demo App", "Ultrafast grid demo", new RectangleSize(800, 600));

// check the login page with fluent api, see more info here
// https://applitools.com/docs/topics/sdk/the-eyes-sdk-check-fluent-api.html
eyes.check(Target.window().fully().withName("Login page"));
// check the login page with fluent api, see more info here
// https://applitools.com/docs/topics/sdk/the-eyes-sdk-check-fluent-api.html
eyes.check(Target.window().fully().withName("Login page"));

webDriver.findElement(By.id("log-in")).click();
webDriver.findElement(By.id("log-in")).click();

// Check the app page
eyes.check(Target.window().fully().withName("App page"));
// Check the app page
eyes.check(Target.window().fully().withName("App page"));

// Call Close on eyes to let the server know it should display the results
eyes.closeAsync();
// Call Close on eyes to let the server know it should display the results
eyes.closeAsync();

} catch (Exception e) {
eyes.abortAsync();
}

}

private static void tearDown(WebDriver webDriver, VisualGridRunner runner) {
// Close the browser
webDriver.quit();
Expand All @@ -104,4 +108,4 @@ private static void tearDown(WebDriver webDriver, VisualGridRunner runner) {
System.out.println(allTestResults);
}

}
}