Skip to content

Instantly share code, notes, and snippets.

@Baabet
Created October 20, 2014 12:37
Show Gist options
  • Save Baabet/764b768a5a8ea0031151 to your computer and use it in GitHub Desktop.
Save Baabet/764b768a5a8ea0031151 to your computer and use it in GitHub Desktop.
for i in [0..3]
console.log expectedNames[i]
for i in [0..3]
detail.get(projectId, expectedUrls[i]).then =>
detail.getActiveTabName().then (tabName) =>
console.log expectedNames[i]
expect(tabName).toBe expectedNames[i]
@Baabet
Copy link
Author

Baabet commented Oct 20, 2014

it 'should navigate corectly to right tab by url', =>
console.log "\nSTART testu Url vede na spravny tab"
detail = new Detail
console.log expectedNames
for i in [0..3]
console.log expectedNames[i]
for i in [0..3]
detail.get(projectId, expectedUrls[i]).then =>
detail.getActiveTabName().then (tabName) =>
console.log expectedNames[i]
expect(tabName).toBe expectedNames[i]

@Baabet
Copy link
Author

Baabet commented Oct 20, 2014

class Detail

constructor: ->
    @activeTabLink = element By.css '#projectTabs li.active a'

get: (projectId, url) =>
    browser.get('/project/' + projectId + '/#/' + url)

getActiveTabLink: =>
    @activeTabLink

getActiveTabName: =>
    browser.driver.wait( =>
        @getActiveTabLink().isDisplayed()
    , 10000, 'Waited for active tab text is shown.')
    @getActiveTabLink().getText()

module.exports = Detail

@Baabet
Copy link
Author

Baabet commented Oct 20, 2014

Dostanu>

 [exec] START testu Url vede na spravny tab
 [exec] [ 'Tests', 'Settings', 'Users', 'Reports' ]
 [exec] Tests
 [exec] Settings
 [exec] Users
 [exec] Reports
 [exec] undefined
 [exec] undefined
 [exec] undefined
 [exec] undefined
 [exec] KONEC testu tabUse
 [exec] F
 [exec] START testu Test tools should switch test on and off
 [exec] KONEC testu tabUse
 [exec] ...
 [exec] 
 [exec] Failures:
 [exec] 
 [exec]   1) Tab navigation should navigate corectly to right tab by url
 [exec]    Message:
 [exec]      Expected 'Tests' to be undefined.
 [exec] 
 [exec] 
 [exec]   2) Tab navigation should navigate corectly to right tab by url
 [exec]    Message:
 [exec]      Expected 'Settings' to be undefined.
 [exec] 
 [exec] 
 [exec]   3) Tab navigation should navigate corectly to right tab by url
 [exec]    Message:
 [exec]      Expected 'Users' to be undefined.
 [exec] 
 [exec] 
 [exec]   4) Tab navigation should navigate corectly to right tab by url
 [exec]    Message:
 [exec]      Expected 'Reports' to be undefined.
 [exec] 
 [exec] 
 [exec] Finished in 29.602 seconds
 [exec] 14 tests, 6 assertions, 4 failures

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment