Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion e2e-tests/cypress-legacy.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default defineConfig({
screenshotsFolder: 'report/screenshots',
videosFolder: 'report/videos',
video: true,
defaultCommandTimeout: 25000,
defaultCommandTimeout: 8000,
numTestsKeptInMemory: 10,
viewportWidth: 1600,
viewportHeight: 1200,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {QueryStubs} from "../../../stubs/yasgui/query-stubs";
import {YasqeSteps} from "../../../steps/yasgui/yasqe-steps";

describe('Execute query', () => {

let repositoryId;

beforeEach(() => {
Expand All @@ -23,9 +22,8 @@ describe('Execute query', () => {
});

it('Should be able to execute query from each editor tab', () => {
cy.intercept('POST', `/repositories/${repositoryId}`).as('query');
YasqeSteps.executeQuery();
cy.wait('@query').then((interception) => {
cy.wait(`@${repositoryId}-stub-query`).then((interception) => {
expect(interception.request.method).to.equal('POST');
const headers = interception.request.headers;
expect(headers).to.have.property('x-graphdb-local-consistency');
Expand All @@ -35,7 +33,7 @@ describe('Execute query', () => {
YasguiSteps.openANewTab();
YasguiSteps.getTabs().should('have.length', 2);
YasqeSteps.executeQuery();
cy.wait('@query').then((interception) => {
cy.wait(`@${repositoryId}-stub-query`).then((interception) => {
expect(interception.request.method).to.equal('POST');
const headers = interception.request.headers;
expect(headers).to.have.property('x-graphdb-local-consistency');
Expand Down
8 changes: 3 additions & 5 deletions e2e-tests/e2e-legacy/sparql-editor/actions/save-query.spec.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {SparqlEditorSteps} from "../../../steps/sparql-editor-steps";
import {YasguiSteps} from "../../../steps/yasgui/yasgui-steps";
import {ApplicationSteps} from "../../../steps/application-steps";
import {QueryStubs} from "../../../stubs/yasgui/query-stubs";
import {SaveQueryDialog} from "../../../steps/yasgui/save-query-dialog";
import {SavedQuery} from "../../../steps/yasgui/saved-query";
import {SavedQueriesDialog} from "../../../steps/yasgui/saved-queries-dialog";
import {OntoToastrSteps} from '../../../steps/onto-toastr-steps.js';

describe('Save query', () => {

Expand Down Expand Up @@ -54,9 +54,7 @@ describe('Save query', () => {
SaveQueryDialog.writeQueryName(savedQueryName);
SaveQueryDialog.saveQuery();
// Then I expect that dialog will remain open and an error will be visible
// TODO: find out why this check fails on Jenkins sometimes with
// AssertionError: Timed out retrying after 30000ms: Expected to find element: `.toast-error`, but never found it. Queried from element: <div#toast-container.toast-bottom-right>
// ApplicationSteps.getErrorNotifications().should('be.visible');
OntoToastrSteps.getErrorToast().should('be.visible');
SaveQueryDialog.getSaveQueryDialog().should('be.visible');
SaveQueryDialog.getErrorsPane().should('contain', 'Error! Cannot create saved query');
// When I change the query name
Expand All @@ -65,6 +63,6 @@ describe('Save query', () => {
SaveQueryDialog.saveQuery();
// Then I should be able to save the query
SaveQueryDialog.getSaveQueryDialog().should('not.exist');
ApplicationSteps.getSuccessNotifications().should('be.visible');
OntoToastrSteps.getSuccessToast().should('be.visible');
});
});
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {SparqlEditorSteps} from "../../../steps/sparql-editor-steps";
import {YasguiSteps} from "../../../steps/yasgui/yasgui-steps";
import {ApplicationSteps} from "../../../steps/application-steps";
import {QueryStubs} from "../../../stubs/yasgui/query-stubs";
import {SavedQuery} from "../../../steps/yasgui/saved-query";
import {SavedQueriesDialog} from "../../../steps/yasgui/saved-queries-dialog";
import {SaveQueryDialog} from "../../../steps/yasgui/save-query-dialog";
import {OntoToastrSteps} from '../../../steps/onto-toastr-steps.js';

describe('Delete saved queries', () => {

Expand Down Expand Up @@ -49,7 +49,7 @@ describe('Delete saved queries', () => {
YasguiSteps.confirmDeleteOperation();
// Then selected query should be deleted
YasguiSteps.getDeleteQueryConfirmation().should('not.exist');
ApplicationSteps.getSuccessNotifications().should('be.visible');
OntoToastrSteps.getSuccessToast().should('be.visible');
YasguiSteps.showSavedQueries();
SavedQueriesDialog.getSavedQueries().should('not.contain.text', savedQueryName);
});
Expand Down
4 changes: 2 additions & 2 deletions e2e-tests/e2e-legacy/sparql-editor/yasgui-tabs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ describe('Yasgui tabs', () => {

it('Should display information about ongoing requests if try to navigate to other page when there is a tab with ongoing request', () => {
// When I execute a long-running query,
QueryStubs.stubLongRunningQuery(repositoryId);
SparqlEditorSteps.visitSparqlEditorPage();
QueryStubs.stubLongRunningQuery(repositoryId);
YasqeSteps.executeQueryWithoutWaiteResult();
// and try to navigate to other page.
MainMenuSteps.clickOnMenuImport();

// Then I expect to see confirm dialog that explain me about ongoing query.
ModalDialogSteps.getDialog().should('be.visible');
ModalDialogSteps.getDialogBody().contains('You have running 1 query, that will be aborted.');
ModalDialogSteps.getDialogBody().should('contain','You have running 1 query. The query will be aborted.');
});
});

Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"cy:open-flaky": "cypress open --config-file cypress-flaky.config.js",
"cy:guides": "cypress run --config-file cypress-legacy.config.js --spec \"e2e-legacy/guides/**/*.spec.js\" --browser chrome",
"cy:run": "npm run cy:run-legacy && cypress run",
"cy:run:partial": "cypress run --config-file cypress-legacy.config.js --spec \"e2e-legacy/**/jdbc-create.spec.js\" --browser chrome",
"cy:run:partial": "cypress run --config-file cypress-legacy.config.js --spec \"e2e-legacy/**/sparql-editor/**/*.spec.js\" --browser chrome",
"cy:run-legacy": "cypress run --config-file cypress-legacy.config.js --browser chrome",
"cy:run-security": "cypress run --config-file cypress-security.config.js --browser chrome",
"cy:run-legacy:coverage": "cypress run --config-file cypress-legacy.config.js --browser chrome",
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/steps/error-steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class ErrorSteps {
}

static getNoConnectedRepoMessage() {
return this.getRepositoryErrors().find('.alert.lead.alert-info');
return this.getRepositoryErrors().find('.alert.lead.alert-info, .no-active-repo-message');
}

static verifyNoConnectedRepoMessage() {
Expand Down
3 changes: 2 additions & 1 deletion e2e-tests/steps/modal-dialog-steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ export class ModalDialogSteps extends BaseSteps {
}

static getDialogBody() {
return ModalDialogSteps.getDialog().find('.modal-body');
// the second selector is for the new dialog body
return ModalDialogSteps.getDialog().find('.modal-body, [data-pc-section="content"]');
}

static verifyDialogBody(message) {
Expand Down
21 changes: 21 additions & 0 deletions e2e-tests/steps/onto-toastr-steps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export class OntoToastrSteps {
static getToastrContainer() {
return cy.get('.onto-toastr-container');
}

static getSuccessToast() {
return this.getToastrContainer().find('.toast.success');
}

static getErrorToast() {
return this.getToastrContainer().find('.toast.error');
}

static getInfoToast() {
return this.getToastrContainer().find('.toast.info');
}

static getWarningToast() {
return this.getToastrContainer().find('.toast.warning');
}
}
4 changes: 2 additions & 2 deletions e2e-tests/steps/yasgui/saved-query.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {YasguiSteps} from "./yasgui-steps";
import {SaveQueryDialog} from "./save-query-dialog";
import {ApplicationSteps} from "../application-steps";
import {OntoToastrSteps} from '../onto-toastr-steps.js';

export const DEFAULT_QUERY = 'select *';

Expand All @@ -16,7 +16,7 @@ export class SavedQuery {
SaveQueryDialog.toggleIsPublic();
SaveQueryDialog.saveQuery();
SaveQueryDialog.getSaveQueryDialog().should('not.exist');
ApplicationSteps.getSuccessNotifications().should('be.visible');
OntoToastrSteps.getSuccessToast().should('be.visible');
}

static generateQueryName() {
Expand Down
3 changes: 3 additions & 0 deletions e2e-tests/stubs/yasgui/query-stubs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import {SecurityStubs} from "../security-stubs";

export class QueryStubs {
static spyQuery(repositoryId) {
cy.intercept('POST', `/repositories/${repositoryId}`).as('query');
}

static stubInferAndSameAsDefaults(infer = true, sameAs = true) {
SecurityStubs.stubInferAndSameAsDefaults();
Expand Down
8 changes: 4 additions & 4 deletions packages/legacy-workbench/src/js/angular/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ PluginRegistry.add('main.menu', {
},
);
PluginRegistry.add('main.menu', {
disabled: true,
disabled: false,
items: [
{
label: 'New YASGUI',
labelKey: 'New YASGUI',
href: 'sparql-new',
label: 'SPARQL',
labelKey: 'SPARQL',
href: 'sparql',
order: 1.9,
role: 'IS_AUTHENTICATED_FULLY',
icon: "icon-sparql",
Expand Down
33 changes: 17 additions & 16 deletions packages/legacy-workbench/src/js/angular/sparql-editor/plugin.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PluginRegistry.add('route', {
'url': '/sparql',
'url': '/sparql-old',
'module': 'graphdb.framework.sparql-editor',
'path': 'sparql-editor/app',
'chunk': 'sparql',
Expand All @@ -9,20 +9,21 @@
'helpInfo': 'view.sparql-editor.helpInfo',
'reloadOnSearch': false,
'documentationUrl': 'sparql-queries.html',
'allowAuthorities': ['READ_REPO_{repoId}']
'allowAuthorities': ['READ_REPO_{repoId}'],
});

PluginRegistry.add('main.menu', {
'items': [
{
label: 'SPARQL',
labelKey: 'menu.sparql.label',
href: 'sparql',
order: 2,
role: 'IS_AUTHENTICATED_FULLY',
icon: "icon-sparql",
guideSelector: 'menu-sparql',
children: []
}
]
});
// PluginRegistry.add('main.menu', {
// 'disabled': true,
// 'items': [
// {
// label: 'SPARQL',
// labelKey: 'menu.sparql.label',
// href: 'sparqlaaa',
// order: 2,
// role: 'IS_AUTHENTICATED_FULLY',
// icon: "icon-sparql",
// guideSelector: 'menu-sparql',
// children: [],
// },
// ],
// });

Check warning on line 29 in packages/legacy-workbench/src/js/angular/sparql-editor/plugin.js

View check run for this annotation

SonarQubeCloud / [Shared-components] SonarCloud Code Analysis

Remove this commented out code.

See more on https://sonarcloud.io/project/issues?id=Ontotext-AD_WB_migration_workbench&issues=AZ5vZajMJJ9iWLnrgmxc&open=AZ5vZajMJJ9iWLnrgmxc&pullRequest=2979
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ export function getWorkbenchRoutes(): Route[] {
default: false,
},
{
path: 'new-view',
default: false,
},
{
path: 'sparql-new',
path: 'sparql',
default: false,
},
{
Expand Down
2 changes: 1 addition & 1 deletion packages/workbench/src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {documentationLinkResolve} from './services/route-data-resolver';

export const routes: Routes = [
{
path: 'sparql-new',
path: 'sparql',
data: {
title: 'sparql_editor.title',
helpInfo: 'sparql_editor.helpInfo',
Expand Down