Skip to content

Commit

Permalink
try to reproduce issue with login smoke tests
Browse files Browse the repository at this point in the history
adding a sleep so that we can try to hyper exec into the worker
  • Loading branch information
tardyp committed Apr 24, 2017
1 parent 1dc41f4 commit 3527930
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 10 deletions.
10 changes: 4 additions & 6 deletions smokes/e2e/home.scenarios.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,23 @@
# test goal: checks the the number of element present in home page
# to test this part: two different builds need to be started


forcePage = require('./pages/force.coffee')
builderPage = require('./pages/builder.coffee')
homePage = require('./pages/home.coffee')


describe 'home page', () ->
force = null
builder = null
home = null

beforeEach(() ->
beforeEach () ->
builder = new builderPage('runtests', 'force')
force = new forcePage()
home = new homePage()
builder.goDefault()
)
home.loginUser("my@email.com", "mypass")

afterEach () ->
new homePage().waitAllBuildsFinished()
home.logOut()

it 'should go to the home page and check the different builder', () ->
builderName = {
Expand Down
31 changes: 31 additions & 0 deletions smokes/e2e/pages/home.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,37 @@ class HomePage
getPanel: () ->
return element.all(By.css(".panel-title"))

getAnonymousButton: ->
anonymousButton = element(By.css('[ng-class="loginCollapsed ? \'\':\'open\'"'))
return anonymousButton

getLoginButton: ->
return element(By.buttonText('Login'))

setUserText: (value) ->
setUserValue = element.all(By.css('[ng-model="username"]'))
setUserValue.clear()
setUserValue.sendKeys(value)

setPasswordText: (value) ->
setPasswordValue = element.all(By.css('[ng-model="password"]'))
setPasswordValue.clear()
setPasswordValue.sendKeys(value)

logOut: ->
@go()
element.all(By.css('.avatar img')).click()
element.all(By.css('[ng-click="logout()"]')).click()
anonymousButton = element(By.css('[ng-class="loginCollapsed ? \'\':\'open\'"'))
expect(anonymousButton.getText()).toContain("Anonymous")

loginUser: (user, password) ->
@go()
@getAnonymousButton().click()
@setUserText(user)
@setPasswordText(password)
@getLoginButton().click()

waitAllBuildsFinished: () ->
@go()
self = this
Expand Down
11 changes: 11 additions & 0 deletions smokes/master.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,16 @@ c['db'] = {
'db_url': "sqlite:///state.sqlite",
}

authz = util.Authz(
allowRules=[
],
roleMatchers=[
util.RolesFromEmails(admins=["my@email.com"])
]
)
auth=util.UserPasswordAuth({'my@email.com': 'mypass'})
c['www']['auth'] = auth
c['www']['authz'] = authz

# in order to share this snippet in the doc, we load mydashboard.py using exec
exec(open("mydashboard.py").read())
12 changes: 8 additions & 4 deletions smokes/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
set -e
set -v
cd `dirname $0`
function finish {
sleep 3600
set +e
buildbot stop workdir
buildbot-worker stop workdir/worker
rm -rf workdir
}
trap finish EXIT
rm -rf workdir
buildbot create-master workdir
ln -s ../templates ../mydashboard.py ../master.cfg workdir
Expand All @@ -27,7 +35,3 @@ else
./node_modules/protractor/bin/webdriver-manager update
./node_modules/protractor/bin/protractor protractor.conf.js
fi
set +e
buildbot stop workdir
buildbot-worker stop workdir/worker
rm -rf workdir

0 comments on commit 3527930

Please sign in to comment.