Skip to content
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 new tests for the home web page, for the navigations inside of a … #2568

Merged
merged 1 commit into from Jan 26, 2017

Conversation

desurd
Copy link
Contributor

@desurd desurd commented Jan 6, 2017

…build reference
(previous, next functions), for the rebuild function

Signed-off-by: desurd david.desurmont@gmail.com

Remove this paragraph

Please have a look at our developer documentation before submitting your Pull Request.
http://trac.buildbot.net/wiki/Development
And especially:
http://trac.buildbot.net/wiki/SubmittingPatches

Contributor Checklist:

  • I have updated the unit tests
  • I have created a file in the master/buildbot/newsfragment directory (and read the README.txt in that directory)
  • I have updated the appropriate documentation

@mention-bot
Copy link

@desurd, thanks for your PR! By analyzing the history of the files in this pull request, we identified @tardyp to be a potential reviewer.

Copy link
Member

@tardyp tardyp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are good tests overall.

Please submit them in separated PRs so that it will be easier for review and faster to merge the good ones.

describe 'manage waterfall', () ->
it 'should navigate to the waterfall and check the different builder', () ->
browser.get('#/builders/1/builds/15')
#lastBuildURL = browser.getLocationAbsUrl()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove commented code

# force.getStartButton().click()
# browser.waitForAngular()
# browser.sleep(4000)
#lastBuildURL = browser.getLocationAbsUrl()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove commented code

force.getStartButton().click()
#browser.get('#/builders/1/builds/15')
home.go()
alltitles = element.all(By.css(".panel-title"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we probably want to abstract those in homePage.getPanel(0), homePage.getPanel(1)


describe 'manage home web page', () ->
it 'should go to the home page and check the different builder', () ->
researchData = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

researchData? just call it builderNames. I dont think this is stable to hardcode the order like this.
I think the home page builder order is undefined. We should define it to order it by buildername.
This will make the test more stable to environement changes

browser.get('#/')

module.exports = HomePage
# getBuilderReference(reference): ->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was a good start..

builder.goForce()
force.getStartButton().click()
browser.waitForAngular()
browser.sleep(4000)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why those sleeps? Try to avoid them as this slows down a lot the tests

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need this time out to be sure that the build is really started and to avoid to group the request
this time out will be reduced to 2000
second solution: to add a parameter which forbids the request group capability

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to wait the build is started in the UI.
When the force button is pushed you go to the buildrequest page, when the build is started you will automatically go to the build page.

So you can just poll until the current page is a build page to now that the build has started.

@desurd desurd force-pushed the mysmokes branch 3 times, most recently from 1aa9db4 to 4238da2 Compare January 12, 2017 13:57
@tardyp
Copy link
Member

tardyp commented Jan 12, 2017

This needs a rebase

builder.go()
builder.waitNextBuildFinished(+lastbuild + 1)
builder.go()
builder.getLastSuccessBuildNumber().then (lastbuild) ->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to get LastBuildNumber again, it will be lastbuild + 2

describe 'rebuild button', () ->
it 'should navigate to a dedicated build and to use the rebuild button', () ->
builder.go()
builder.getLastSuccessBuildNumber().then (buildValue) ->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order for this to work you need to ensure there is at least one build.

@desurd desurd force-pushed the mysmokes branch 5 times, most recently from 1665000 to fd4378b Compare January 13, 2017 14:12
builder.getRebuildButton().click()
browser.getLocationAbsUrl().then (buildUrl) ->
# expect than build keyword is present in buildURL
expect(buildUrl.indexOf("builds") != "-1" )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is racy as if the build does not start fast enough, we will still be in buildrequest page.
So we rather need to add a browser.wait instead of expect

@desurd desurd force-pushed the mysmokes branch 2 times, most recently from b32b169 to e7d6bcc Compare January 16, 2017 16:44
builder.goBuild(lastbuild)
browser.getLocationAbsUrl().then (buildUrl) ->
builder.getRebuildButton().click()
browser.getLocationAbsUrl().then (buildUrl) ->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

builder.waitGoToBuild(lastbuild+1)

browser.wait(buildCountIncrement, 10000)

buildsContents: (buildURL, lastbuild) ->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

waitGoToBuild: (expected_buildnumber) ->
    isInBuild = () ->
          browser.getLocationAbsUrl().then (buildUrl) ->
                  split = buildURL.split("/")
                  builds_part = split[split.lenght-2]
                  if builds_part != "builds"
                       return false
                  split = buildURL.split("/")
                  number = +split[split.lenght-1]
                  if number != expected_buildnumber
                       return false
                  return true
    browser.wait(isInBuild, 10000)

browser.wait(buildCountIncrement, 10000)

buildsContents: (buildURL, lastbuild) ->
buildElement = () ->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you keep this code? is it used

@desurd desurd force-pushed the mysmokes branch 3 times, most recently from 54505ed to 661e945 Compare January 25, 2017 15:38
…build reference

(previous, next functions), for the rebuild function

Signed-off-by: desurd <david.desurmont@gmail.com>
@tardyp tardyp merged commit 3abd0ec into buildbot:master Jan 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants