Skip to content

Commit

Permalink
adding AT sub project
Browse files Browse the repository at this point in the history
  • Loading branch information
rnatesan-intrafi committed Feb 23, 2024
1 parent ab3905b commit 8947549
Show file tree
Hide file tree
Showing 88 changed files with 737 additions and 0 deletions.
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.

81 changes: 81 additions & 0 deletions acceptance-test/build.gradle
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{


}
19 changes: 19 additions & 0 deletions acceptance-test/src/acceptanceTest/groovy/tests/YahooSpec.groovy
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}
}

}
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

0 comments on commit 8947549

Please sign in to comment.