Created
March 20, 2014 06:39
-
-
Save liveweird/9658464 to your computer and use it in GitHub Desktop.
E2E tests in Protractor
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
// conditional test logic | |
function clearFilter() { | |
var filter = element(by.id('serviceCodeClearFilter')); | |
filter.getAttribute('disabled').then (function (val) { | |
if (!val) { | |
filter.click(); | |
} | |
}); | |
}; |
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
// keyboard short-cuts in automated test | |
describe("Shortcuts", function () { | |
it("opens the level 2 menu after typing the shortcut for level 1 menu item", function() { | |
var item = get1stLMenuItem(0); | |
expect(item.elem.getAttribute('class')).not.toContain('open'); | |
browser.actions().keyDown(protractor.Key.CONTROL) | |
.sendKeys('a') | |
.keyUp(protractor.Key.CONTROL) | |
.perform(); | |
expect(item.elem.getAttribute('class')).toContain('open'); | |
browser.actions().keyDown(protractor.Key.CONTROL) | |
.sendKeys('a') | |
.keyUp(protractor.Key.CONTROL) | |
.perform(); | |
expect(item.elem.getAttribute('class')).not.toContain('open'); | |
}); | |
}); |
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
// querying DOM using angular abstracts | |
describe("Display", function() { | |
it("has an item named 'AB' that doesn't have a default item", function() { | |
var category = element(by.repeater('category in categories').row(0)); | |
var subcategory = category.element(by.repeater('subcategory in category.subcategories').row(1)); | |
expect(subcategory.element(by.binding('subcategory.label')).getInnerHtml()).toEqual('AB_'); | |
expect(subcategory.$('a').getAttribute('href')).toMatch('#/A/AB$'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment