File tree Expand file tree Collapse file tree 3 files changed +125
-0
lines changed
grails-test-examples/scaffolding/src/integrationTest/groovy/com/example Expand file tree Collapse file tree 3 files changed +125
-0
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * Licensed to the Apache Software Foundation (ASF) under one
3+ * or more contributor license agreements. See the NOTICE file
4+ * distributed with this work for additional information
5+ * regarding copyright ownership. The ASF licenses this file
6+ * to you under the Apache License, Version 2.0 (the
7+ * "License"); you may not use this file except in compliance
8+ * with the License. You may obtain a copy of the License at
9+ *
10+ * https://www.apache.org/licenses/LICENSE-2.0
11+ *
12+ * Unless required by applicable law or agreed to in writing,
13+ * software distributed under the License is distributed on an
14+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+ * KIND, either express or implied. See the License for the
16+ * specific language governing permissions and limitations
17+ * under the License.
18+ */
19+
20+ package com.example
21+
22+ import com.example.pages.LoginPage
23+
24+ import grails.plugin.geb.ContainerGebSpec
25+ import grails.testing.mixin.integration.Integration
26+
27+ @Integration (applicationClass = Application )
28+ class UserControllerSpec extends ContainerGebSpec {
29+
30+ void setup () {
31+ go ' /'
32+ to LoginPage
33+ username = ' test@grails.org'
34+ password = ' letmein'
35+ loginButton. click()
36+ }
37+
38+ void cleanup () {
39+ try {
40+ go ' logout'
41+ $(' input' , value : ' Log Out' ). click()
42+ }
43+ catch (ignored) {
44+ // ignored
45+ }
46+ }
47+
48+ void " User list" () {
49+ when :
50+ go ' user/index'
51+
52+ then :
53+ title == ' User List'
54+ }
55+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * Licensed to the Apache Software Foundation (ASF) under one
3+ * or more contributor license agreements. See the NOTICE file
4+ * distributed with this work for additional information
5+ * regarding copyright ownership. The ASF licenses this file
6+ * to you under the Apache License, Version 2.0 (the
7+ * "License"); you may not use this file except in compliance
8+ * with the License. You may obtain a copy of the License at
9+ *
10+ * https://www.apache.org/licenses/LICENSE-2.0
11+ *
12+ * Unless required by applicable law or agreed to in writing,
13+ * software distributed under the License is distributed on an
14+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+ * KIND, either express or implied. See the License for the
16+ * specific language governing permissions and limitations
17+ * under the License.
18+ */
19+
20+ package com.example.pages
21+
22+ import geb.Page
23+
24+ class LoginPage extends Page {
25+
26+ static url = ' login'
27+
28+ static at = { title == ' Please sign in' }
29+
30+ static content = {
31+ loginForm { $(' form.login-form' ) }
32+ username { $(' input' , name : ' username' ) }
33+ password { $(' input' , name : ' password' ) }
34+ loginButton { $(' button.primary' , type : ' submit' ) }
35+ }
36+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * Licensed to the Apache Software Foundation (ASF) under one
3+ * or more contributor license agreements. See the NOTICE file
4+ * distributed with this work for additional information
5+ * regarding copyright ownership. The ASF licenses this file
6+ * to you under the Apache License, Version 2.0 (the
7+ * "License"); you may not use this file except in compliance
8+ * with the License. You may obtain a copy of the License at
9+ *
10+ * https://www.apache.org/licenses/LICENSE-2.0
11+ *
12+ * Unless required by applicable law or agreed to in writing,
13+ * software distributed under the License is distributed on an
14+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+ * KIND, either express or implied. See the License for the
16+ * specific language governing permissions and limitations
17+ * under the License.
18+ */
19+
20+ package com.example.pages
21+
22+ import geb.Page
23+
24+ class LogoutPage extends Page {
25+
26+ static url = ' logout'
27+
28+ static at = { title == ' Confirm Log Out?' }
29+
30+ static content = {
31+ logoutForm { $(' form' ) }
32+ logoutButton { $(' button' , value : ' Log Out' ) }
33+ }
34+ }
You can’t perform that action at this time.
0 commit comments