Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Github actions CI #16

Merged
merged 6 commits into from
Apr 22, 2020
Merged
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
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: github-actions

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
ci:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Validate checkstyle
run: mvn -B validate
- name: Deploy docker-compose stack
run: docker-compose up -d
- name: Waiting containers
uses: jakejarvis/wait-action@master
with:
time: '60s'
- name: Check running containers
run: docker ps
- name: Run tests
run: |
mvn -B test \
-Dselenide.remote=http://0.0.0.0:4444/wd/hub \
-Dmock.server.address=0.0.0.0:3000 \
-Dlistener=utils/listeners/MockServerListener.java,utils/listeners/ExtentReportListener.java
- name: Publish reports (if failure)
uses: actions/upload-artifact@v1
if: failure()
with:
name: extent-report
path: reports/ExtentReport.html
24 changes: 0 additions & 24 deletions .github/workflows/maven.yml

This file was deleted.

14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

A template for selenium based ui automation projects using _[selenide](https://github.com/selenide/selenide)_ ✨

[![badge-jdk](https://img.shields.io/badge/jdk-8-green.svg)](http://www.oracle.com/technetwork/java/javase/downloads/index.html)
[![jdk](https://img.shields.io/badge/jdk-8-green.svg)](http://www.oracle.com/technetwork/java/javase/downloads/index.html)
![Languages](https://img.shields.io/github/languages/top/sergiomartins8/ui-automation-bootstrap)
[![Contributors badge](https://img.shields.io/github/contributors/sergiomartins8/ui-automation-bootstrap)](https://github.com/sergiomartins8/ui-automation-bootstrap/graphs/contributors)
[![Contributors](https://img.shields.io/github/contributors/sergiomartins8/ui-automation-bootstrap)](https://github.com/sergiomartins8/ui-automation-bootstrap/graphs/contributors)
[![Issues](https://img.shields.io/github/issues/sergiomartins8/ui-automation-bootstrap)](https://github.com/sergiomartins8/ui-automation-bootstrap/issues)
[![License badge](https://img.shields.io/github/license/sergiomartins8/ui-automation-bootstrap)](http://www.apache.org/licenses/LICENSE-2.0)
![Validate checkstyle](https://github.com/sergiomartins8/ui-automation-bootstrap/workflows/checkstyle/badge.svg)
[![License](https://img.shields.io/github/license/sergiomartins8/ui-automation-bootstrap)](http://www.apache.org/licenses/LICENSE-2.0)
[![Actions](https://github.com/sergiomartins8/ui-automation-bootstrap/workflows/github-actions/badge.svg)](https://github.com/sergiomartins8/ui-automation-bootstrap/actions?query=workflow%3Agithub-actions)

* [About](#about)
* [Getting Started](#getting-started)
Expand Down Expand Up @@ -73,7 +73,7 @@ Options:

##### Example:
````shell script
$ mvn clean test -Dmock.server.address=localhost:3000 -Dlistener=utils/listeners/MockServerListener.java
$ mvn clean test -Dmock.server.address=0.0.0.0:3000 -Dlistener=utils/listeners/MockServerListener.java
````

### Usage (cont.)
Expand All @@ -84,7 +84,7 @@ Using the goods of selenide, you can also use its system properties alongside wi
```shell script
$ mvn test -Dparallel=methods \
-DthreadCount=2 \
-Dselenide.remote=http://localhost:4444/wd/hub \
-Dselenide.remote=http://0.0.0.0:4444/wd/hub \
-Dselenide.headless=true \
-Dselenide.browser=firefox \
-Dselenide.baseUrl=http:/google.com
Expand Down Expand Up @@ -128,4 +128,4 @@ Dive into ui-automation-bootstrap [contribution guide](docs/CONTRIBUTING.md).

## Kuddos

Feel free to reach me out on linkedin[@sergiomartins8](https://www.linkedin.com/in/sergiomartins8/) ‍🙌
Feel free to reach out on linkedin[@sergiomartins8](https://www.linkedin.com/in/sergiomartins8/) ‍🙌
14 changes: 10 additions & 4 deletions src/test/java/base/MockContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import org.mockserver.client.MockServerClient;
import utils.config.CustomConfiguration;

import java.net.URI;

/**
* Context for objects for mocking purposes.
*/
Expand All @@ -17,8 +15,8 @@ public class MockContext {
*/
public static void initializeMockServerClient() {
MockContext.mockServerClient = new MockServerClient(
URI.create(CustomConfiguration.mockServerAddress).getHost(),
URI.create(CustomConfiguration.mockServerAddress).getPort());
getMockServerHost(),
getMockServerPort());
}

public static void resetMockServerClient() {
Expand All @@ -28,4 +26,12 @@ public static void resetMockServerClient() {
public static MockServerClient getMockServerClient() {
return mockServerClient;
}

private static String getMockServerHost() {
return CustomConfiguration.mockServerAddress.split(":")[0];
}

private static int getMockServerPort() {
return Integer.parseInt(CustomConfiguration.mockServerAddress.split(":")[1]);
}
}
2 changes: 1 addition & 1 deletion src/test/java/utils/config/CustomConfigurationHolder.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class CustomConfigurationHolder implements Loggable {
private final String mockServerAddress = System.getProperty("mock.server.address");

public String mockServerAddress() {
logger().debug("Mock server address: " + mockServerAddress);
logger().info("Mock server address: " + mockServerAddress);
return mockServerAddress;
}
}