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

[TPS2021-1393] Mobile testing enablement in spock-geb quickstarter #1025

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 8 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

- Update Rust Axum Quickstarter ([#1024](https://github.com/opendevstack/ods-quickstarters/pull/1024))
- Update GEB&Spock Quickstarter with Mobile Testing capabilities ([#1025](https://github.com/opendevstack/ods-quickstarters/pull/1025))

### Added

Expand Down
51 changes: 33 additions & 18 deletions docs/modules/quickstarters/pages/e2e-spock-geb.adoc
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
= End-to-end tests with Spock, Geb and Unirest (e2e-spock-geb)

spock, geb and unirest e2e testing quickstarter project
Spock, Geb, Unirest and Apium e2e testing quickstarter project

== Purpose of this quickstarter

This is a spock, geb and unirest e2e testing project quickstarter with basic setup for https://jenkins.io/[Jenkins], https://www.sonarqube.org/[SonarQube] and https://gradle.org/[Gradle].
This is a Spock, Geb, Unirest and Apium e2e testing project quickstarter with basic setup for https://jenkins.io/[Jenkins], https://www.sonarqube.org/[SonarQube], https://gradle.org/[Gradle], and https://appium.io/[Appium].

== What files / architecture is generated?

----
.
├── application
│ └── EmptyFile.apk
├── Jenkinsfile
├── .pre-commit-config.yaml
├── README.md
Expand All @@ -18,7 +20,16 @@ This is a spock, geb and unirest e2e testing project quickstarter with basic set
│ ├── test
│ │ └── acceptance
│ │ │ └── groovy
│ │ │ │ └── DemoAcceptanceSpec.groovy
│ │ │ │ └── modules
│ │ │ │ └── DemoManualMenuModule.groovy
│ │ │ │ └── pages
│ │ │ │ └── DemoGebHomePage.groovy
│ │ │ │ └── DemoGitHubAcceptanceHomePage.groovy
│ │ │ │ └── DemoTheBookOfGebPage.groovy
│ │ │ │ └── specs
│ │ │ │ └── DemoGebHomePageSpec.groovy
│ │ │ │ └── DemoGitHubAcceptanceHomeSpec.groovy
│ │ │ │ └── DemoGoogleKeepSpec.groovy
│ │ │ └── java
│ │ │ └── DemoAcceptanceTest.java
│ │ └── installation
Expand All @@ -30,11 +41,12 @@ This is a spock, geb and unirest e2e testing project quickstarter with basic set
│ │ │ └── groovy
│ │ │ │ └── DemoIntegrationSpec.groovy
│ │ │ └── java
│ │ | └── DemoIntegrationTest.java
│ │ └── DemoIntegrationTest.java
│ │ └── resources
│ │ └── application.properties
│ │ └── GebConfig.groovy
│ │ └── SpecHelper.groovy
│ │ │ └── helpers
│ │ │ └── SpecHelper.groovy
│ │ │ └── application.properties
│ │ │ └── GebConfig.groovy
├── gradle
│ └── wrapper
│ ├── gradle-wrapper.jar
Expand Down Expand Up @@ -87,27 +99,30 @@ This project is generated by https://gradle.org/[Gradle]

******* http://unirest.io/[unirest]

******* https://appium.io/[apium]

## Usage - how do you start after you provisioned this quickstarter

* Run command `gradlew test` in project directory to execute the end-to-end tests via spock/geb against the Google Home page and demo jUnit 5 tests.
* Run command `gradlew test` in project directory to execute the end-to-end tests via spock/geb against the demo pages and demo jUnit 5 tests.

You will see the results inside a new folder 'build' in project directory.

----
.
└── build
└── test-results
├── acceptance-groovy
│ └── TEST-DemoAcceptance.xml
├── acceptance-java
├── acceptance-groovy-defaultDriver
├── acceptance-java-defaultDriver
│ │── TEST-specs.DemoGebHomePageSpec.xml
│ │── TEST-specs.DemoGitHubAcceptanceHomeSpec.xml
│ └── TEST-DemoAcceptanceTest.xml
├── installation-groovy
│ └── TEST-DemoInstallation.xml
── installation-java
├── installation-groovy-defaultDriver
── installation-java-defaultDriver
│ │── TEST-DemoInstallation.xml
│ └── TEST-DemoInstallationTest.xml
├── integration-groovy
└── TEST-DemoIntegration.xml
── integration-java
├── integration-groovy-defaultDriver
└── integration-java-defaultDriver
── TEST-DemoIntegration.xml
└── TEST-DemoIntegrationTest.xml

----
Expand All @@ -117,7 +132,7 @@ You will see the results inside a new folder 'build' in project directory.
* You can see how a Java Junit 5 test are developed showing the Demo*Test.java files.
* You can see how a Groovy Spock/Geb test are developed showing the Demo*Spec.groovy files.
** The url to test with Geb is configured in the property `config.application.url` inside `application.properties`
** Inside `GebConfig.groovy` you could change the default navigator (CHROME)
** Inside `GebConfig.groovy` you could see some environments with different drivers defined and a default browser. You could configure or change them as you need.

== How this quickstarter is built through jenkins

Expand Down
23 changes: 22 additions & 1 deletion e2e-spock-geb/Jenkinsfile.template
Original file line number Diff line number Diff line change
@@ -1,9 +1,30 @@
// See https://www.opendevstack.org/ods-documentation/ for usage and customization.

@Library('ods-jenkins-shared-library@@shared_library_ref@') _
node {
sauceLabsUsername = env.SAUCE_LABS_USERNAME
sauceLabsAccessKey = env.SAUCE_LABS_ACCESS_KEY
dockerRegistry = env.DOCKER_REGISTRY
}

odsComponentPipeline(
imageStreamTag: '@ods_namespace@/jenkins-agent-jdk:@agent_image_tag@',
podContainers: [
containerTemplate(
name: 'jnlp',
image: "${dockerRegistry}/ods/jenkins-agent-jdk:@agent_image_tag@",
workingDir: '/tmp',
envVars: [
envVar(key: 'SAUCE_LABS_ACCESS_KEY', value: sauceLabsAccessKey),
envVar(key: 'SAUCE_LABS_USERNAME', value: sauceLabsUsername)
],
resourceRequestCpu: '100m',
resourceLimitCpu: '300m',
resourceRequestMemory: '1Gi',
resourceLimitMemory: '2Gi',
alwaysPullImage: true,
args: '${computer.jnlpmac} ${computer.name}'
)
],
branchToEnvironmentMapping: [
'master': 'dev',
// 'release/': 'test'
Expand Down
2 changes: 1 addition & 1 deletion e2e-spock-geb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

Documentation is located in our [official documentation](https://www.opendevstack.org/ods-documentation/opendevstack/3.x/quickstarters/e2e-spock-geb.html)

Please update documentation in the [antora page directory](https://github.com/opendevstack/ods-project-quickstarters/tree/master/docs/modules/ROOT/pages)
Please update documentation in the [antora page directory](https://github.com/opendevstack/ods-quickstarters/tree/master/docs/modules/ROOT/pages)

Tested thru [automated tests](../tests/e2e-spock-geb)
Loading