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

Fixit added sample at #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/.idea/
/target
/build
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 80 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

86 changes: 86 additions & 0 deletions acceptance-test/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
plugins {
id "groovy"
id "idea"
}

repositories {
maven {
url pinAppsDepsRepo
metadataSources {
artifact()
mavenPom()
}
}
maven {
url pinAppsReleasesRepo
metadataSources {
artifact()
mavenPom()
}
}
mavenLocal()
}

ext {
gebVersion = '6.0'
spockVersion = '2.2-groovy-3.0'
seleniumVersion = '4.15.0'
webDriverManagerVersion = '5.6.2'
}

dependencies {
implementation 'org.codehaus.groovy:groovy-all:3.0.8'

testImplementation "org.gebish:geb-spock:${gebVersion}"
testImplementation "org.seleniumhq.selenium:selenium-support:${seleniumVersion}"
testImplementation "org.spockframework:spock-core:${spockVersion}"
testImplementation "org.seleniumhq.selenium:selenium-firefox-driver:${seleniumVersion}"
testImplementation "org.seleniumhq.selenium:selenium-chrome-driver:${seleniumVersion}"
testImplementation group: 'io.github.bonigarcia', name: 'webdrivermanager', version: webDriverManagerVersion
}

test {
useJUnitPlatform()
}

sourceSets {
acceptanceTest {
groovy
{
srcDirs = ['src/acceptanceTest/groovy']
resources.srcDir file('src/acceptanceTest/resources')
compileClasspath += sourceSets.test.compileClasspath
runtimeClasspath += sourceSets.test.runtimeClasspath
}
}
}

['firefox'].each { driver ->
task "${driver}acceptanceTest"(type: Test) {
useJUnitPlatform()
println("Created task: ${driver}acceptanceTest")
testClassesDirs = sourceSets.findByName("acceptanceTest").output.classesDirs
classpath = sourceSets.findByName("acceptanceTest").runtimeClasspath

maxParallelForks = 1

reports {
html.outputLocation = reporting.file("$name/tests")
junitXml.outputLocation = file("$buildDir/test-results/$name")
html.required = true
}
outputs.upToDateWhen { false }
systemProperty 'geb.build.reportsDir', reporting.file("$name/geb")

systemProperty 'geb.env', driver


}

tasks.named("processAcceptanceTestResources") {
duplicatesStrategy = 'include'
}

}


21 changes: 21 additions & 0 deletions acceptance-test/src/acceptanceTest/groovy/pages/GooglePage.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package pages

import geb.Page

class GooglePage extends Page {


static at = { title.startsWith("Google") }
static url = "http://www.google.com"

static content = {
searchField { $("input", name: "q") }
searchButton { $("input", name: "btnK") }
}

def click(){
searchButton.click()
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package tests

import geb.spock.GebReportingSpec

class BaseSpec extends GebReportingSpec{


}
16 changes: 16 additions & 0 deletions acceptance-test/src/acceptanceTest/groovy/tests/GoogleSpec.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package tests

import pages.GooglePage

class GoogleSpec extends BaseSpec {

def "Search \"hello!\""() {

when:
to GooglePage

then:
at GooglePage
}

}
55 changes: 55 additions & 0 deletions acceptance-test/src/acceptanceTest/resources/GebConfig.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import io.github.bonigarcia.wdm.WebDriverManager
import io.github.bonigarcia.wdm.config.DriverManagerType
import org.openqa.selenium.firefox.FirefoxDriver
import org.openqa.selenium.firefox.FirefoxOptions

environments {



firefox {
FirefoxOptions options = new FirefoxOptions()
options.setCapability("acceptInsecureCerts", true)
options.addArguments("--headless")
driver = {
DriverManagerType firefox = DriverManagerType.FIREFOX
WebDriverManager.getInstance(firefox).setup()
def tmpDriver = new FirefoxDriver(options)
tmpDriver.manage().window().maximize()
return tmpDriver
}
}


}

atCheckWaiting = true
waiting {
timeout = 15
retryInterval = 0.5
presets {
slow {
timeout = 30
retryInterval = 1
}
medium {
timeout = 22
retryInterval = 0.5
}
fast {
timeout = 10
}
waitOne {
timeout = 1
}
verySlow {
timeout = 150
retryInterval = 1
}
}
}



reportOnTestFailureOnly = true //takes screenshot only if a failure occurs
//quitCachedDriverOnShutdown = false //Use this if you want to prevent browser from closing
4 changes: 4 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

# General settings
pinAppsDepsRepo=https://artifactory.intrafi.com/artifactory/pin-repository/
pinAppsReleasesRepo=https://artifactory.intrafi.com/artifactory/pinapps-releases-local/
Loading