Spaces to tabs and license cleanup
This commit is contained in:
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package sample
|
||||
|
||||
import geb.spock.*
|
||||
@@ -13,112 +28,112 @@ import pages.*
|
||||
*/
|
||||
@Stepwise
|
||||
class UserTests extends GebReportingSpec {
|
||||
def 'first visit not authenticated'() {
|
||||
when:
|
||||
to HomePage
|
||||
then:
|
||||
form
|
||||
!username
|
||||
}
|
||||
def 'first visit not authenticated'() {
|
||||
when:
|
||||
to HomePage
|
||||
then:
|
||||
form
|
||||
!username
|
||||
}
|
||||
|
||||
def 'invalid login'() {
|
||||
setup:
|
||||
def user = 'rob'
|
||||
when:
|
||||
login(user, user+'invalid')
|
||||
then:
|
||||
!username
|
||||
error == 'Invalid username / password. Please ensure the username is the same as the password.'
|
||||
}
|
||||
def 'invalid login'() {
|
||||
setup:
|
||||
def user = 'rob'
|
||||
when:
|
||||
login(user, user+'invalid')
|
||||
then:
|
||||
!username
|
||||
error == 'Invalid username / password. Please ensure the username is the same as the password.'
|
||||
}
|
||||
|
||||
def 'empty username'() {
|
||||
setup:
|
||||
def user = ''
|
||||
when:
|
||||
login(user, user)
|
||||
then:
|
||||
!username
|
||||
error == 'Invalid username / password. Please ensure the username is the same as the password.'
|
||||
}
|
||||
def 'empty username'() {
|
||||
setup:
|
||||
def user = ''
|
||||
when:
|
||||
login(user, user)
|
||||
then:
|
||||
!username
|
||||
error == 'Invalid username / password. Please ensure the username is the same as the password.'
|
||||
}
|
||||
|
||||
def 'login single user'() {
|
||||
setup:
|
||||
def user = 'rob'
|
||||
when:
|
||||
login(user, user)
|
||||
then:
|
||||
username == user
|
||||
}
|
||||
def 'login single user'() {
|
||||
setup:
|
||||
def user = 'rob'
|
||||
when:
|
||||
login(user, user)
|
||||
then:
|
||||
username == user
|
||||
}
|
||||
|
||||
def 'add account'() {
|
||||
when:
|
||||
addAccount.click(HomePage)
|
||||
then:
|
||||
form
|
||||
!username
|
||||
}
|
||||
def 'add account'() {
|
||||
when:
|
||||
addAccount.click(HomePage)
|
||||
then:
|
||||
form
|
||||
!username
|
||||
}
|
||||
|
||||
def 'log in second user'() {
|
||||
setup:
|
||||
def user = 'luke'
|
||||
when:
|
||||
login(user, user)
|
||||
then:
|
||||
username == user
|
||||
}
|
||||
def 'log in second user'() {
|
||||
setup:
|
||||
def user = 'luke'
|
||||
when:
|
||||
login(user, user)
|
||||
then:
|
||||
username == user
|
||||
}
|
||||
|
||||
def 'following links keeps new session'() {
|
||||
when:
|
||||
navLink.click(LinkPage)
|
||||
then:
|
||||
username == 'luke'
|
||||
}
|
||||
def 'following links keeps new session'() {
|
||||
when:
|
||||
navLink.click(LinkPage)
|
||||
then:
|
||||
username == 'luke'
|
||||
}
|
||||
|
||||
def 'switch account rob'() {
|
||||
setup:
|
||||
def user = 'rob'
|
||||
when:
|
||||
switchAccount(user)
|
||||
then:
|
||||
username == user
|
||||
}
|
||||
def 'switch account rob'() {
|
||||
setup:
|
||||
def user = 'rob'
|
||||
when:
|
||||
switchAccount(user)
|
||||
then:
|
||||
username == user
|
||||
}
|
||||
|
||||
def 'following links keeps original session'() {
|
||||
when:
|
||||
navLink.click(LinkPage)
|
||||
then:
|
||||
username == 'rob'
|
||||
}
|
||||
def 'following links keeps original session'() {
|
||||
when:
|
||||
navLink.click(LinkPage)
|
||||
then:
|
||||
username == 'rob'
|
||||
}
|
||||
|
||||
def 'switch account luke'() {
|
||||
setup:
|
||||
def user = 'luke'
|
||||
when:
|
||||
switchAccount(user)
|
||||
then:
|
||||
username == user
|
||||
}
|
||||
def 'switch account luke'() {
|
||||
setup:
|
||||
def user = 'luke'
|
||||
when:
|
||||
switchAccount(user)
|
||||
then:
|
||||
username == user
|
||||
}
|
||||
|
||||
def 'logout luke'() {
|
||||
when:
|
||||
logout.click(HomePage)
|
||||
then:
|
||||
!username
|
||||
}
|
||||
def 'logout luke'() {
|
||||
when:
|
||||
logout.click(HomePage)
|
||||
then:
|
||||
!username
|
||||
}
|
||||
|
||||
def 'switch back rob'() {
|
||||
setup:
|
||||
def user = 'rob'
|
||||
when:
|
||||
switchAccount(user)
|
||||
then:
|
||||
username == user
|
||||
}
|
||||
def 'switch back rob'() {
|
||||
setup:
|
||||
def user = 'rob'
|
||||
when:
|
||||
switchAccount(user)
|
||||
then:
|
||||
username == user
|
||||
}
|
||||
|
||||
def 'logout rob'() {
|
||||
when:
|
||||
logout.click(HomePage)
|
||||
then:
|
||||
!username
|
||||
}
|
||||
def 'logout rob'() {
|
||||
when:
|
||||
logout.click(HomePage)
|
||||
then:
|
||||
!username
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package sample.pages
|
||||
|
||||
import geb.*
|
||||
@@ -8,24 +23,24 @@ import geb.*
|
||||
* @author Rob Winch
|
||||
*/
|
||||
class HomePage extends Page {
|
||||
static url = ''
|
||||
static at = { assert driver.title == 'Demonstrates Multi User Log In'; true}
|
||||
static content = {
|
||||
navLink { $('#navLink') }
|
||||
error { $('#error').text() }
|
||||
form { $('form') }
|
||||
username(required:false) { $('#un').text() }
|
||||
logout(required:false) { $('#logout') }
|
||||
addAccount(required:false) { $('#addAccount') }
|
||||
submit { $('input[type=submit]') }
|
||||
login(required:false) { user, pass ->
|
||||
form.username = user
|
||||
form.password = pass
|
||||
submit.click(HomePage)
|
||||
}
|
||||
switchAccount{ un ->
|
||||
$("#switchAccount${un}").click(HomePage)
|
||||
}
|
||||
attributes { moduleList AttributeRow, $("table tr").tail() }
|
||||
}
|
||||
static url = ''
|
||||
static at = { assert driver.title == 'Demonstrates Multi User Log In'; true}
|
||||
static content = {
|
||||
navLink { $('#navLink') }
|
||||
error { $('#error').text() }
|
||||
form { $('form') }
|
||||
username(required:false) { $('#un').text() }
|
||||
logout(required:false) { $('#logout') }
|
||||
addAccount(required:false) { $('#addAccount') }
|
||||
submit { $('input[type=submit]') }
|
||||
login(required:false) { user, pass ->
|
||||
form.username = user
|
||||
form.password = pass
|
||||
submit.click(HomePage)
|
||||
}
|
||||
switchAccount{ un ->
|
||||
$("#switchAccount${un}").click(HomePage)
|
||||
}
|
||||
attributes { moduleList AttributeRow, $("table tr").tail() }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package sample.pages
|
||||
|
||||
import geb.*
|
||||
@@ -8,13 +23,13 @@ import geb.*
|
||||
* @author Rob Winch
|
||||
*/
|
||||
class LinkPage extends Page {
|
||||
static url = ''
|
||||
static at = { assert driver.title == 'Linked Page'; true}
|
||||
static content = {
|
||||
form { $('#navLinks') }
|
||||
username(required:false) { $('#un').text() }
|
||||
switchAccount{ un ->
|
||||
$("#switchAccount${un}").click(HomePage)
|
||||
}
|
||||
}
|
||||
static url = ''
|
||||
static at = { assert driver.title == 'Linked Page'; true}
|
||||
static content = {
|
||||
form { $('#navLinks') }
|
||||
username(required:false) { $('#un').text() }
|
||||
switchAccount{ un ->
|
||||
$("#switchAccount${un}").click(HomePage)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user