-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the smoke tests for reason form #2448
Conversation
browser.waitForAngular() | ||
element(By.buttonText('Start Build')).click() | ||
browser.get('#/builders/1') | ||
reasonForce.getLink('1/') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This api name is not clear to me.
goToURL might be clearer
browser.get('#/builders/1') | ||
reasonForce.getLink('1/') | ||
reasonForce.getLink('1/force/force') | ||
reasonForce.getStart() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getStart is not clear to me.
clickStartButton() would be more meaningful.
actually, what would be better is to say
forcePage.getStartButton().click()
|
||
describe('', () -> | ||
beforeEach(() -> | ||
reasonForce = new forceSchedulerPage() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forcePage = new forceSchedulerPage()
forcePage.go()
describe 'force', () -> | ||
it 'should create a build', () -> | ||
browser.get('#/builders/1') | ||
reasonForce = new forceSchedulerPage() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forcePage = new forceSchedulerPage(builderid:1, forceschedulername: 'force')
successBuildIncrease = -> | ||
lastbuild.then (lastbuild)-> | ||
element.all(By.css('span.badge-status.results_SUCCESS')) | ||
.count().then (nextbuild)-> | ||
return +nextbuild == +lastbuild + 1 | ||
browser.wait(successBuildIncrease, 20000) | ||
browser.get('#/waterfall') | ||
reasonForce.getWaterfall() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
waterfallPage = new WaterfallPage()
waterfallPage.go()
#return @ | ||
|
||
getLink: (link) -> | ||
browser.get('#/builders/'+ link) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unneeded
@@ -0,0 +1,88 @@ | |||
# this file will contains the different generic functions which | |||
# will be called by the different tests | |||
# |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs to add that this is inspired by this methodology
http://www.lindstromhenrik.com/using-protractor-with-coffeescript/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your efforts. Its much better, but there are still some improvments
|
||
lastbuild = element.all(By.css('span.badge-status.results_SUCCESS')).count(); | ||
forcePage.goToURL('#/builders/1/'); | ||
forcePage.goToURL('#/builders/1/force/force'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
goToURL is better. but actually I think it is better to hardcode the URL in the page classes.
So that would be
forcePage.go()
without the need to first go to the builders page
|
||
describe('', () -> | ||
beforeEach(() -> | ||
forcePage = new forceSchedulerPage(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is the need to parametrise the page
forcePage = new forceSchedulerPage(builder:1, schedulername: 'force');
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will be manage in a second time
forcePage = null; | ||
waterfallPage = null; | ||
|
||
describe('', () -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You will not need that describe, but rather put the beforeEach into the describe 'force' test
forceSchedulerPage = require('./reason_force.coffee') | ||
waterFallPage = require('./waterfall.coffee') | ||
|
||
forcePage = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put those variables inside the describe scope
|
||
|
||
|
||
describe 'force', () -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here you dont need that second level of describe. Only one level is needed
element.all(By.css('span.badge-status.results_SUCCESS')); | ||
.count().then (nextbuild)-> | ||
return +nextbuild == +lastbuild + 1; | ||
browser.wait(successBuildIncrease, 20000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole wait loop might abstracted inside the builderpage.
builderPage.waitNextBuildFinished(lastbuild)
goToURL: (link) -> | ||
browser.get(link); | ||
|
||
clickOnStartButton: -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
those 3 functions are getters, so they need to be called e.g. getStartButton
forcePage.writeAndCheckBranchName("Gerrit Branch"); | ||
forcePage.writeAndCheckRepo("http//name.com"); | ||
forcePage.writeAndCheckRevisionName("12345"); | ||
forcePage.clickOnCancelButton().click(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we should make sure this did not create a build?
make sure it goes back to the builder page?
constructor: -> | ||
browser.get('#/waterfall'); | ||
|
||
goToWaterfall: -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
go is enough. as it is supposed to be called as
waterfallPage.go()
return +nextbuild == +lastbuild + 1; | ||
browser.wait(successBuildIncrease, 20000); | ||
waterfallPage.goToWaterfall(); | ||
expect(element.all(By.css('rect.success')).count()).toBeGreaterThan(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here we should read:
expect(waterfallPage.countSuccess()).toBeGreaterThan(0)
Current coverage is 86.75% (diff: 100%)
|
task is on going |
# inspired by this methodology | ||
# http://www.lindstromhenrik.com/using-protractor-with-coffeescript/ | ||
|
||
class builderSchedulerPage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BuilderPage ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BuilderPage ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new patchset on going
|
||
go: () -> | ||
builderID = @builderID | ||
browser.get('#/builders/#{builderID}/') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can simplify by saying:
browser.get('#/builders/#{@builderID}/')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new patchset on going
goForce: (forcename) -> | ||
builderID = @builderID | ||
forceName=@forceName | ||
browser.get("#/builders/#{builderID}/force/#{forceName}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idem
|
||
class waterfallPage | ||
constructor: -> | ||
browser.get('#/waterfall'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont go to waterfall when you instanciate the class
c['change_source'] = [] | ||
c['change_source'].append(changes.GitPoller( | ||
'https://github.com/buildbot/pyflakes.git', | ||
'git://github.com/buildbot/pyflakes.git', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please keep http as this is easier to go through the proxy
# run the tests (note that this will require that 'trial' is installed) | ||
factory.addStep(steps.ShellCommand(command=["trial", "pyflakes"])) | ||
|
||
|
||
#slowfactory = util.BuildFactory() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please no commented code
@@ -2,7 +2,7 @@ exports.config = { | |||
allScriptsTimeout: 11000, | |||
|
|||
specs: [ | |||
'e2e/*.scenarios.coffee' | |||
'e2e/force.scenarios.coffee' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep *.scenarios
9293162
to
0276633
Compare
it 'should create a build', () -> | ||
builder.go() | ||
builder.getBuildCount().then (lastbuild) -> | ||
#forcePage = builderPage.goForce() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove comment
}[builder] | ||
@forceName=forcename | ||
|
||
#@loglink = element(By.id('logLink')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove commented code
|
||
class forcePage | ||
constructor: -> | ||
#@loglink = element(By.id('logLink')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idem
expect(reasonElement.getAttribute('value')).toBe(reason) | ||
|
||
setYourName: (yourName) -> | ||
reasonElement = element(By.css("forcefield label[for='username'] + div input")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its not anymore the reasonElement. call it element in all the methods, and this will be fine
reasonElement.sendKeys(projectName) | ||
expect(reasonElement.getAttribute('value')).toBe(projectName) | ||
|
||
setBranchName: (branchName) -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you could factorize this code. the last four lines are the same for every methods
b67683d
to
ec73486
Compare
using protractor as test tools Signed-off-by: David Desurmont <david.desurmont@gmail.com> Signed-off-by: desurd <david.desurmont@gmail.com>
using protractor as test tools