Skip to content

Commit

Permalink
#359 navbar tests finished
Browse files Browse the repository at this point in the history
  • Loading branch information
canbax committed Jun 4, 2021
1 parent 24a7ca1 commit 53d5465
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 8 deletions.
1 change: 0 additions & 1 deletion cypress/downloads/Visuall_User_Profile.vall

This file was deleted.

Binary file removed cypress/downloads/visuall.png
Binary file not shown.
2 changes: 1 addition & 1 deletion cypress/fixtures/Visuall_User_Profile.vall
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"userPref":{"isAutoIncrementalLayoutOnChange":true,"isHighlightOnHover":false,"isShowOverviewWindow":false,"isShowEdgeLabels":true,"isIgnoreCaseInText":false,"isOnlyHighlight4LatestQuery":true,"isStoreUserProfile":true,"isCollapseEdgesBasedOnType":false,"isCollapseMultiEdgesOnLoad":true,"isLimitDbQueries2range":true,"dbQueryTimeRange":{"start":-5364669352000,"end":4102434000000},"savedLists":{"numberLists":[],"stringLists":[],"enumLists":[]},"dataPageSize":15,"queryHistoryLimit":10,"dbTimeout":10,"tableColumnLimit":3,"highlightStyles":[{"wid":3,"color":"#6fccd3"},{"wid":3,"color":"#00ffff"},{"wid":3,"color":"#04f06a"},{"wid":3,"color":"#ff0138"}],"currHighlightIdx":3,"selectionColor":"#6c757d","selectionWidth":4.5,"groupingOption":0,"mergedElemIndicator":2,"nodeLabelWrap":0,"compoundPadding":"5%","edgeCollapseLimit":2,"avgNodeSize":40,"objectInclusionType":0,"timebar":{"isEnabled":false,"playingStep":50,"playingPeriod":1350,"zoomingStep":50,"statsInclusionType":0,"isHideDisconnectedNodesOnAnim":false,"isMaintainGraphRange":false,"graphRangeRatio":0.33}}}
{"userPref":{"isAutoIncrementalLayoutOnChange":true,"isHighlightOnHover":true,"isShowOverviewWindow":false,"isShowEdgeLabels":true,"isTileDisconnectedOnLayout":true,"isIgnoreCaseInText":false,"isOnlyHighlight4LatestQuery":true,"isStoreUserProfile":true,"isCollapseEdgesBasedOnType":false,"isCollapseMultiEdgesOnLoad":true,"isLimitDbQueries2range":true,"dbQueryTimeRange":{"start":946677600000,"end":2524597200000},"savedLists":{"numberLists":[],"stringLists":[],"enumLists":[]},"dataPageSize":15,"dataPageLimit":15,"queryHistoryLimit":10,"dbTimeout":90,"tableColumnLimit":3,"highlightStyles":[{"wid":3,"color":"#FCE903"},{"wid":3,"color":"#00ffff"},{"wid":3,"color":"#04f06a"}],"currHighlightIdx":0,"selectionColor":"#6c757d","selectionWidth":4.5,"groupingOption":0,"mergedElemIndicator":2,"nodeLabelWrap":0,"compoundPadding":"5%","edgeCollapseLimit":2,"avgNodeSize":40,"objectInclusionType":0,"queryResultPagination":"Client","tilingPadding":4,"timebar":{"isEnabled":false,"playingStep":50,"playingPeriod":1350,"zoomingStep":50,"statsInclusionType":0,"isHideDisconnectedNodesOnAnim":false,"isMaintainGraphRange":false,"graphRangeRatio":0.33}},"timebarMetrics":[{"className":"Title","name":"y rated comedies","rules":{"r":{"ruleOperator":"AND"},"children":[{"r":{"propertyOperand":"genres","propertyType":"list","rawInput":"Comedy","inputOperand":"Comedy","ruleOperator":null,"operator":"In"},"children":[],"parent":null},{"r":{"propertyOperand":"rating","propertyType":"float","rawInput":"5.5","inputOperand":"5.5","ruleOperator":null,"operator":"<="},"children":[],"parent":null}],"parent":null},"color":"#3366cc","isEditing":false},{"className":"Title","name":"highly rated comedies","rules":{"r":{"ruleOperator":"AND"},"children":[{"r":{"propertyOperand":"genres","propertyType":"list","rawInput":"Comedy","inputOperand":"Comedy","ruleOperator":null,"operator":"In"},"children":[],"parent":null},{"r":{"propertyOperand":"rating","propertyType":"float","rawInput":"7.5","inputOperand":"7.5","ruleOperator":null,"operator":">="},"children":[],"parent":null}],"parent":null},"color":"#ff9900","isEditing":false}],"queryRules":[{"isEditing":true,"isLoadGraph":false,"isMergeGraph":true,"isOnDb":true,"name":"New rule","rules":{"className":"Person","isEdge":false,"rules":{"r":{"propertyOperand":null,"rawInput":"","inputOperand":"","ruleOperator":null},"children":[],"parent":null}}}]}
6 changes: 3 additions & 3 deletions cypress/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ export function open() {
* @param {string} actionBtn text shown on UI
*/
export function navbarAction(dropdownBtn, actionBtn) {
cy.get('button.btn.btn-light.dropdown-toggle').contains(dropdownBtn).click();
cy.get('button.dropdown-item').contains(actionBtn).click();
cy.get('button.btn.btn-light.dropdown-toggle:visible').contains(dropdownBtn).click();
cy.get('button.dropdown-item:visible').contains(actionBtn).click();

if (dropdownBtn == 'Data' && actionBtn == 'Sample Data') {
cy.wait(3000);
cy.wait(1500);
cy.window().then((win) => {
expect(win.cy.nodes().length > 0).to.eq(true);
});
Expand Down
66 changes: 64 additions & 2 deletions cypress/integration/navbar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ context('Navbar buttons', () => {
}
});

it('TC4: Can add/remove group manually, delete selected, use history to go back and forth', () => {
it('TC4: Can add/remove group manually, delete selected', () => {
navbarAction('Data', 'Sample Data');

cy.window().then((win) => {
Expand Down Expand Up @@ -111,7 +111,7 @@ context('Navbar buttons', () => {
let cnt1 = -1;
cy.window().then((win) => {
cnt1 = win.cy.$().length;
expect(cnt1 - cnt0 >= 5).to.eq(true);
expect(cnt1 >= 5 + cnt0).to.eq(true);
});

navbarAction('Edit', 'Query History');
Expand Down Expand Up @@ -210,6 +210,68 @@ context('Navbar buttons', () => {
const sumClassCnt2 = win.cy.$().map(x => x.classes().length).reduce((s, x) => s + x, 0);
expect(sumClassCnt2 > sumClassCnt).to.eq(true);
});

navbarAction('Highlight', 'Remove Highlights');
cy.window().then((win) => {
const sumClassCnt3 = win.cy.$().map(x => x.classes().length).reduce((s, x) => s + x, 0);
expect(sumClassCnt3 == sumClassCnt).to.eq(true);
win.cy.$()[0].select();
});
navbarAction('Highlight', 'Selected');
cy.window().then((win) => {
const sumClassCnt4 = win.cy.$().map(x => x.classes().length).reduce((s, x) => s + x, 0);
expect(sumClassCnt4 == sumClassCnt + 1).to.eq(true);
});

navbarAction('Highlight', 'Remove Highlights');
cy.window().then((win) => {
const sumClassCnt5 = win.cy.$().map(x => x.classes().length).reduce((s, x) => s + x, 0);
expect(sumClassCnt5 == sumClassCnt).to.eq(true);
win.cy.$()[0].select();
});

navbarAction('Highlight', 'Neighbors of Selected');
cy.window().then((win) => {
const sumClassCnt6 = win.cy.$().map(x => x.classes().length).reduce((s, x) => s + x, 0);
expect(sumClassCnt6 >= sumClassCnt + 2).to.eq(true);
});

});

it('TC9: Can show help modals', () => {
navbarAction('Help', 'Quick Help');
cy.get('div.modal-title').contains('Quick Help').should('be.visible');
cy.get('button.close:visible').click();

navbarAction('Help', 'About');
cy.get('div.modal-title').contains('About').should('be.visible');
cy.get('button.close:visible').click();
});

it('TC10: Can clear data', () => {
navbarAction('Data', 'Sample Data');
navbarAction('Data', 'Clear Data');
});

it('TC11: Can load graph from JSON file', () => {
navbarAction('File', 'Load...');
cy.get('input[type="file"]').eq(1).attachFile('visuall_sample_graph.json');
cy.wait(50);
cy.window().then((win) => {
const cntCollapsedNodes = win.cy.$('.cy-expand-collapse-collapsed-node').length;
const cntParentNodes = win.cy.$(':parent').length;
const cntClusterNodes = win.cy.$('.Cluster').length;
expect(cntCollapsedNodes == 3).to.eq(true);
expect(cntClusterNodes == 7).to.eq(true);
expect(cntParentNodes == 4).to.eq(true);
});
});

it('TC12: Can load user profile from JSON file', () => {
navbarAction('File', 'Load User Profile...');
cy.get('input[type="file"]').eq(0).attachFile('Visuall_User_Profile.vall');
cy.wait(100);
cy.get('div.modal-body').should('not.exist');
});

});
2 changes: 1 addition & 1 deletion cypress/support/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@

// Import commands.js using ES2015 syntax:
import './commands'

import 'cypress-file-upload';
// Alternatively you can use CommonJS syntax:
// require('./commands')
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"codelyzer": "^6.0.1",
"css": "^3.0.0",
"cypress": "^7.3.0",
"cypress-file-upload": "^5.0.7",
"enhanced-resolve": "^5.7.0",
"jasmine-core": "~3.7.1",
"jasmine-spec-reporter": "~6.0.0",
Expand Down

0 comments on commit 53d5465

Please sign in to comment.