Skip to content

Commit

Permalink
Merge pull request #88 from marcospereira/updates/play-json-2.7.4
Browse files Browse the repository at this point in the history
- Add support for Scala 2.13, remove support for Scala 2.10 #72
- Update play-json version to 2.7.4
- Add chromedriver as a requirement in the readme
- Fix markdown in readme
  • Loading branch information
DaniRey committed Jun 14, 2019
2 parents 8fd2763 + 725b3bb commit 5996f11
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 37 deletions.
41 changes: 27 additions & 14 deletions README.md
@@ -1,32 +1,43 @@
# [![ScalaWebTest](https://www.scalawebtest.org/images/swt-logo-light.png)](http://www.scalawebtest.org)
###### [![Build Status](https://travis-ci.org/unic/ScalaWebTest.svg?branch=master)](https://travis-ci.org/unic/ScalaWebTest) [![Join the chat at https://gitter.im/ScalaWebTest/Lobby](https://badges.gitter.im/ScalaWebTest/Lobby.svg)](https://gitter.im/ScalaWebTest/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

## [![Build Status](https://travis-ci.org/unic/ScalaWebTest.svg?branch=master)](https://travis-ci.org/unic/ScalaWebTest) [![Join the chat at https://gitter.im/ScalaWebTest/Lobby](https://badges.gitter.im/ScalaWebTest/Lobby.svg)](https://gitter.im/ScalaWebTest/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

ScalaWebTest is a library for writing ScalaTest/Selenium based integration tests for websites. It helps you with your basic setup and provides a new and very efficient approach to testing.

In manufacturing it is common to use gauges (also called checking gauges or testing gauges) to verify whether a workpiece meets predefined criteria and tolerances. ScalaWebTest transfers this concept to the world of web integration testing. You can define a gauge in HTML, and use it to verify your web application. This greatly improves the readability, simplicity of your integration tests.

Read the full documentation on our website https://www.scalawebtest.org
Read the full documentation on our website <https://www.scalawebtest.org>

## Getting Started with development

### Prerequisites

* Java >= 8
* SBT 1.x
* [ChromeDriver](http://chromedriver.chromium.org/)

Get familiar with the sbt build tool because this is used to manage the project.

See [Getting Started Guide](https://www.scala-sbt.org/1.x/docs/Getting-Started.html)

### Compile, test, package

```
#> sbt compile test package
```bash
$ sbt compile test package
```

### Run whole integration test

Before running the integration tests, you will need to configure `WEBDRIVER_CHROME_DRIVER` environment variable. To do so, run the following command:

```bash
$ export WEBDRIVER_CHROME_DRIVER="$(which chromedriver)"
```
#> sbt inttest

And then run the tests using the command below:

```bash
$ sbt inttest
```

This will start a Jetty server, executes the integration tests and stops the server again.
Expand All @@ -36,25 +47,25 @@ This will start a Jetty server, executes the integration tests and stops the ser
If you would like to run the Jetty server and in parallel work on integration tests and some code changes,
you can do the following:

```
```bash
# Enter the sbt console first, enter 'sbt' in root folder
#> sbt
$ sbt

# Start Jetty server
#sbt> jetty:start
sbt> jetty:start

# Or if you would like that sbt automatically restarts Jetty after code changes then do:
#sbt> ~jetty:start
sbt> ~jetty:start

# Open separate command window and enter the sbt console again
# Open separate command window and enter the sbt console agains
# Run a single integration tests
#sbt> it:testOnly org.scalawebtest.integration.gauge.ContainsSpec
sbt> it:testOnly org.scalawebtest.integration.gauge.ContainsSpec
```

## How to Release

### Prerequisites

Create the following file ~/.sbt/1.0/plugins/gpg.sbt

Add the following line to gpg.sbt
Expand All @@ -65,14 +76,16 @@ Copy the private key (Sonatype PGP Private and Public Key from our company passw
Create the file ~/.sbt/1.0/sonatype.sbt

Add the following content and replace username, password
```

```scalas
credentials += Credentials("Sonatype Nexus Repository Manager",
"oss.sonatype.org",
"<your username>",
"<your password>")
```

### Release

The release process of ScalaWebTest is currently done manually. The process is done as follows:

1. Switch the version in `build.sbt` to that which is to be released (e.g. from `0.0.1-SNAPSHOT` to `1.0.0`)
Expand All @@ -85,7 +98,7 @@ The release process of ScalaWebTest is currently done manually. The process is d
1. `+ inttest` - compiles and run the integration tests
1. `+ publishSigned` - creates all of the below plus the poms
1. Enter the Sonatype PGP Key Password as stored in our company password store
1. Go to https://oss.sonatype.org/#stagingRepositories verify and close the staging repository
1. Go to <https://oss.sonatype.org/#stagingRepositories> verify and close the staging repository
1. `exit` - exits the sbt interactive mode
1. Commit your changes with the commit message "Release x.x.x" (e.g. `Release 1.0.0`)
1. Tag this commit with the release version
Expand Down
9 changes: 5 additions & 4 deletions build.sbt
Expand Up @@ -9,6 +9,7 @@ val scalaTestVersion = "3.0.8"
val seleniumVersion = "3.141.59"
val htmlUnitVersion = "2.35.1"
val slf4jVersion = "1.7.26"
val playJsonVersion = "2.7.4"

val versions = Map("scalaWebTest" -> projectVersion, "scalaTest" -> scalaTestVersion, "selenium" -> seleniumVersion, "htmlUnit" -> htmlUnitVersion)

Expand Down Expand Up @@ -57,14 +58,14 @@ lazy val core = Project(id = "scalawebtest-core", base = file("scalawebtest-core
lazy val aem = Project(id = "scalawebtest-aem", base = file("scalawebtest-aem"))
.settings(commonSettings: _*)
.settings(crossScalaVersions := supportedScalaVersions)
.settings(libraryDependencies ++= scalaVersion(playJsonDependency(scope = None)).value)
.settings(libraryDependencies += "com.typesafe.play" %% "play-json" % playJsonVersion)
.settings(mimaSettings("scalawebtest-aem"))
.dependsOn(core)

lazy val json = Project(id = "scalawebtest-json", base = file("scalawebtest-json"))
.settings(commonSettings: _*)
.settings(crossScalaVersions := supportedScalaVersions)
.settings(libraryDependencies ++= scalaVersion(playJsonDependency(scope = None)).value)
.settings(libraryDependencies += "com.typesafe.play" %% "play-json" % playJsonVersion)
.settings(mimaSettings("scalawebtest-json"))
.dependsOn(core)

Expand Down Expand Up @@ -113,10 +114,10 @@ lazy val integration_test = Project(id = "scalawebtest-integration", base = file
"org.seleniumhq.selenium" % "selenium-java" % seleniumVersion % "it",
"org.seleniumhq.selenium" % "htmlunit-driver" % htmlUnitVersion % "it",
"org.slf4j" % "slf4j-api" % slf4jVersion % "it",
"org.slf4j" % "slf4j-simple" % slf4jVersion % "it"
"org.slf4j" % "slf4j-simple" % slf4jVersion % "it",
"com.typesafe.play" %% "play-json" % playJsonVersion % "it"
)
)
.settings(libraryDependencies ++= scalaVersion(playJsonDependency(Some("it"))).value)
.enablePlugins(JettyPlugin)
.settings(containerPort in Jetty := 9090)
.dependsOn(core)
Expand Down
19 changes: 0 additions & 19 deletions project/ScalaWebTestBuild.scala
Expand Up @@ -3,25 +3,6 @@ import sbt._
import scala.xml.{Elem, NodeSeq}

object ScalaWebTestBuild {
def playJsonDependency(scope: Option[String])(scalaVersion: String): Seq[ModuleID] = {
def playJsonDependency(playJsonVersion: String) = scope match {
case None => Seq("com.typesafe.play" %% "play-json" % playJsonVersion)
case Some(s) => Seq("com.typesafe.play" %% "play-json" % playJsonVersion % s)
}

def playJsonDependency213(playJsonVersion: String) = scope match {
case None => Seq("com.typesafe.play" % "play-json_2.13.0-RC2" % playJsonVersion)
case Some(s) => Seq("com.typesafe.play" % "play-json_2.13.0-RC2" % playJsonVersion % s)
}

scalaVersion match {
case "2.11.12" => playJsonDependency("2.7.0")
case "2.12.8" => playJsonDependency("2.8.0-M1")
case "2.13.0" => playJsonDependency213("2.8.0-M1")
case _ => Seq()
}
}

def bomDependencies(versions: Map[String, String])(scalaVersion: String): Elem = {
val scalaMajorVersion = scalaVersion.substring(0, "2.XX".length)
val dependencies = <dependencyManagement>
Expand Down

0 comments on commit 5996f11

Please sign in to comment.