Skip to content

Commit

Permalink
Added project files
Browse files Browse the repository at this point in the history
  • Loading branch information
jetfree7 committed Sep 19, 2019
1 parent 978952e commit 48ce6f6
Show file tree
Hide file tree
Showing 31 changed files with 1,362 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

*.png
*.html
target/*
.DS_Store
.idea/*
taskize-automation.iml
268 changes: 268 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,268 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<modelVersion>4.0.0</modelVersion>
<groupId>com.taskize</groupId>
<artifactId>taskize-automation</artifactId>
<version>1.0</version>

<properties>
<selenide.version>5.2.2</selenide.version>
<selenium.version>3.14.0</selenium.version>
<rest-assured.version>4.0.0</rest-assured.version>
<aspectj.version>1.8.10</aspectj.version>
<gson.version>2.3.1</gson.version>
<allure-junit5.version>2.9.0</allure-junit5.version>
<junit.jupiter.version>5.4.2</junit.jupiter.version>
<assertj.version>3.12.0</assertj.version>
<commonslang3.version>3.9</commonslang3.version>
<log4j.version>2.11.2</log4j.version>
<jackson-databind.version>2.9.3</jackson-databind.version>
<guava.version>27.1-jre</guava.version>
<httpmime.version>4.5.5</httpmime.version>
<commons-beanutils.version>1.9.2</commons-beanutils.version>
<spring-web.version>4.3.13.RELEASE</spring-web.version>
<spring-data-commons.version>2.1.1.RELEASE</spring-data-commons.version>
<awaitility.version>3.1.6</awaitility.version>
<typesafe-config.version>1.3.4</typesafe-config.version>

<maven-surfire-plugin.version>3.0.0-M3</maven-surfire-plugin.version>
<maven-compiler-plugin.version>3.5.1</maven-compiler-plugin.version>

<!--
This specifies the test suite to run, by default it will run all existing tests.
This parameter should be passed through CLI -Dsuite=user
-->
<suite>*</suite>
</properties>

<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
</dependency>

<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>${rest-assured.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>${log4j.version}</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson-databind.version}</version>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>${httpmime.version}</version>
</dependency>

<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>${commons-beanutils.version}</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring-web.version}</version>
</dependency>

<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
<version>${spring-data-commons.version}</version>
</dependency>

<dependency>
<groupId>uk.com.robust-it</groupId>
<artifactId>cloning</artifactId>
<version>1.9.10</version>
</dependency>

<dependency>
<groupId>com.codeborne</groupId>
<artifactId>selenide</artifactId>
<version>${selenide.version}</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>${selenium.version}</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-api</artifactId>
<version>${selenium.version}</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commonslang3.version}</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j.version}</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j.version}</version>
<scope>compile</scope>
</dependency>

<!--Allure 2-->
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-assertj</artifactId>
<version>${allure-junit5.version}</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-selenide</artifactId>
<version>${allure-junit5.version}</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-junit5</artifactId>
<version>${allure-junit5.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-java-commons</artifactId>
<version>${allure-junit5.version}</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<version>${awaitility.version}</version>
</dependency>

<dependency>
<groupId>com.typesafe</groupId>
<artifactId>config</artifactId>
<version>${typesafe-config.version}</version>
</dependency>

</dependencies>

<build>
<defaultGoal>test</defaultGoal>
<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</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>${maven-surfire-plugin.version}</version>
<configuration>
<includes>
<include>com.testproject.${suite}.**</include>
</includes>
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
</argLine>
<systemProperties>
<configurationParameters>
junit.jupiter.extensions.autodetection.enabled = true
</configurationParameters>
<property>
<name>allure.results.directory</name>
<value>${project.build.directory}/allure-results</value>
</property>
</systemProperties>

</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>

<plugin>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-maven</artifactId>
<version>2.10.0</version>

<configuration>
<resultsDirectory>${project.build.directory}/allure-results</resultsDirectory>
</configuration>
</plugin>

</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package com.testproject.config;

import com.codeborne.selenide.SelenideDriver;
import com.codeborne.selenide.logevents.LogEvent;
import com.codeborne.selenide.logevents.LogEventListener;
import io.qameta.allure.Allure;
import io.qameta.allure.AllureLifecycle;
import io.qameta.allure.model.Status;
import io.qameta.allure.model.StatusDetails;
import io.qameta.allure.model.StepResult;
import io.qameta.allure.util.ResultsUtils;

import java.util.UUID;

public class AllureSimultaneousSelenide implements LogEventListener {
private SelenideDriver browser;
private boolean saveScreenshots;
private AllureLifecycle lifecycle;

public AllureSimultaneousSelenide(SelenideDriver browser) {
this(Allure.getLifecycle(), browser);
}

public AllureSimultaneousSelenide(AllureLifecycle lifecycle, SelenideDriver browser) {
this.saveScreenshots = true;
this.browser = browser;
this.lifecycle = lifecycle;
}

public AllureSimultaneousSelenide screenshots(boolean saveScreenshots) {
this.saveScreenshots = saveScreenshots;
return this;
}

public void onEvent(LogEvent event) {
this.lifecycle.getCurrentTestCase().ifPresent((uuid) -> {
String stepUUID = UUID.randomUUID().toString();
this.lifecycle.startStep(stepUUID, (new StepResult()).setName(event.toString()).setStatus(Status.PASSED));
this.lifecycle.updateStep((stepResult) -> {
stepResult.setStart(stepResult.getStart() - event.getDuration());
});
if (LogEvent.EventStatus.FAIL.equals(event.getStatus())) {

this.lifecycle.updateStep((stepResult) -> {
StatusDetails details = ResultsUtils.getStatusDetails(event.getError()).orElse(new StatusDetails());
stepResult.setStatus(ResultsUtils.getStatus(event.getError()).orElse(Status.BROKEN));
stepResult.setStatusDetails(details);
});
}

this.lifecycle.stopStep(stepUUID);
});
}

}
20 changes: 20 additions & 0 deletions src/main/java/com/testproject/config/WebDriverConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.testproject.config;

import com.testproject.utils.Config;
import com.testproject.webdriver.LocalDriverConfiguration;
import com.testproject.webdriver.RemoteDriverConfiguration;
import com.testproject.webdriver.WebDriverConfiguration;

public class WebDriverConfig {

public static void configure() {
chooseDriver().configure();
}

private static WebDriverConfiguration chooseDriver() {
return Config.isGridUse()
? new RemoteDriverConfiguration()
: new LocalDriverConfiguration();
}

}
Loading

0 comments on commit 48ce6f6

Please sign in to comment.