Skip to content

Commit

Permalink
#359 all tests migrated to cypress
Browse files Browse the repository at this point in the history
  • Loading branch information
canbax committed Jun 9, 2021
1 parent afd66b3 commit d5f025c
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 13 deletions.
1 change: 0 additions & 1 deletion cypress/downloads/visuall.json

This file was deleted.

15 changes: 14 additions & 1 deletion cypress/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function navbarAction(dropdownBtn, actionBtn) {
* @param {string} subTab text shown on UI
*/
export function openSubTab(subTab) {
cy.get('b.va-heading2').contains(subTab).click();
cy.get('b.va-heading2:visible').contains(subTab).click();
}

/**
Expand Down Expand Up @@ -61,4 +61,17 @@ export function groupBy(algoName, shouldResultCompounds) {
expect(win.cy.$(':parent').length == 0).to.eq(true);
}
});
}

/**
* @param {string} prop Object type to select
* @param {string} op Operator to select
* @param {string} inp input value as operand
*/
export function addPropertyRule(prop, op, inp) {
cy.get('select.prop').select(prop);
cy.get('select.prop-op-key').select(op);
cy.get('input[placeholder="Filter..."]').clear();
cy.get('input[placeholder="Filter..."]').type(inp);
cy.get('img[title="Add/Update"]').click();
}
14 changes: 3 additions & 11 deletions cypress/integration/queryByRule.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { open, openTab, openSubTab, navbarAction } from '../helper';
import { open, openTab, openSubTab, navbarAction, addPropertyRule } from '../helper';

context('Query By Rule', () => {

Expand All @@ -9,15 +9,7 @@ context('Query By Rule', () => {
cy.get('img[alt="Add Rule"]:visible').click();
cy.wait(250);
}

function addPropertyRule(prop, op, inp) {
cy.get('select.prop').select(prop);
cy.get('select.prop-op-key').select(op);
cy.get('input[placeholder="Filter..."]').clear();
cy.get('input[placeholder="Filter..."]').type(inp);
cy.get('img[title="Add/Update"]').click();
}


function queryByConditionRuleGetAll(type, isEdge) {
beginQueryByRule();
cy.get('button:visible').contains('Condition').click();
Expand Down Expand Up @@ -201,7 +193,7 @@ context('Query By Rule', () => {
});
});

it('TC9: Client-side filtering should work properly', () => {
it('TC9: Can add/remove query', () => {
beginQueryByRule();
cy.get('button:visible').contains('Condition').click();
cy.get('img[title="Add/Update"]').click();
Expand Down
30 changes: 30 additions & 0 deletions cypress/integration/timebar.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { open, openTab, openSubTab, navbarAction, addPropertyRule } from '../helper';

context('Timebar', () => {

beforeEach(open);

it('TC1: Timebar metric as AND rule birth > 1994 && death < 2020', () => {
openTab('Settings');
// click to close 'General' settings
// cy.wait(3000);
openSubTab('General');
// click to open 'Timebar' settings
openSubTab('Timebar');
cy.get('span.va-heading3').contains('Configure Statistics').click();
cy.get('b.timebar-metric-name').contains('new').click();
cy.get('select[title="Type"]').select('Person');

cy.get('img[alt="Add Rule"]:visible').click();
cy.get('button.dd-item.dropdown-item').contains('AND').click();
addPropertyRule('birth_year', '≥', '1994');

cy.get('img[title="Add"]:visible').click();
cy.get('button.dd-item.dropdown-item').contains('Condition').click();
addPropertyRule('death_year', '≤', '2020');

cy.get('input[value="Add"]:visible').click();

});

});

0 comments on commit d5f025c

Please sign in to comment.