Skip to content
This repository was archived by the owner on Jan 17, 2022. It is now read-only.
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
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
# Testatoo

[![CircleCI](https://circleci.com/gh/Testatoo/testatoo.svg?style=svg)](https://circleci.com/gh/Testatoo/testatoo)
[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/Ovea/testatoo)
[![codecov](https://codecov.io/gh/Testatoo/testatoo/branch/master/graph/badge.svg)](https://codecov.io/gh/Testatoo/testatoo)
[![CircleCI](https://circleci.com/gh/Testattoo/testattoo.svg?style=svg)](https://circleci.com/gh/Testattoo/testattoo)
[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/Ovea/testattoo)
[![codecov](https://codecov.io/gh/Testattoo/testattoo/branch/master/graph/badge.svg)](https://codecov.io/gh/Testattoo/testattoo)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

![TEstatoo Logo](logo.svg "Testatoo")
![Testattoo Logo](logo.svg "Testattoo")

## Documentation and Samples

The documentation is available [here](http://www.testatoo.org/documentation.html)
The documentation is available [here](http://www.testattoo.org/documentation.html)

Samples are available [here](https://github.com/Ovea/testatoo-sample)
Samples are available [here](https://github.com/Ovea/testattoo-sample)

## Quickstart

Get Started in 5 minutes [here](http://www.testatoo.org/get-started.html)
Get Started in 5 minutes [here](http://www.testattoo.org/get-started.html)

## Downloading

Latest Testatoo version is available on [Maven Central](https://repo.maven.apache.org/maven2/org/testatoo/testatoo/)
Latest Testattoo version is available on [Maven Central](https://repo.maven.apache.org/maven2/org/testattoo/testattoo/)

<dependency>
<groupId>org.testatoo</groupId>
<artifactId>testatoo</artifactId>
<version>2.0.b27</version>
<groupId>org.testattoo</groupId>
<artifactId>testattoo-core</artifactId>
<version>[LATEST]</version>
<scope>test</scope>
</dependency>

Expand Down
48 changes: 32 additions & 16 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,20 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jdk.version>1.8</jdk.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>${maven.compiler.source}</maven.compiler.target>

<groovy.version>2.5.6</groovy.version>

<classgraph.version>4.6.10</classgraph.version>
<selenium.version>3.141.59</selenium.version>
<hamcrest.version>2.1</hamcrest.version>

<!-- Tests -->
<junit.version>4.12</junit.version>
<mockito.version>2.23.4</mockito.version>
<junit.jupiter.version>5.4.0</junit.jupiter.version>
<mockito-core.version>2.21.0</mockito-core.version>
<webdrivermanager.version>3.1.1</webdrivermanager.version>
<jetty.version>9.4.12.v20180830</jetty.version>
<jetty.daemon>true</jetty.daemon>
<reactor-netty.version>0.8.5.RELEASE</reactor-netty.version>

<!-- Plugins -->
<gmavenplus-plugin.version>1.6.2</gmavenplus-plugin.version>
Expand Down Expand Up @@ -188,8 +189,8 @@
<exclude>**/*.yml</exclude>
<exclude>**/*.yml</exclude>
<exclude>.mvn/**</exclude>
<exclude>src/main/resources/**/jquery*.js</exclude>
<exclude>src/test/resources/**</exclude>
<exclude>src/main/resources/**</exclude>
<exclude>src/test/webapp/css/**</exclude>
<exclude>src/test/webapp/js/**</exclude>
<exclude>src/test/webapp/fonts/**</exclude>
Expand Down Expand Up @@ -261,9 +262,18 @@
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<artifactId>groovy</artifactId>
<version>${groovy.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-templates</artifactId>
<version>${groovy.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-json</artifactId>
<version>${groovy.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
Expand All @@ -281,27 +291,33 @@
<version>${classgraph.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito.version}</version>
<version>${mockito-core.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<artifactId>selenium-jupiter</artifactId>
<version>${webdrivermanager.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${jetty.version}</version>
<groupId>io.projectreactor.netty</groupId>
<artifactId>reactor-netty</artifactId>
<version>${reactor-netty.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion src/main/groovy/org/testatoo/core/Browser.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ class Browser {
return windows
}

static void switchTo(Window window) { config.evaluator.switchToWindow(window.id) }
static void switchTo(Window window) { window.switchTo(window) }
}
22 changes: 12 additions & 10 deletions src/main/groovy/org/testatoo/core/Evaluator.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,23 @@ import org.testatoo.core.input.MouseModifiers
* @author David Avenante (d.avenante@gmail.com)
*/
interface Evaluator extends AutoCloseable {
abstract Object getDriver()
Object getDriver()

abstract void open(String url)
void open(String url)

abstract void runScript(String script)
void runScript(String script)

abstract void registerScripts(String... scripts)
void registerScripts(String... scripts)

abstract String eval(String id, String jsExpr)
String eval(String id, String jsExpr)

abstract boolean check(String id, String jsExpr)
boolean check(String id, String jsExpr)

abstract String getTitle()
String getTitle()

abstract String getPageSource()
String getPageSource()

abstract String getUrl()
String getUrl()

abstract Set<String> getWindowIds()

Expand All @@ -64,4 +64,6 @@ interface Evaluator extends AutoCloseable {
abstract void mouseOver(String id)

abstract void dragAndDrop(String originId, String targetId)
}

abstract String currentWindow()
}
8 changes: 4 additions & 4 deletions src/main/groovy/org/testatoo/core/Testatoo.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ class Testatoo {
/**
* Create a component
*/
static Component $(String jQuery) {
new Component(new CachedMetaData(idProvider: new jQueryIdProvider(jQuery, true)))
static Component $(String expression) {
new Component(new CachedMetaData(idProvider: new jQueryIdProvider(expression, true)))
}

/**
* Creates a list of component
*/
static List $$(String jQuery, Class clazz = Component) {
Components components = new Components(clazz, new CachedMetaData(idProvider: new jQueryIdProvider(jQuery, false)))
static List $$(String expression, Class clazz = Component) {
Components components = new Components(clazz, new CachedMetaData(idProvider: new jQueryIdProvider(expression, false)))
components.list()
}

Expand Down
16 changes: 14 additions & 2 deletions src/main/groovy/org/testatoo/core/Window.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,27 @@
* limitations under the License.
*/
package org.testatoo.core

import static org.testatoo.core.Testatoo.*

/**
* @author David Avenante (d.avenante@gmail.com)
*/
class Window {
final String id
private String parent

Window(String id) { this.id = id }

void close() { Testatoo.config.evaluator.closeWindow(this.id) }
void close() {
config.evaluator.closeWindow(this.id)
if(parent) config.evaluator.switchToWindow(parent)
}

void switchTo(Window window) {
window.parent = config.evaluator.currentWindow()
config.evaluator.switchToWindow(window.id)
}

@Override
String toString() { this.id }
Expand All @@ -36,4 +48,4 @@ class Window {
}

int hashCode() { id.hashCode() }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ interface CellSupport {
List<Cell> cells()

Cell cell(Object value)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,11 @@ class WebDriverEvaluator implements Evaluator {
}

@Override
void switchToWindow(String id) {
String switchToWindow(String id) {
String parentWindow = webDriver.windowHandle
webDriver.switchTo().window(id)
return parentWindow

}

@Override
Expand Down Expand Up @@ -197,6 +200,11 @@ class WebDriverEvaluator implements Evaluator {
new Actions(webDriver).dragAndDrop(webDriver.findElement(By.id(originId)), webDriver.findElement(By.id(targetId))).perform()
}

@Override
String currentWindow() {
return webDriver.windowHandle
}

@Override
void close() throws Exception { webDriver.quit() }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*
* Copyright (C) 2013 Ovea (dev@ovea.com)
* Copyright © 2018 Ovea (d.avenante@gmail.com)
*
* Licensed 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
* 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.testatoo.bundle.stub
package org.testatoo

import org.testatoo.core.CssIdentifier
import org.testatoo.core.component.Item
import reactor.netty.DisposableServer
import reactor.netty.http.server.HttpServer

@CssIdentifier('ItemStub')
class ItemStub extends Item {
Object value() {
return 'Item Value'
}
import java.nio.file.Path
import java.nio.file.Paths

boolean selected() {
return false
class Server {
static DisposableServer start(int port) {
String helper = new File(".").absolutePath
Path resource = Paths.get(helper + "/src/test/webapp")
return HttpServer.create()
.port(port)
.route{routes -> routes.directory("/", resource)}
.bindNow()
}
}
Loading