added a test case that ensures the generated JS code works in the browser example
This commit is contained in:
@@ -20,6 +20,20 @@
|
|||||||
<artifactId>kotlin-stdlib</artifactId>
|
<artifactId>kotlin-stdlib</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- testing -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.seleniumhq.selenium</groupId>
|
||||||
|
<artifactId>selenium-java</artifactId>
|
||||||
|
<version>${selenium.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.seleniumhq.selenium</groupId>
|
||||||
|
<artifactId>selenium-htmlunit-driver</artifactId>
|
||||||
|
<version>${selenium.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
@@ -53,6 +67,13 @@
|
|||||||
<goal>compile</goal>
|
<goal>compile</goal>
|
||||||
</goals>
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>test-compile</id>
|
||||||
|
<phase>test-compile</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>test-compile</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
|||||||
@@ -1,9 +1,22 @@
|
|||||||
package test.sample
|
package test.sample
|
||||||
|
|
||||||
import org.junit.Test
|
import org.junit.Test as test
|
||||||
|
import org.openqa.selenium.WebDriver
|
||||||
|
import org.openqa.selenium.htmlunit.HtmlUnitDriver
|
||||||
|
import org.openqa.selenium.By
|
||||||
|
import java.io.File
|
||||||
|
import kotlin.test.*
|
||||||
|
|
||||||
class SampleTest {
|
open class SampleTest {
|
||||||
Test fun dummy(): Unit {
|
open val driver: WebDriver = HtmlUnitDriver(true)
|
||||||
|
|
||||||
|
test fun homePage(): Unit {
|
||||||
|
driver.get("file://" + File("sample.html").getCanonicalPath())
|
||||||
|
Thread.sleep(1000)
|
||||||
|
|
||||||
|
val foo = driver.findElement(By.id("foo"))!!
|
||||||
|
val text = foo.getText() ?: ""
|
||||||
|
println("Found $foo with text '$text'")
|
||||||
|
assertEquals("Some Dynamically Created Content!!!", text.trim())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -28,6 +28,7 @@
|
|||||||
<pegdown.version>1.1.0</pegdown.version>
|
<pegdown.version>1.1.0</pegdown.version>
|
||||||
<surefire-version>2.5</surefire-version>
|
<surefire-version>2.5</surefire-version>
|
||||||
<exec-maven-plugin.version>1.2.1</exec-maven-plugin.version>
|
<exec-maven-plugin.version>1.2.1</exec-maven-plugin.version>
|
||||||
|
<selenium.version>2.23.1</selenium.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<prerequisites>
|
<prerequisites>
|
||||||
|
|||||||
@@ -24,12 +24,12 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.seleniumhq.selenium</groupId>
|
<groupId>org.seleniumhq.selenium</groupId>
|
||||||
<artifactId>selenium-java</artifactId>
|
<artifactId>selenium-java</artifactId>
|
||||||
<version>2.23.1</version>
|
<version>${selenium.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.seleniumhq.selenium</groupId>
|
<groupId>org.seleniumhq.selenium</groupId>
|
||||||
<artifactId>selenium-htmlunit-driver</artifactId>
|
<artifactId>selenium-htmlunit-driver</artifactId>
|
||||||
<version>2.23.1</version>
|
<version>${selenium.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user