464 lines
19 KiB
TypeScript
464 lines
19 KiB
TypeScript
import * as dayjs from 'dayjs';
|
|
import advancedAnalyticsPage from '../pageObjects/advancedAnalyticsPageObject';
|
|
const advPage = new advancedAnalyticsPage();
|
|
const workbookName = `Cypress_Test_Workbook_${dayjs().format('YYYY-MM-DD_HHmmss')}`;
|
|
const workbookName2 = `Cypress_Test_Workbook2_${dayjs().format('YYYY-MM-DD_HHmmss')}`;
|
|
const workbookName3 = `Cypress_Test_Workbook3_Crossout_${dayjs().format('YYYY-MM-DD_HHmmss')}`;
|
|
const dataSourceName = `Cypress_Test_Data_Source_${dayjs().format('YYYY-MM-DD_HHmmss')}`;
|
|
const dataSourceName2 = `Cypress_Test_Data_Source_For_Crossout_${dayjs().format('YYYY-MM-DD_HHmmss')}`;
|
|
const workbookDescription = 'Test workbook made in Cypress - widget tests';
|
|
const workbookDescription2 = 'Test workbook made in Cypress - widget tests - crossout';
|
|
const dataSourceDescription = 'Test data source made in Cypress - widget tests';
|
|
const dataSourceDescription2 = 'Test data source made in Cypress - widget tests - crossout';
|
|
const dssPatientEncounter = '55370';
|
|
const generalLedgerAndStaffing = '55426';
|
|
const formula = 'sum([Actual Dollars])*0+0.1234567';
|
|
|
|
before(() => {
|
|
cy.vaultLoginByUserTitle('IDTestUser');
|
|
cy.createDataSource(dataSourceName, dataSourceDescription);
|
|
cy.createDataSource(dataSourceName2, dataSourceDescription2);
|
|
cy.addTableToDataSource(generalLedgerAndStaffing, dataSourceName);
|
|
cy.addTableToDataSource(generalLedgerAndStaffing, dataSourceName2);
|
|
cy.addTableToDataSource(dssPatientEncounter, dataSourceName2);
|
|
cy.addUserToDataSource(dataSourceName, 'obadmin', 'viewer');
|
|
cy.addUserToDataSource(dataSourceName2, 'obadmin', 'viewer');
|
|
cy.logout();
|
|
|
|
cy.vaultLogin(true);
|
|
cy.addWorkbook(workbookName, workbookDescription, 'Encounter Summary');
|
|
cy.addWorkbook(workbookName2, workbookDescription, dataSourceName);
|
|
cy.addWorkbook(workbookName3, workbookDescription2, dataSourceName2);
|
|
cy.visit('/');
|
|
cy.goToWorkbook(workbookName);
|
|
advPage.addDashboard();
|
|
cy.findByText('Add Widget').click();
|
|
cy.findByText('Add Text').click();
|
|
cy.findByText('Ok').click();
|
|
cy.findByText('Save').click();
|
|
cy.findByText('Saved').should('exist');
|
|
});
|
|
|
|
beforeEach(() => {
|
|
cy.goToWorkbook(workbookName);
|
|
cy.wait(1000);
|
|
});
|
|
|
|
after(() => {
|
|
cy.logout();
|
|
cy.vaultLoginByUserTitle('IDTestUser');
|
|
cy.deleteDataSource(dataSourceName);
|
|
cy.deleteDataSource(dataSourceName2);
|
|
cy.logout();
|
|
cy.vaultLogin(true);
|
|
cy.deleteWorkbook(workbookName);
|
|
cy.deleteWorkbook(workbookName2);
|
|
cy.deleteWorkbook(workbookName3);
|
|
cy.logout();
|
|
cy.vaultLoginByUserTitle('IDTestUser');
|
|
cy.deleteDataSource(dataSourceName);
|
|
});
|
|
|
|
describe('Advanced Analytics text widget tests', () => {
|
|
it('Text widget - formatting options', () => {
|
|
advPage.editTextWidget();
|
|
//Bold
|
|
cy.get('.ql-bold').click();
|
|
cy.get('.ant-modal-content').find('.ql-editor').type('Bold Text\n');
|
|
cy.get('.ql-bold').click();
|
|
|
|
//Italics
|
|
cy.get('.ql-italic').click();
|
|
cy.get('.ant-modal-content').find('.ql-editor').type('Italic Text\n');
|
|
cy.get('.ql-italic').click();
|
|
|
|
//Underline
|
|
cy.get('.ql-underline').click();
|
|
cy.get('.ant-modal-content').find('.ql-editor').type('Underline Text\n');
|
|
cy.get('.ql-underline').click();
|
|
|
|
//Strikeout
|
|
cy.get('.ql-strike').click();
|
|
cy.get('.ant-modal-content').find('.ql-editor').type('Strikeout Text\n');
|
|
cy.get('.ql-strike').click();
|
|
|
|
cy.get('strong').should(($p) => {
|
|
expect($p).to.contain('Bold Text');
|
|
});
|
|
cy.get('em').should(($p) => {
|
|
expect($p).to.contain('Italic Text');
|
|
});
|
|
cy.get('u').should(($p) => {
|
|
expect($p).to.contain('Underline Text');
|
|
});
|
|
cy.get('s').should(($p) => {
|
|
expect($p).to.contain('Strikeout Text');
|
|
});
|
|
});
|
|
|
|
it('Text widget - Hyperlink testing', () => {
|
|
advPage.editTextWidget();
|
|
const text = 'Hyperlink Text';
|
|
cy.get('.ant-modal-content').find('.ql-editor').type(`${text}\n`);
|
|
cy.get('.ant-modal-content').find('.ql-editor').type('{selectall}');
|
|
cy.get('.ql-link').click();
|
|
cy.get('div[class$="ql-editing"]').find('input').type('https://www.google.com');
|
|
cy.get('.ql-action').click();
|
|
cy.wait(1000);
|
|
cy.findByText('Ok').click();
|
|
cy.wait(1000);
|
|
cy.get('a')
|
|
.contains(text)
|
|
.invoke('attr', 'href')
|
|
.then((classVal) => {
|
|
expect(classVal).to.be.equal('https://www.google.com');
|
|
});
|
|
cy.get('a').contains(text).click();
|
|
cy.wait(5000);
|
|
cy.location('href').should((loc) => {
|
|
expect(loc).contains('https://www.google.com');
|
|
});
|
|
});
|
|
});
|
|
|
|
describe('Advanced Analytics visualization widget tests', () => {
|
|
it('Visualization Widget - Each type has the correct options', () => {
|
|
cy.findByText('Add Widget').click();
|
|
cy.findByText('Add Visual').click();
|
|
|
|
cy.findByText('Visualization Type').parent().next().click();
|
|
cy.get('.ant-select-item-option-content').contains('Bar').click();
|
|
cy.findByText('Visualization Type').parent().next().next().click();
|
|
cy.get('div[aria-label="Clustered"]').should('exist');
|
|
cy.get('div[aria-label="Stacked"]').should('exist');
|
|
|
|
cy.findByText('Visualization Type').parent().next().click();
|
|
cy.get('.ant-select-item-option-content').contains('Column').click();
|
|
cy.findByText('Visualization Type').parent().next().next().click();
|
|
cy.get('div[aria-label="Clustered"]').should('exist');
|
|
cy.get('div[aria-label="Stacked"]').should('exist');
|
|
|
|
cy.findByText('Visualization Type').parent().next().click();
|
|
cy.get('.ant-select-item-option-content').contains('Line').click();
|
|
cy.findByText('Visualization Type').parent().next().next().should('not.exist');
|
|
|
|
cy.findByText('Visualization Type').parent().next().click();
|
|
cy.get('.ant-select-item-option-content').contains('Pie').click();
|
|
cy.findByText('Visualization Type').parent().next().next().click();
|
|
cy.get('div[aria-label="Donut"]').should('exist');
|
|
cy.get('div[aria-label="Pie"]').should('exist');
|
|
|
|
cy.findByText('Visualization Type').parent().next().click();
|
|
cy.get('.ant-select-item-option-content').contains('Calendar').click();
|
|
cy.findByText('Visualization Type').parent().next().next().should('not.exist');
|
|
|
|
cy.findByText('Visualization Type').parent().next().click();
|
|
cy.get('.ant-select-item-option-content').contains('Metric').click();
|
|
cy.findByText('Visualization Type').parent().next().next().should('not.exist');
|
|
});
|
|
|
|
it('Visualization Widget - create pie chart', () => {
|
|
advPage.addDashboardWidget('Pie', 'Pie', [{ dimensionGroup: 'Age', dimensionName: 'Rollup' }], [{ measureGroup: 'Measures', mesureName: 'Net Revenue' }]);
|
|
});
|
|
|
|
it('Switching around the legend', () => {
|
|
advPage.addDashboardWidgetWithPivots(
|
|
'Bar',
|
|
[{ dimensionGroup: 'Age', dimensionName: 'Rollup' }],
|
|
[{ measureGroup: 'Measures', mesureName: 'Net Revenue' }],
|
|
[{ pivoteGroup: 'Admit Date', pivotName: 'Fiscal Year' }]
|
|
);
|
|
advPage.openEditWidget('Untitled Visualization');
|
|
cy.findByText('Design').click();
|
|
|
|
cy.findByText('Positioning').scrollIntoView();
|
|
cy.wait(2000);
|
|
cy.findByText('Top').click({ force: true });
|
|
cy.wait(2000);
|
|
cy.findByText('Right').click({ force: true });
|
|
cy.wait(2000);
|
|
cy.findByText('Bottom').click({ force: true });
|
|
cy.wait(2000);
|
|
cy.findByText('Left').click({ force: true });
|
|
cy.wait(2000);
|
|
});
|
|
|
|
it('Switching data marts in a widget', () => {
|
|
cy.goToWorkbook(workbookName);
|
|
advPage.addVisualizationWidget();
|
|
advPage.dragAndDropArea('Account Class', 'Account Class Code', 'Categories');
|
|
advPage.dragAndDropArea('Measures', 'Account Balance', 'Values');
|
|
advPage.clearSearch();
|
|
|
|
//Account Class is in the original data mart and Charge Code is in the one that will be changed to
|
|
cy.findByText('Account Class').should('exist');
|
|
cy.findByText('Charge Code').should('not.exist');
|
|
|
|
advPage.switchDataSource(dataSourceName);
|
|
|
|
cy.contains('Encounter Summary').should('not.exist');
|
|
cy.contains(dataSourceName).should('exist');
|
|
cy.get('.data-designer__fields').find('div').contains('Account Class Code').should('not.exist');
|
|
cy.get('.data-designer__fields').find('div').contains('Account Balance').should('not.exist');
|
|
|
|
//Charge Code is in the new data mart and Account Class was in the original data mart
|
|
cy.findByText('Account Class').should('not.exist');
|
|
cy.findByText('Charge Code').should('exist');
|
|
});
|
|
|
|
// Cross out was taken out
|
|
it.skip('Cross out for dimensions and measures in data vizualization widget', () => {
|
|
cy.logout();
|
|
cy.vaultLoginByUserTitle('IDTestUser');
|
|
cy.addTableToDataSource(dssPatientEncounter, dataSourceName);
|
|
cy.logout();
|
|
cy.vaultLogin(true);
|
|
|
|
cy.goToWorkbook(workbookName2);
|
|
advPage.addDashboard();
|
|
advPage.addVisualizationWidget();
|
|
|
|
//Categories
|
|
advPage.dragAndDropArea('Account Class', 'Account Class Code', 'Categories');
|
|
advPage.searchForAttribute('Actual Dollars');
|
|
cy.get('div')
|
|
.contains('Actual Dollars')
|
|
.parentsUntil('.ant-tree-treenode.ant-tree-treenode-disabled')
|
|
.last()
|
|
.parent()
|
|
.invoke('attr', 'class')
|
|
.then((classVal) => {
|
|
expect(classVal).to.contain('ant-tree-treenode-disabled');
|
|
});
|
|
advPage.clearSearch();
|
|
|
|
//Values
|
|
advPage.deleteAttributeFromWidget('Account Class - Account Class Code', 'Categories');
|
|
advPage.dragAndDropArea('Measures', 'Actual Dollars', 'Values');
|
|
advPage.searchForAttribute('Account Class Code');
|
|
cy.get('div')
|
|
.contains('Account Class Code')
|
|
.parentsUntil('.ant-tree-treenode.ant-tree-treenode-disabled')
|
|
.last()
|
|
.parent()
|
|
.invoke('attr', 'class')
|
|
.then((classVal) => {
|
|
expect(classVal).to.contain('ant-tree-treenode-disabled');
|
|
});
|
|
advPage.clearSearch();
|
|
|
|
//Break By
|
|
advPage.deleteAttributeFromWidget('Actual Dollars', 'Values');
|
|
advPage.dragAndDropArea('Account Class', 'Account Class Code', 'Break By');
|
|
advPage.searchForAttribute('Actual Dollars');
|
|
cy.get('div')
|
|
.contains('Actual Dollars')
|
|
.parentsUntil('.ant-tree-treenode.ant-tree-treenode-disabled')
|
|
.last()
|
|
.parent()
|
|
.invoke('attr', 'class')
|
|
.then((classVal) => {
|
|
expect(classVal).to.contain('ant-tree-treenode-disabled');
|
|
});
|
|
advPage.clearSearch();
|
|
|
|
//Filters
|
|
advPage.deleteAttributeFromWidget('Account Class - Account Class Code', 'Break By');
|
|
advPage.addwidgetFilter('Measures', 'Actual Dollars');
|
|
advPage.searchForAttribute('Account Class Code');
|
|
cy.get('div')
|
|
.contains('Account Class Code')
|
|
.parentsUntil('.ant-tree-treenode.ant-tree-treenode-disabled')
|
|
.last()
|
|
.parent()
|
|
.invoke('attr', 'class')
|
|
.then((classVal) => {
|
|
expect(classVal).to.contain('ant-tree-treenode-disabled');
|
|
});
|
|
advPage.clearSearch();
|
|
});
|
|
});
|
|
|
|
describe('Advanced Analytics data analysis tests', () => {
|
|
// Cross out was taken out
|
|
it.skip('Cross out for dimensions and measures in data analysis', () => {
|
|
cy.goToWorkbook(workbookName3);
|
|
advPage.addDataAnlysisSheet();
|
|
|
|
//Rows
|
|
advPage.dragAndDropArea('Account Class', 'Account Class Code', 'Rows');
|
|
advPage.searchForAttribute('Actual Dollars');
|
|
cy.get('div')
|
|
.contains('Actual Dollars')
|
|
.parentsUntil('.ant-tree-treenode.ant-tree-treenode-disabled')
|
|
.last()
|
|
.parent()
|
|
.invoke('attr', 'class')
|
|
.then((classVal) => {
|
|
expect(classVal).to.contain('ant-tree-treenode-disabled');
|
|
});
|
|
advPage.clearSearch();
|
|
|
|
//Values
|
|
advPage.deleteAttributeFromWidget('Account Class - Account Class Code', 'Rows');
|
|
advPage.dragAndDropArea('Measures', 'Actual Dollars', 'Columns');
|
|
advPage.searchForAttribute('Account Class Code');
|
|
cy.get('div')
|
|
.contains('Account Class Code')
|
|
.parentsUntil('.ant-tree-treenode.ant-tree-treenode-disabled')
|
|
.last()
|
|
.parent()
|
|
.invoke('attr', 'class')
|
|
.then((classVal) => {
|
|
expect(classVal).to.contain('ant-tree-treenode-disabled');
|
|
});
|
|
advPage.clearSearch();
|
|
|
|
//Filters
|
|
advPage.deleteAttributeFromWidget('Actual Dollars', 'Columns');
|
|
advPage.addwidgetFilter('Account Class', 'Account Class Code');
|
|
advPage.searchForAttribute('Actual Dollars');
|
|
cy.get('div')
|
|
.contains('Actual Dollars')
|
|
.parentsUntil('.ant-tree-treenode.ant-tree-treenode-disabled')
|
|
.last()
|
|
.parent()
|
|
.invoke('attr', 'class')
|
|
.then((classVal) => {
|
|
expect(classVal).to.contain('ant-tree-treenode-disabled');
|
|
});
|
|
advPage.clearSearch();
|
|
});
|
|
|
|
it('Duplicate values', () => {
|
|
cy.goToWorkbook(workbookName3);
|
|
advPage.addDataAnlysisSheet();
|
|
advPage.dragAndDropArea('Measures', 'Account Balance', 'Columns');
|
|
advPage.duplicateValue('Account Balance', 'Account Balance_1');
|
|
|
|
cy.findAllByText('Account Balance_1').should('exist');
|
|
});
|
|
|
|
it('Test decimal places in data sheets', () => {
|
|
cy.goToWorkbook(workbookName3);
|
|
advPage.addDataAnlysisSheet();
|
|
advPage.dragAndDropArea('Account Class', 'Account Class Code', 'Rows');
|
|
|
|
advPage.addDataSheetCustomCalculatedValue('test', null, formula);
|
|
advPage.addDataSheetCustomCalculatedValue('test 2', 'Number (2 Decimals)', formula);
|
|
advPage.addDataSheetCustomCalculatedValue('test 3', 'Number (4 Decimals)', formula);
|
|
|
|
cy.findByText('0.12', { timeout: 10000 }).should('exist');
|
|
cy.findByText('0.1235', { timeout: 10000 }).should('exist');
|
|
});
|
|
|
|
it('Measures can be added to multiple groups when they exist', () => {
|
|
advPage.addDataAnlysisSheet();
|
|
advPage.addNewDataSheetGroup();
|
|
|
|
advPage.addNewDataSheetGroup();
|
|
|
|
advPage.dragAndDropArea('Measures', 'Account Balance', 'Columns');
|
|
advPage.dragAndDropArea('Measures', 'Birth Weight', 'Columns', 1);
|
|
|
|
cy.get('.fields').eq(1).findByText('Account Balance').should('exist');
|
|
cy.get('.fields').eq(2).findByText('Birth Weight').should('exist');
|
|
|
|
advPage.deleteNumberedDataSheetGroup(2);
|
|
|
|
cy.get('.fields').eq(1).findByText('Account Balance').should('exist');
|
|
cy.get('.fields').eq(2).findByText('Birth Weight').should('not.exist');
|
|
});
|
|
|
|
it('Test disabling auto refresh', () => {
|
|
cy.goToWorkbook(workbookName);
|
|
advPage.addDataAnlysisSheet();
|
|
//cy.findByText('Turn on Auto Refresh to see current data').should('not.exist');
|
|
|
|
cy.findByText('Auto Refresh').click();
|
|
//cy.findByText('Turn on Auto Refresh to see current data').should('exist');
|
|
|
|
advPage.dragAndDropArea('Account Class', 'Account Class Code', 'Rows');
|
|
advPage.dragAndDropArea('Measures', 'Account Balance', 'Columns');
|
|
|
|
cy.get('.p-treetable-scrollable-wrapper').children().eq(0).findByText('Auto Refresh Disabled').should('exist');
|
|
cy.get('.p-treetable-scrollable-wrapper').children().eq(1).findByText('Auto Refresh Disabled').should('exist');
|
|
cy.get('.p-treetable-scrollable-wrapper').children().eq(0).find('.p-treetable-scrollable-header').findByText('Account Class Code').should('not.exist');
|
|
cy.get('.p-treetable-scrollable-wrapper').children().eq(1).find('.p-treetable-scrollable-header').findByText('Account Balance').should('exist');
|
|
|
|
cy.findByText('Auto Refresh').click();
|
|
cy.get('ant-spin.ant-spin-spinning', { timeout: 10000 }).should('not.exist');
|
|
cy.get('.p-treetable-scrollable-view.p-treetable-frozen-view').find('.p-treetable-tbody').findByText('0');
|
|
cy.get('.p-treetable-scrollable-view.p-treetable-unfrozen-view').find('.p-treetable-tbody').findByText('28,375,615');
|
|
});
|
|
|
|
it('Calculated values cannot be saved without all fields filled in', () => {
|
|
cy.goToWorkbook(workbookName3);
|
|
advPage.addDataAnlysisSheet();
|
|
|
|
cy.findByText('Columns').parentsUntil('.fields-column-header').last().next().click();
|
|
cy.findByText('Add Calculation').click();
|
|
cy.get('#name').should('be.visible');
|
|
|
|
cy.get('.calculated-value-editor').find('textarea').type(formula, { force: true }).wait(1000);
|
|
cy.findByText('Apply').click({ force: true });
|
|
cy.findByTitle('Name').parent().next().findByText('Required').should('exist');
|
|
cy.findByTitle('Calculation').parent().next().findByText('Required').should('not.exist');
|
|
|
|
cy.findByText('Cancel').click();
|
|
cy.findByText('Cancel').should('not.exist');
|
|
});
|
|
|
|
it('Creating a filter in a calculation with multiple tables', () => {
|
|
cy.goToWorkbook(workbookName2);
|
|
advPage.addDataAnlysisSheet();
|
|
advPage.dragAndDropArea('Account', 'Account Code', 'Rows');
|
|
|
|
advPage.addDataSheetCustomCalculatedValue('test', null, formula);
|
|
advPage.editValue('test', null, null, 'sum([Net Revenue]) - sum([Fixed Direct Cost]) + sum([Account Balance])');
|
|
advPage.openCalculatedValue('test');
|
|
advPage.addCalculationFilter('Account Class', 'Account Class Code');
|
|
|
|
cy.findByText('Apply').click({ force: true });
|
|
cy.get('.ant-modal-title').contains('test').should('not.exist');
|
|
});
|
|
|
|
it('Target moving an attribute into a column and row', () => {
|
|
cy.goToWorkbook(workbookName);
|
|
advPage.addDataAnlysisSheet();
|
|
cy.findByText('Auto Refresh').click();
|
|
advPage.dragAndDropArea('Account Class', 'Account Class Code', 'Rows');
|
|
advPage.dragAndDropArea('Measures', 'Account Balance', 'Columns');
|
|
|
|
advPage.dragAndDropAreaToPosition('Account Class', 'Account Class', 'Rows', 0);
|
|
advPage.dragAndDropAreaToPosition('Account Class', 'Account Class Description', 'Rows', 1);
|
|
advPage.dragAndDropAreaToPosition('Measures', 'Date Of Birth', 'Columns', 0);
|
|
|
|
cy.wait(3000);
|
|
//Tests the Expand To dropdown
|
|
cy.findByText('Expand To').parent().parent().click();
|
|
cy.get('.rc-virtual-list-holder-inner').children().first().invoke('attr', 'title').should('eq', 'Account Class - Account Class');
|
|
cy.get('.rc-virtual-list-holder-inner').children().eq(1).invoke('attr', 'title').should('eq', 'Account Class - Account Class Description');
|
|
cy.get('.rc-virtual-list-holder-inner').children().last().invoke('attr', 'title').should('eq', 'Account Class - Account Class Code');
|
|
|
|
//Checks the rows
|
|
cy.findAllByText('Rows').eq(0).parentsUntil('.fields').last().next().find('.sortable-list').children().first().findByText('Account Class - Account Class');
|
|
cy.findAllByText('Rows').eq(0).parentsUntil('.fields').last().next().find('.sortable-list').children().eq(1).findByText('Account Class - Account Class Description');
|
|
cy.findAllByText('Rows').eq(0).parentsUntil('.fields').last().next().find('.sortable-list').children().last().findByText('Account Class - Account Class Code');
|
|
|
|
//Checks the columns
|
|
cy.findAllByText('Columns').eq(0).parentsUntil('.fields').last().next().find('.sortable-list').children().first().findByText('Date Of Birth');
|
|
cy.findAllByText('Columns').eq(0).parentsUntil('.fields').last().next().find('.sortable-list').children().last().findByText('Account Balance');
|
|
});
|
|
|
|
it('Column groups can be duplicated', () => {
|
|
cy.goToWorkbook(workbookName);
|
|
advPage.addDataAnlysisSheet();
|
|
advPage.dragAndDropArea('Measures', 'Account Balance', 'Columns');
|
|
advPage.addDataSheetCustomCalculatedValueToNumberedGroup(1, 'test', null, 'sum([Net Revenue]) - sum([Fixed Direct Cost]) + sum([Account Balance])');
|
|
|
|
advPage.DuplicateGroup(1);
|
|
cy.findAllByText('Columns').should('have.length', 2);
|
|
});
|
|
});
|