geb

How to move to geb page content that is not visible in the browser window?

你离开我真会死。 提交于 2019-12-08 01:20:10
问题 How can I get the geb webdriver to move to an element on the page that may not be in the view of the browser. The element exists on the page and is displayed but there may be a possibility that the element will appear on the bottom of the page and the browser would need to scroll down in order to bring the element into view. import geb.Page class myPage extends Page { static url = "mypage.xhtml" static at = {title == "myPage"} static content = { someElement = {$("#bottomOfPage")}

How to move to geb page content that is not visible in the browser window?

大城市里の小女人 提交于 2019-12-06 14:43:11
How can I get the geb webdriver to move to an element on the page that may not be in the view of the browser. The element exists on the page and is displayed but there may be a possibility that the element will appear on the bottom of the page and the browser would need to scroll down in order to bring the element into view. import geb.Page class myPage extends Page { static url = "mypage.xhtml" static at = {title == "myPage"} static content = { someElement = {$("#bottomOfPage")} anotherElement = {$(".someClass",5)} } void clickElement(){ //possibility to fail because element may not be

Customize 'at' with extra parameters for the closure?

让人想犯罪 __ 提交于 2019-12-06 13:46:54
Is it possible to specify some optional parameter(s) to the 'at' closure on the page like this: class ManagerDashboardClientsPage extends Page { static at = { year, geo -> if (year) { GebUtil.selectedYear == year } title.endsWith('Dashboard: Clients') } } so that I can write both at ManagerDashboardClientsPage and at ManagerDashboardClientsPage(2013, 'North East') Currently the first one breaks with No signature of method: page.ManagerDashboardClientsPage$__clinit__closure1.doCall() is applicable for argument types: () values: [] Possible solutions: doCall(java.lang.Object, java.lang.Object),

Is it possible to log spock feature method names and clause labels?

徘徊边缘 提交于 2019-12-06 02:49:42
问题 I'd like to be able to log the spock feature names and clause labels when running some automated tests. This would help with debugging test issues when using a headless browser for automation, specifically phantomjs. Reason being, phantomjs does not always behave the same way as when using the chrome WebDriver. It would also be nice to have if this is even possible. def "Login logout test"(){ given: "Go to login page" ... when: "Submit username and password" ... then: "Dashboard page

Geb: Waiting/sleeping between tests

时光怂恿深爱的人放手 提交于 2019-12-05 20:50:43
Is there a way to wait a set amount of time between tests? I need a solution to compensate for server lag. When creating a record, it takes a little bit of time before the record is searchable in my environment. In the following code example, how would I wait 30 seconds between the first test and the second test and have no wait time between second test and third test? class MySpec extends GebReportingSpec { // First Test def "should create a record named myRecord"() { given: to CreateRecordsPage when: name_field = "myRecord" and: saveButton.click() then: at IndexPage } // Second Test def

Selenium addCookie getting Invalid Cookie Domain Exception even though I'm on the right domain

*爱你&永不变心* 提交于 2019-12-05 18:48:47
So I'm trying to load previously saved cookies into my web driver with Selenium/Geb. First I goto the domain and then try to add the cookies. But the cookie domain and the url domain don't register with each other: Caught: org.openqa.selenium.InvalidCookieDomainException: You may only add cookies that would be visible to the current domain: .domain=.example.com => .www.example.com Build info: version: '2.35.0', revision: '8df0c6bedf70ff9f22c647788f9fe9c8d22210e2', time: '2013-0 8-17 12:46:41' System info: os.name: 'Linux', os.arch: 'amd64', os.version: '3.2.0-48-generic', java.version: '1.6.0

How do you get the sessionFactory in a Grails Geb/Spock test case?

微笑、不失礼 提交于 2019-12-05 02:24:17
问题 I think I need to flush the hibernate session in a GebSpec test, and so I want to get the sessionFactory. It looks like it should be injected but when I do something like this:- class MySpec extends GebSpec { def sessionFactory ... def "test session"(){ ....do some setup then: assert sessionFactory != null } it fails with sessionFactory being null. 回答1: The short answer to my question is - why do you want to do that, it's a functional test and it may be remote from the running apps JVM. The

Is it possible to log spock feature method names and clause labels?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 08:30:55
I'd like to be able to log the spock feature names and clause labels when running some automated tests. This would help with debugging test issues when using a headless browser for automation, specifically phantomjs. Reason being, phantomjs does not always behave the same way as when using the chrome WebDriver. It would also be nice to have if this is even possible. def "Login logout test"(){ given: "Go to login page" ... when: "Submit username and password" ... then: "Dashboard page displayed" ... when: "logout" ... then: "Returned to login page" ... } For example, It would be cool if I could

Grails geb getting parameters from commandline

久未见 提交于 2019-12-04 06:17:31
问题 I am writing my ui tests with geb in grails . I want to start the tests from command line with maven. This works fine. My command: mvn -Dtest=CheckMenuLinks test Now I want to pass some parameters for tests from commandline. Is this possible? 回答1: I found the solution: I just add some parameter like: -Dmytest=myparameter I can use this parameter in gebconfig with: System.getProperty("mytest") 来源: https://stackoverflow.com/questions/35840678/grails-geb-getting-parameters-from-commandline

How do you get the sessionFactory in a Grails Geb/Spock test case?

别说谁变了你拦得住时间么 提交于 2019-12-03 21:29:04
I think I need to flush the hibernate session in a GebSpec test, and so I want to get the sessionFactory. It looks like it should be injected but when I do something like this:- class MySpec extends GebSpec { def sessionFactory ... def "test session"(){ ....do some setup then: assert sessionFactory != null } it fails with sessionFactory being null. The short answer to my question is - why do you want to do that, it's a functional test and it may be remote from the running apps JVM. The why is because I want to check that domain objects have been updated when web stuff happens. Luke Daley