-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
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 | ||
|
||
|
||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import geb.Page | ||
|
||
class YahooQueryPage extends Page { | ||
|
||
static url = "https://www.yahoo.com/" | ||
|
||
static at = { title.contentEquals("Yahoo") } | ||
|
||
static content = { | ||
searchField { $("input", name: "p")} | ||
searchButton { $("button", id:"uh-search-button") } | ||
} | ||
|
||
void search(String word) { | ||
searchField.value(word) | ||
searchButton.click() | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import geb.Page | ||
|
||
class YahooResultPage extends Page { | ||
|
||
public static String searchWord; | ||
|
||
static at = { title.startsWith(searchWord) } | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import geb.spock.GebSpec | ||
|
||
class BaseSpec extends GebSpec{ | ||
|
||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import geb.spock.GebSpec | ||
|
||
class YahooSpec extends BaseSpec{ | ||
|
||
def "Search \"hello!\""() { | ||
String q = "hello!" | ||
YahooResultPage.searchWord = q | ||
|
||
when: | ||
to YahooQueryPage | ||
|
||
and: | ||
search(q) | ||
|
||
then: | ||
waitFor {at YahooResultPage} | ||
} | ||
|
||
} |
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 |
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/ |