Skip to content
Open
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
target/
*.iml
.idea/
.classpath
.project
.settings/
test-output/
147 changes: 84 additions & 63 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,66 +1,87 @@
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.galenframework</groupId>
<artifactId>galen-java-sample-tests</artifactId>
<version>0.1-SNAPSHOT</version>
<name>Galen Framework Sample Java Test Project</name>
<packaging>jar</packaging>
<description>A test project for testing Galen using Java-based tests</description>

<dependencies>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.galenframework</groupId>
<artifactId>galen-java-support</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<properties>
<property><name>usedefaultlisteners</name><value>false</value></property>
<property>
<name>listener</name>
<value>com.galenframework.testng.GalenTestNgReportsListener</value>
</property>
</properties>
</configuration>
</plugin>
</plugins>
</build>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.galenframework</groupId>
<artifactId>galen-java-sample-tests</artifactId>
<version>0.1-SNAPSHOT</version>
<name>Galen Framework Sample Java Test Project</name>
<packaging>jar</packaging>
<description>A test project for testing Galen using Java-based tests</description>

<dependencies>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.galenframework</groupId>
<artifactId>galen-java-support</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.4.0</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.4.0</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.4.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<properties>
<property>
<name>usedefaultlisteners</name>
<value>false</value>
</property>
<property>
<name>listener</name>
<value>com.galenframework.testng.GalenTestNgReportsListener</value>
</property>
</properties>
</configuration>
</plugin>
</plugins>
</build>

<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>manual</distribution>
</license>
</licenses>

<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>manual</distribution>
</license>
</licenses>

</project>
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
package com.galenframework.java.sample.components;

import com.galenframework.testng.GalenTestNgTestBase;
import static java.util.Arrays.asList;

import java.util.List;

import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.DataProvider;

import java.util.List;

import static java.util.Arrays.asList;
import com.galenframework.testng.GalenTestNgTestBase;

public abstract class GalenTestBase extends GalenTestNgTestBase {

private static final String ENV_URL = "http://testapp.galenframework.com";

@Override
public WebDriver createDriver(Object[] args) {
WebDriver driver = new FirefoxDriver();
public WebDriver createDriver(Object[] args) {
WebDriver driver = new ChromeDriver();
if (args.length > 0) {
if (args[0] != null && args[0] instanceof TestDevice) {
TestDevice device = (TestDevice)args[0];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.galenframework.java.sample.tests;

import com.galenframework.java.sample.components.GalenTestBase;
import com.galenframework.java.sample.components.GalenTestBase;
import java.io.IOException;

import org.openqa.selenium.By;
import org.testng.annotations.Test;

import java.io.IOException;
import com.galenframework.java.sample.components.GalenTestBase;


public class WelcomePageTest extends GalenTestBase {
Expand All @@ -22,5 +22,4 @@ public void loginPage_shouldLookGood_onDevice(TestDevice device) throws IOExcept
getDriver().findElement(By.xpath("//button[.='Login']")).click();
checkLayout("/specs/loginPage.spec", device.getTags());
}

}
6 changes: 3 additions & 3 deletions src/test/resources/specs/common.spec
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@

@forEach [menu-item-*] as menuItem, prev as previousMenuItem
${menuItem}:
right-of ${previousMenuItem} 0 to 5px
right-of ${previousMenuItem} -1 to 4px
aligned horizontally all ${previousMenuItem}


Expand All @@ -74,7 +74,7 @@

@for [ 1, 3 ] as index
menu-item-${index}:
near menu-item-${index + 1} 0 to 5 px left
near menu-item-${index + 1} -1 to 4px left


= Content =
Expand All @@ -91,5 +91,5 @@

= Footer =
footer:
height ~ 200px
height ~ 150px
below content 0px
4 changes: 2 additions & 2 deletions src/test/resources/specs/welcomePage.spec
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@

text-block-1:
height > 20px
above login-button 10 to 50 px
above login-button 60 to 130 px

login-button:
height ~ 45px
text is "Login"
above text-block-3 10 to 50px
above text-block-3 -70 to 0px


@on desktop
Expand Down