101 lines
3.9 KiB
TypeScript
101 lines
3.9 KiB
TypeScript
export default class advancedAnalyticsPage {
|
|
addNewExtract = (extractName: string, extractDataSource: string, extractDescription?: string | undefined): void => {
|
|
cy.findByText('Add Extract').click();
|
|
cy.get('.ant-dropdown-menu-title-content').contains('Extract').click();
|
|
cy.get('#name').type(extractName);
|
|
|
|
if (extractDescription !== undefined) {
|
|
cy.get('#description').type(extractDescription);
|
|
}
|
|
|
|
cy.get('#dataSourceId').click();
|
|
cy.findByText(extractDataSource).click();
|
|
|
|
cy.findByText('Save').click();
|
|
cy.findByText(extractName).should('exist');
|
|
};
|
|
|
|
addNewCustomExtract = (extractName: string, extractDescription?: string | undefined): void => {
|
|
cy.findByText('Add Extract').click();
|
|
cy.findByText('Custom Sql Extract').click();
|
|
cy.get('#name').type(extractName);
|
|
|
|
if (extractDescription !== undefined) {
|
|
cy.get('#description').type(extractDescription);
|
|
}
|
|
|
|
cy.findByText('Save').click();
|
|
cy.findByText(extractName).should('exist');
|
|
};
|
|
|
|
editExtract = (extractName: string, newExtractName: string, newExtractDescription?: string | undefined): void => {
|
|
this.goToExtract(extractName);
|
|
cy.findByText('Back to Extracts').should('exist');
|
|
cy.findByText(extractName).should('exist');
|
|
this.selectMenuOption('Edit');
|
|
cy.findByText('Edit Extract').should('exist');
|
|
|
|
cy.get('#name').clear().type(newExtractName);
|
|
|
|
if (newExtractDescription !== undefined) {
|
|
cy.get('#description').clear().type(newExtractDescription);
|
|
}
|
|
|
|
cy.findByText('Apply').click();
|
|
};
|
|
|
|
deleteExtract = (extractName: string): void => {
|
|
cy.get('.tempo-link__text').then((items) => {
|
|
const list = Array.from(items, (item) => item.innerText);
|
|
list.forEach((element) => {
|
|
if (element === extractName) {
|
|
cy.findByText(extractName).parentsUntil('.p-datatable-tbody').last().find('.anticon.anticon-delete').scrollIntoView();
|
|
cy.findByText(extractName).parentsUntil('.p-datatable-tbody').last().find('.anticon.anticon-delete').click();
|
|
cy.findByText('Delete Extract').click();
|
|
cy.findByText(`Permanently delete ${extractName}?`).should('not.exist');
|
|
}
|
|
});
|
|
});
|
|
};
|
|
|
|
goToExtract = (extractName: string): void => {
|
|
cy.findByText(extractName).click();
|
|
cy.get('h1').contains(extractName).should('exist');
|
|
};
|
|
|
|
shareExtract = (extractName: string, userGroupName: string): void => {
|
|
this.goToExtract(extractName);
|
|
this.selectMenuOption('Share');
|
|
cy.findByText(`Share ${extractName}`).should('exist');
|
|
cy.findByText('Add Groups').click();
|
|
cy.findByText('User Groups').should('exist');
|
|
cy.get('input[type="text"]').type(userGroupName);
|
|
cy.wait(500);
|
|
cy.get('span').contains(userGroupName).click();
|
|
cy.get('.ant-drawer-title').contains('Add Groups').parentsUntil('.ant-drawer-wrapper-body').last().siblings().last().findByText('Add').click();
|
|
cy.findByText(`Share ${extractName}`).should('exist');
|
|
cy.findByText('Save').click();
|
|
cy.findByText(`Share ${extractName}`).should('not.exist');
|
|
};
|
|
|
|
scheduleExtract = (extractName: string, startTime: string, frequency: string): void => {
|
|
cy.goToExtract(extractName);
|
|
this.selectMenuOption('Schedule');
|
|
cy.findByText('Schedule Extract', { timeout: 5000 }).should('exist');
|
|
cy.wait(3000);
|
|
cy.findByText('Add Schedule').click();
|
|
cy.get('#startTime', { timeout: 2000 }).should('exist');
|
|
cy.get('#startTime').click();
|
|
cy.get('#startTime').clear().type(startTime).type('{enter}');
|
|
cy.findByText('Repeats').parent().next().click();
|
|
cy.get('span').contains(frequency).click();
|
|
cy.findByText('Save').click();
|
|
cy.get('#startTime', { timeout: 2000 }).should('not.exist');
|
|
};
|
|
|
|
selectMenuOption = (menuOption: string): void => {
|
|
cy.findByText('Export').parentsUntil('.tempo-spacing.tempo-spacing--row').last().next().click();
|
|
cy.findByText(menuOption).click();
|
|
};
|
|
}
|