Created
August 5, 2014 05:19
-
-
Save auzwang/42abbbc359d6d86f85ab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define ["exports"], (exports) -> | |
breadcrumbBarAlias = "web-workspace-breadcrumbbar" | |
breadcrumbBarItemAlias = "web-container-breadcrumbitem" | |
exports.navigateTo = (areaName) -> | |
chain.start(-> browser.waitAndSelectComponent breadcrumbBarAlias) | |
.then((breadcrumbBar) -> | |
itemWithArea = null | |
breadcrumbBarItems = breadcrumbBar.query(breadcrumbBarItemAlias) | |
breadcrumbBarItems.forEach (item) -> | |
item.menuItems.some (menuItem) -> | |
if menuItem.text is areaName | |
itemWithArea = item | |
return true | |
false | |
return | |
throw "Could not find a direct navigation path to: " + areaName unless itemWithArea | |
menuButton = itemWithArea.query("button")[0] | |
menuButtonDom = menuButton.getEl().dom | |
Simulate.click menuButtonDom | |
) | |
.then(-> browser.waitAndSelectComponent "menuitem[text=\"" + areaName + "\"]") | |
.then (menuItem) -> | |
Simulate.click menuItem.getEl().dom | |
areaName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(['exports'], function (exports) { | |
'use strict'; | |
var breadcrumbBarAlias = 'web-workspace-breadcrumbbar', | |
breadcrumbBarItemAlias = 'web-container-breadcrumbitem'; | |
exports.navigateTo = function (areaName) { | |
return chain | |
.start(function () { | |
return browser.waitAndSelectComponent(breadcrumbBarAlias); | |
}) | |
.then(function (breadcrumbBar) { | |
var breadcrumbBarItems, | |
itemWithArea, | |
menuButton, | |
menuButtonDom; | |
breadcrumbBarItems = breadcrumbBar.query(breadcrumbBarItemAlias); | |
breadcrumbBarItems.forEach(function (item) { | |
item.menuItems.some(function (menuItem) { | |
if (menuItem.text === areaName) { | |
itemWithArea = item; | |
return true; | |
} | |
return false; | |
}); | |
}); | |
if (!itemWithArea) { | |
throw 'Could not find a direct navigation path to: ' + areaName; | |
} | |
menuButton = itemWithArea.query('button')[0]; | |
menuButtonDom = menuButton.getEl().dom; | |
Simulate.click(menuButtonDom); | |
}) | |
.then(function () { | |
return browser.waitAndSelectComponent('menuitem[text="' + areaName + '"]'); | |
}) | |
.then(function (menuItem) { | |
Simulate.click(menuItem.getEl().dom); | |
return areaName; | |
}); | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment