graphdb-workbench-tests
Version:
Cypress tests for GraphDB workbench
188 lines (142 loc) • 5.25 kB
JavaScript
import {BaseSteps} from "../base-steps.js";
export class YasrSteps extends BaseSteps {
static getYasr() {
return cy.get('.tabPanel.active .yasr');
}
static waitUntilResultsIsVisible() {
return cy.waitUntil(() => this.getYasr().should('be.visible'));
}
static getResultHeader() {
return cy.get('.yasr_header');
}
static getResponseInfo() {
return YasrSteps.getYasr().find('.yasr_response_chip');
}
static getResponseInfoMessage() {
return YasrSteps.getResponseInfo().find('.response-info-message');
}
static getErrorHeader() {
return YasrSteps.getResultHeader().get('.errorHeader');
}
static getErrorBody() {
return YasrSteps.getResultHeader().get('.error-response-plugin-body');
}
static getYasrResultsContainer() {
return YasrSteps.getYasr().find('.yasr_results');
}
static getResults() {
return YasrSteps.getYasr().find('.yasr_results tbody').find('tr');
}
static getResultTableHeader() {
return cy.get('.yasr_results thead');
}
static getResultTableHeaderColumns() {
return YasrSteps.getResultTableHeader().find('th');
}
static getResultFilter() {
return cy.get('.tableFilter');
}
static getResultRow(rowNumber) {
return this.getResults().eq(rowNumber);
}
static getResultRowCells(rowNumber) {
return YasrSteps.getResultRow(rowNumber).find('td');
}
static getResultCell(rowNumber, cellNumber) {
return YasrSteps.getResultRowCells(rowNumber).eq(cellNumber);
}
static getResultLink(rowNumber, cellNumber) {
return YasrSteps.getResultCell(rowNumber, cellNumber).find('a');
}
static hoverCell(rowNumber, cellNumber) {
this.getResultCell(rowNumber, cellNumber).realHover();
}
static clickOnResource(rowNumber, cellNumber) {
this.getResultCell(rowNumber, cellNumber).find('.uri-link').click({force: true});
}
static getCopyResourceLink(rowNumber, cellNumber) {
return this.getResultCell(rowNumber, cellNumber)
.realHover()
.find('.copy-resource-link-button a');
}
static showSharedResourceLink(rowNumber, cellNumber) {
return this.getResultCell(rowNumber, cellNumber)
.find('.copy-resource-link-button a');
}
static copyResourceLink(rowNumber, cellNumber) {
this.showSharedResourceLink(rowNumber, cellNumber).realClick();
}
static getDownloadAsDropdown() {
return this.getYasr().find('ontotext-download-as');
}
static openDownloadAsDropdown() {
this.getDownloadAsDropdown().click();
}
static getDownloadAsOption(number) {
return this.getDownloadAsDropdown().find('.ontotext-dropdown-menu-item').eq(number);
}
static selectDownloadAsOption(number) {
// Click with force: true, because the repository dropdown at the top of the page hides the option
this.getDownloadAsOption(number).click({force: true});
}
static getPagination() {
return YasrSteps.getYasr().find('.ontotext-pagination');
}
static getYasrToolbar() {
return YasrSteps.getYasr().find('.yasr-toolbar');
}
static getGraphExploreSplitButton() {
return YasrSteps.getYasrToolbar().find('.explore-visual-graph');
}
static getVisualizeMainButton() {
return YasrSteps.getGraphExploreSplitButton().find('.explore-visual-graph-button');
}
static clickOnVisualizeMainButton() {
YasrSteps.getVisualizeMainButton().click();
}
static getDropdownToggleButton() {
return YasrSteps.getGraphExploreSplitButton().find('.onto-dropdown-button');
}
static toggleGraphConfigDropdown() {
YasrSteps.getDropdownToggleButton().click();
}
static getGraphConfigs() {
return YasrSteps.getGraphExploreSplitButton().find('.onto-dropdown-menu-item');
}
static getGraphConfig(index = 0) {
return YasrSteps.getGraphConfigs().eq(index);
}
static selectGraphConfig(index = 0) {
YasrSteps.getGraphConfig(index).click();
}
static getCreateGraphConfigLink() {
return YasrSteps.getGraphExploreSplitButton().find('.graph-create-link');
}
static clickCreateGraphConfigLink() {
YasrSteps.getCreateGraphConfigLink().click();
}
static getNoConfigurationsMessage() {
return YasrSteps.getGraphExploreSplitButton().find('.no-configurations-message');
}
static getNoDataElement() {
return cy.get('.dataTables_empty');
}
static getNoResultsMessage() {
return YasrSteps.getYasr().find('.alert-success');
}
static getPivotTablePlugin() {
return YasrSteps.getYasr().find('.pivot-table-plugin');
}
static getGoogleChartPlugin() {
return YasrSteps.getYasr().find('.google-visualization-table');
}
static getExtendedTablePlugin() {
return YasrSteps.getYasr().find('.dataTables_wrapper');
}
static getFullscreenButton() {
return cy.get('.yasr-fullscreen-button');
}
static toggleFullscreen() {
YasrSteps.getFullscreenButton().click();
}
}