Click here to Skip to main content
15,899,025 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
"use strict";

var specHelper = require("../../utils/intSpecHelper");
var oracleHelper = require("../../utils/oracleHelper");
var config = global.envConfig;

describe("Profile", function () { // NOSONAR (relax "Functions should not have too many lines")
var testProfileLinks = function (expectedLinks) {
var verifyItem = function (index, link) {
specHelper.waitForElementToBeVisible(".profile-wrapper .sub-menu");
specHelper.performMouseMove($(".profile-wrapper"));
var element = $$(".profile-wrapper a").get(index);
if (link.href) {
specHelper.verifyExternalLink(element, link.label, link.href);
} else {
specHelper.expectText(element, link.label);
}
};

// Verify the text of the hover
var fullNameElem = $(".profile-wrapper .profile-full-name");
expect(fullNameElem.getText()).toEqual(expectedLinks[0].label);
// Verify the contents of the hover menu are initially hidden
expect($(".profile-wrapper .sub-menu").isDisplayed()).toEqual(false);
expect($$(".profile-wrapper a").count()).toEqual(expectedLinks.length);

// Skip the first link because it's the menu button
for (var i = 1; i < expectedLinks.length; i++) {
verifyItem(i, expectedLinks[i]);
}
};

describe("Non-admin user", function () {
beforeAll(function (done) {
var that = this;

oracleHelper.addUser("murano_profile_non_admin").then(function () {
return specHelper.login("murano_profile_non_admin", that);
}).done(done);
});

afterAll(function (done) {
oracleHelper.removeUser("murano_profile_non_admin").done(done);
});


it("should display the correct profile dropdown", function (done) {
testProfileLinks([
{
label: "Murano User"
},
{
label: "My Profile"
},
{
label: "My Security",
href: config.eConnectUrl + "/auth/security/credentialChange.do?cmdCredentialChange=20"
},
{
label: "My Alerts",
href: config.eConnectUrl + "/alerts/learn_more.jsp?QUICKLINK_MODE=1"
}
]);
done();
});
});

fdescribe("Admin user", function () {
beforeAll(function (done) {
specHelper.login("ericmah", this);
done();
});

it("should display the correct profile dropdown", function (done) {
testProfileLinks([
{
label: "Eric Mah"
},
{
label: "My Profile"
},
{
label: "My Security",
href: config.eConnectUrl + "/auth/security/credentialChange.do?cmdCredentialChange=20"
},
{
label: "My Alerts",
href: config.eConnectUrl + "/alerts/learn_more.jsp?QUICKLINK_MODE=1"
},
{
label: "Administration"
},
{
label: "Users",
href: config.eConnectUrl + "/useradmin/userSearchAction.do?actionLabel=getClientUserList&" +
"QUICKLINK_MODE=1"
},
{
label: "Alerts",
href: config.eConnectUrl + "/alerts/AutoAlerts.do?cmdAlertGroup=1&QUICKLINK_MODE=1"
},
{
label: "Audits",
href: config.eConnectUrl + "/audit/activityReportAction.do?cmd=103&QUICKLINK_MODE=1"
}
]);
done();
});
});
});
Posted
Comments
Matt T Heffron 15-Dec-15 18:40pm    
This is not a question!
This is just a code dump!
Use the "Improve question" above to ask a concise, specific question describing the problem you are having. Include the relevant code and format it appropriately (use the "Code" button in the Question Editor).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900