Skip to content

Commit

Permalink
Add Usage Explorer Tests (ubccr#1062)
Browse files Browse the repository at this point in the history
* Add Usage Tests for disabled Display Menu Items

- Added a few UI tests that ensures the `Std Err Bars` and `Std Err Labels`
  `Display` menu items are disabled. This is to ensure that we have

* eslint fixes
  • Loading branch information
ryanrath authored and smgallo committed Oct 1, 2019
1 parent cf92fdb commit 7c2b79e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
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();

0 comments on commit 7c2b79e

Please sign in to comment.