geb

Executing Specific Geb Tests according to environment

牧云@^-^@ 提交于 2019-12-03 00:39:28
I have a set of Spec tests I am executing within a Grails Project. I need to execute a certain set of Specs when I am on local, and another set of Spec when I run the pre-prod environment. My current config is executing all my specs at the same time for both environements, which is something I want to avoid. I have multiple environments, that I have configured in my GebConfig: environments { local { baseUrl = "http://localhost:8090/myApp/login/auth" } pre-prod { baseUrl = "https://preprod/myApp/login/auth" } } erdi You could use a spock config file. Create annotations for the two types of

Grails geb getting parameters from commandline

风格不统一 提交于 2019-12-02 08:15:06
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? 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

invoking GORM methods from Geb tests

大憨熊 提交于 2019-12-02 06:15:15
In my Grails app, I have a suite of Geb tests wherein I invoke various GORM methods to save/retrieve data. This was working fine, until very recently. But now, whenever I try to invoke a GORM method from a Geb test, I get the following error: Method on class [com.example.MyDomainClass] was used outside of a Grails application. If running in the context of a test using the mocking API or bootstrap Grails correctly. I'm aware of the fact that under certain circumstances you need to use the remote control plugin to use GORM methods in Geb tests. However, in my case, I run the tests via grails

running a geb test from a java class

余生颓废 提交于 2019-12-02 02:09:10
问题 I've recently stumbled across geb and it looks like a good way to perform integration tests on our web applications. Our platforms are all java based and from reading that "Geb provides first class support for functional web testing via integration with popular testing frameworks such as ...JUnit, TestNG..." i assumed it would be easy to execute a test from a java class (testng test?). I'm new to groovy and geb. So far I have included geb-testng and groovy in my pom: <dependency> <groupId>org

Geb/Selenium tests hang loading new page

允我心安 提交于 2019-12-02 00:57:10
问题 My Selenium tests frequently hang indefinitely on CI, always at an attempt to load a new page in driver.get . I am using PhantomJS 1.9.8. After several rounds of debugging, I think I've traced the problem to the webpage load not completing in PhantomJS. Selenium RemoteWebDriver has sent a request to PhantomJS/GhostDriver and it is waiting on a response. GhostDriver is still accepting requests. I can see what page it's stuck on by hitting curl http://localhost:port/session/:sessionId/url and

running a geb test from a java class

烈酒焚心 提交于 2019-12-02 00:45:45
I've recently stumbled across geb and it looks like a good way to perform integration tests on our web applications. Our platforms are all java based and from reading that "Geb provides first class support for functional web testing via integration with popular testing frameworks such as ...JUnit, TestNG..." i assumed it would be easy to execute a test from a java class (testng test?). I'm new to groovy and geb. So far I have included geb-testng and groovy in my pom: <dependency> <groupId>org.codehaus.geb</groupId> <artifactId>geb-testng</artifactId> <version>0.7.0</version> </dependency>

How to refactor common Geb test sequences

≡放荡痞女 提交于 2019-12-01 22:36:16
Suppose I have multiple Geb/Spock tests that beings with logging in. For example: @Stepwise Class AddNewPictureSpec extends GebSpec { def "User at login page"() { given: "User beings from login page" to LoginPage } def "User gets redirected to Main page"() { given: "User at Login page" at LoginPage when: "User signs in" signIn "username", "pw" to MainPage then: at MainPage def "other test sequences follow...."() { } } And another test spec with the exact same start sequence: @Stepwise Class EditPictureSpec extends GebSpec { def "User at login page"() { given: "User beings from login page" to

Geb + Cucumber: Restart Browser Between Scenarios

余生颓废 提交于 2019-12-01 13:05:00
I'm using Grails 2.1.1 with Cucumber and Geb. I have an Auth.feature that contains 2 scenarios. One is for authenticating successfully and the other is for testing invalid credentials. The way I think I have to work this out is to have geb log out the user from the first scenario before it can run the second scenario. This is because my Given step checks to make sure I'm at the login page. After scenario 1 executes, I'm on a Dashboard page. I guess my question is do I (a) use geb to sign out the valid user before completing the scenario or (b) is there a way to have it start over between

Geb + Cucumber: Restart Browser Between Scenarios

坚强是说给别人听的谎言 提交于 2019-12-01 09:43:51
问题 I'm using Grails 2.1.1 with Cucumber and Geb. I have an Auth.feature that contains 2 scenarios. One is for authenticating successfully and the other is for testing invalid credentials. The way I think I have to work this out is to have geb log out the user from the first scenario before it can run the second scenario. This is because my Given step checks to make sure I'm at the login page. After scenario 1 executes, I'm on a Dashboard page. I guess my question is do I (a) use geb to sign out

Why does my Geb test return “failed to create driver from callback” even after updating my Selenium dependency in Grails?

核能气质少年 提交于 2019-12-01 08:27:15
I am referencing this previous thread ( geb.driver.DriverCreationException: failed to create driver from callback ) - but am still having problems. I am trying to run Geb functional tests under Grails 2.4.3 and I have my Selenium support dependency set to version 2.42.2. I've also tried it with 2.43.1 and 2.45.0. Geb will stall out and not finish if I try Selenium 2.42.2 or 2.43.1, and it will outright crash if I use 2.45.0. These are the errors I get: If I try Selenium support 2.42.2 or 2.43.1, I get this error: geb.driver.DriverCreationException: failed to create driver from callback If I