Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Usage Explorer Tests #1062

Merged
merged 2 commits into from
Sep 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions tests/ui/test/specs/xdmod/usageTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,31 @@ describe('Usage', function () {
browser.waitForLoadedThenClick(usg.treeNodeByPath('Jobs Summary', 'Job Size: Min'));
browser.waitForExist(usg.chartByTitle('Job Size: Min (Core Count)'));
usg.checkLegendText(expected.centerdirector.legend);

// Check to make sure that the 'Std Err' display menu items are disabled.
browser.waitForLoadedThenClick(usg.toolbarButtonByText('Display'));
['Std Err Bars', 'Std Err Labels'].forEach(function (menuLabel) {
browser.waitForVisible(usg.displayMenuItemByText(menuLabel));
expect(usg.toolbarMenuItemIsEnabled(menuLabel)).to.equal(false);
});
});
it('View CPU Hours by System Username', function () {
browser.waitForLoadedThenClick(usg.unfoldTreeNodeByName('Jobs Summary'));
browser.waitForLoadedThenClick(usg.unfoldTreeNodeByName('Jobs by System Username'));
browser.waitUntilAnimEndAndClick(usg.treeNodeByPath('Jobs by System Username', 'CPU Hours: Per Job'));
browser.waitForExist(usg.chartByTitle('CPU Hours: Per Job: by System Username'));
});
it('View CPU Hours: Per Job', function () {
browser.waitForLoadedThenClick(usg.unfoldTreeNodeByName('Jobs Summary', 'CPU Hours: Per Job'));
browser.waitForExist(usg.chartByTitle('CPU Hours: Per Job'));

// Check to make sure that the 'Std Err' display menu items are disabled.
browser.waitForLoadedThenClick(usg.toolbarButtonByText('Display'));
['Std Err Bars', 'Std Err Labels'].forEach(function (menuLabel) {
browser.waitForVisible(usg.displayMenuItemByText(menuLabel));
expect(usg.toolbarMenuItemIsEnabled(menuLabel)).to.equal(true);
});
});
});
logIn.logout();
describe('(Public User)', function () {
Expand Down
18 changes: 18 additions & 0 deletions tests/ui/test/specs/xdmod/usageTab.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ class Usage {
this.durationButton = this.panel + '//button[contains(@class,"custom_date")]';
this.durationMenu = '//div[contains(@class,"x-menu-floating")]';
this.durationMenuItem = name => `${this.durationMenu}//li/a[./span[text()="${name}"]]`;
this.toolbarButtonByText = function (text) {
return `//div[contains(@class, "x-toolbar")]//button[contains(text(), "${text}")]`;
};
this.displayMenuItemByText = function (text) {
return `//div[@id='chart_config_menu_chart_toolbar_tg_usage']//span[contains(text(), '${text}')]//ancestor::li[contains(@class, 'x-menu-list-item')]`;
};
}

checkLegendText(text) {
Expand Down Expand Up @@ -187,5 +193,17 @@ class Usage {
browser.waitUntilAnimEndAndClick(this.treeNodeByPath(topName, childName));
browser.waitForAllInvisible(this.mask);
}

/**
* Check if the menu item element that contains the text in `display` is enabled.
*
* @param display
* @returns {boolean}
*/
toolbarMenuItemIsEnabled(display) {
var item = this.displayMenuItemByText(display);
browser.waitForVisible(item);
return !($(item).getAttribute('class').includes('x-item-disabled'));
}
}
module.exports = new Usage();