Skip to content

Instantly share code, notes, and snippets.

@barzik
Created September 24, 2016 07:47
Show Gist options
  • Save barzik/8c1cbe0778e94f42432498a40c5d8776 to your computer and use it in GitHub Desktop.
Save barzik/8c1cbe0778e94f42432498a40c5d8776 to your computer and use it in GitHub Desktop.
Page Object Exanmple
'use strict';
var myPage = function () {
browser.driver.manage().window().maximize();
};
myPage.prototype = Object.create({}, {
loadingBarSettings: { get: function () { return element(by.xpath('//div[@class="snake-foreground"]/div[3]')); } },
productNameHeader: { get: function () { return element(by.css('h2.ng-binding')); } },
productContentOwnersButton: { get: function () { return element(by.xpath('//span[contains(@class, "my-badge-text") and text() = "Content Owners"]')); } },
tooltip: { get: function () { return element(by.xpath('//div[@class="tooltip-inner"]')); } },
settingsButton: {get: function () { return element(by.xpath('//a[contains(@class, "product-settings")]')); } },
contentOwnersLabel: { get: function () { return element(by.xpath('//ul[contains(@class, "chosen-choices")]')); } },
saveSettingsButton: { get: function () { return element(by.xpath('//span[contains(@class, "ng-scope") and text() = "Save"]')); } },
inputContentOwner: {get: function () { return element(by.xpath('//li[contains(@class, "search-field")]')); } },
contentOwnerMalina: {get: function () { return element(by.xpath('//ul[@class="chosen-results"]//li[.="malina"]')); } },
contentOwnerMosest: {get: function () { return element(by.xpath('//ul[@class="chosen-results"]//li[.="mosest"]')); } },
deleteContentOwnerMalina: {get: function () { return element(by.xpath('//ul[@class="chosen-choices"]/li[2]/a')); } },
deleteContentOwnerMosest: {get: function () { return element(by.xpath('//ul[@class="chosen-choices"]/li[2]/a')); } },
backToProductButton: { get: function () { return element(by.xpath('//span[contains(@class, "text ng-binding") and text() = "Back to Operations Orchestration"]')); } },
popupContentOwnersTitle: { get: function () { return element(by.xpath('//h4[contains(@class, "modal-title") and text() = "Content Owners"]')); } },
contentOwnersList: { get: function () { return element(by.xpath('contentowners')); } },
popupContentOwnersCloseButton: { get: function () { return element(by.xpath('//button[contains(@class, "btn btn-primary") and text() = "Close"]')); } },
contentOfferingTile: { get: function () { return element(by.xpath('//h4[contains(@class, "ng-binding") and text() = "my Screen Recorder Add-In 4"]')); } },
contentOfferingTitle: { get: function () { return element(by.xpath('//h3[contains(@class, "page-title ng-binding")]')); } },
contentOfferingSettingsButton: { get: function () { return element(by.xpath('//a[contains(@class, "contentoffering-settings pull-right ng-scope")]')); } },
coContentOwners: { get: function () { return element(by.xpath('//h5[contains(@class, "m-b-2") and text() = "Content Owners"]/..')); } },
coContentOwnersLabel: { get: function () { return element(by.xpath('//label[text() = \'Content Owners\' and @for=\'contentOfferingsContentOwners\']')); } },
backToContentOfferingButton: { get: function () { return element(by.xpath('//span[contains(@class, "text ng-binding") and text() = "Back to my Screen Recorder Add-In 4"]')); } }
});
module.exports = myPage;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment