geb

How to setup and teardown functional test data in Geb grails

情到浓时终转凉″ 提交于 2019-12-14 03:45:42
问题 I have many working/passing functional geb/spock tests (each extending GebReportingSpec) that are testing a web application with test data all created from the BootStrap.groovy at the beginning of the functional test suite. I want to move the test data creation into startup() / teardown() methods within each Spec, well actually I wanted to have them inherit it from a base class but apparently the StepWise has issues with inheritance. So, at present each of my test spec classes look something

How can I search and return the values and pass it to the method from spock table

爷,独闯天下 提交于 2019-12-14 03:34:41
问题 Currently implementing GEB,Spock,Groovy. I come across the scenario like There is a set of data's in the spock table. I have to pass the modulename as a parameter, Search from the spock table then return two values user id and password. Below code is skeleton code My question is how to search module name based on parameter? How to return two data's ? Class Password_Collection extends Specification { def "Secure password for search and Data Driven"(String ModuleName) { expect: // Search based

Clear TextField rather than append

久未见 提交于 2019-12-13 18:39:07
问题 I'm using the following statement to clear text filed value: input.value("abc") input.value("") input.value("def") But, instead of clearing and set new value, it is appending the new value to old value. ('abcdef'). Is there any way to clear the TextField, before setting new val? 回答1: You can clear using the selenium element: input.firstElement().clear() And you can send keys using << like so: input << "abc" 回答2: You can use the selenium Keys to backspace the texts that you already had entered

How to run Geb TestCases from windows command line?

那年仲夏 提交于 2019-12-13 09:55:30
问题 I want to be able to run the geb testcases(SampleTestCase.groovy) from windows command line? I am having a hard time doing so, can anyone please help me out with this? Thanks 回答1: gradlew ''moduleName':test --tests *'fullSpecWithpackage' 来源: https://stackoverflow.com/questions/55324604/how-to-run-geb-testcases-from-windows-command-line

How can I re-write this method to give me a precise xpath or locator? (Avoiding Stale Element Exception)

无人久伴 提交于 2019-12-13 06:38:04
问题 I have been working with GEB and selenium for some time now, and many a time I have run into the dreaded stale element exception because one of the pages I have to test loads dynamically, thus inducing the stale element exception. I have come very close to creating a catch all solution to the stale element exception but alas not close enough which is why I need help. My solution was to override the NonEmptyNavigator class that comes with GEB. I am going to show my click() method as an example

Geb test ignoring GebConfig.groovy file launched in IntelliJ

为君一笑 提交于 2019-12-13 04:11:29
问题 Running in IntelliJ IDEA. GebConfig.groovy is in /src/test/resources . I am using the Chrome driver. When I type System.setProperty("webdriver.chrome.driver", "my/path") inside my spec file, and I right click and select run, the test works, meaning it opens Chrome and loads the page. When I don't do that in the spec file, but just leave it in the GebConfig.groovy file, I get the error message "the page to the driver executable must be set". There's an air-gap, so I can't copy-paste; I'll type

How to have geb static content recognized form test script

允我心安 提交于 2019-12-13 03:52:10
问题 The example: Page Class Page TestPage extends Page{ static at = {blah blah....} static content = { someVar {$(By.id("someId"))} } } Script: class Test extends GebReportingSpec{ def "some Feature Methods"(){ when: def page1 = at TestPage page1.someVar.click() //In intellij "someVar" shows as unrecognized } } According to what I have read and researched, in the example above, someVar should autocomplete and be recognized, but it is not. the code still runs and works correctly but someVar still

Selenium 2 get all cookies on domain

一个人想着一个人 提交于 2019-12-13 02:43:55
问题 All. I have problem with getting cookies on domain. i try get cookies: def "go to site"() { when: go "http://bla-bla-bla.bla" then: title == "Bla-bla-bla" // check cookies String cookies = driver.manage().getCookieNamed("name1").getValue() println cookies } but cookies with name1 geting on other domain, not http://bla-bla-bla.bla , name1 it's cookies on domain http://ululu.ulu and a try get all cookies, on all domains(sites), but I did not get. Please help me get all cookies on all domains

Geb Firefox Driver: why my test runs twice?

别等时光非礼了梦想. 提交于 2019-12-12 14:25:10
问题 Sorry for all this code, but I don't have a clue what's making my issue, so here it goes. I configured the geb plugin to run functional tests with JUnit. So I have in my buildConfig.groovy : def seleniumVersion = "2.29.0" def gebVersion = "0.7.0" dependencies { // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg. // runtime 'mysql:mysql-connector-java:5.1.5' provided('com.oracle:oracle:11.1.0.7.0') provided('com.oracle:i18n:10.2.0.5') test (

Grails remote control plugin - Spring Security Configuration

给你一囗甜甜゛ 提交于 2019-12-12 06:24:42
问题 Whenever I try to use the Grails Remote Control plugin, I get the following Exception. groovyx.remote.RemoteControlException: Error sending command chain to 'http://localhost:8080/******/grails-remote-control' [test] at groovyx.remote.transport.http.HttpTransport.send(HttpTransport.groovy:65) [test] at groovyx.remote.client.RemoteControl.sendCommandChain(RemoteControl.groovy:114) [test] at groovyx.remote.client.RemoteControl.exec(RemoteControl.groovy:73) [test] at groovyx.remote.client