graphdb-workbench-tests 2.8.7 → 2.8.8-RC1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,9 +8,11 @@ import {SaveQueryDialog} from "../../../steps/yasgui/save-query-dialog";
8
8
  describe('Edit saved queries', () => {
9
9
 
10
10
  let repositoryId;
11
+ let savedQueryName;
11
12
 
12
13
  beforeEach(() => {
13
14
  repositoryId = 'sparql-editor-' + Date.now();
15
+ savedQueryName = SavedQuery.generateQueryName();
14
16
  QueryStubs.stubQueryCountResponse();
15
17
  cy.createRepository({id: repositoryId});
16
18
  cy.presetRepository(repositoryId);
@@ -21,12 +23,12 @@ describe('Edit saved queries', () => {
21
23
  });
22
24
 
23
25
  afterEach(() => {
26
+ cy.deleteSavedQuery(savedQueryName);
24
27
  cy.deleteRepository(repositoryId);
25
28
  });
26
29
 
27
30
  it('Should prevent saving query with duplicated name', () => {
28
31
  // Given I have created a query
29
- const savedQueryName = SavedQuery.generateQueryName();
30
32
  SavedQuery.create(savedQueryName);
31
33
  // When I open the saved queries popup
32
34
  YasguiSteps.showSavedQueries();
@@ -48,21 +50,35 @@ describe('Edit saved queries', () => {
48
50
  YasguiSteps.showSavedQueries();
49
51
  SavedQueriesDialog.editQueryByName(savedQueryName);
50
52
  SaveQueryDialog.getQueryField().should('have.value', 'select $s $p $o');
53
+ // Then I close the dialog
54
+ SaveQueryDialog.closeSaveQueryDialog();
55
+ });
56
+
57
+ // TODO skipped until .env can be updated with BE version, which includes the API changes
58
+ it.skip('should allow renaming saved query', () => {
59
+ // Given I have created a query
60
+ SavedQuery.create(savedQueryName);
61
+ // When I open the saved queries popup
62
+ YasguiSteps.showSavedQueries();
63
+ // And I edit the saved query
64
+ SavedQueriesDialog.editQueryByName(savedQueryName);
65
+ // Then the save query dialog should be opened
66
+ SaveQueryDialog.getQueryNameField().should('have.value', savedQueryName);
67
+ SaveQueryDialog.getQueryField().should('have.value', 'select *');
68
+ SaveQueryDialog.getIsPublicField().should('be.checked');
51
69
  // When I change the query name
52
- // TODO: This currently won't work. The legacy implementation in the WB does the following:
53
- // * First POST to create a new query with the new name
54
- // * Then DELETE the query with the old name
55
- // This is quite hackish and would require maintaining some state in the WB which is awkward.
56
- // Better approach would be to think of a way to delegate this to the backend api for the edit.
57
- // YasguiSteps.clearQueryNameField();
58
- // savedQueryName = generateQueryName();
59
- // YasguiSteps.writeQueryName(savedQueryName);
60
- // YasguiSteps.saveQuery();
61
- // // Then a new query should be created
62
- // YasguiSteps.getSaveQueryDialog().should('not.exist');
63
- // YasguiSteps.showSavedQueries();
64
- // YasguiSteps.editQueryByName(savedQueryName);
65
- // YasguiSteps.getQueryNameField().should('have.value', savedQueryName);
66
- // YasguiSteps.getQueryField().should('have.value', 'select $s $p $o');
70
+ SaveQueryDialog.clearQueryNameField();
71
+ savedQueryName = SavedQuery.generateQueryName();
72
+ SaveQueryDialog.writeQueryName(savedQueryName);
73
+ // And try to save the query
74
+ SaveQueryDialog.saveQuery();
75
+ // Then the query should be updated
76
+ SaveQueryDialog.getSaveQueryDialog().should('not.exist');
77
+ YasguiSteps.showSavedQueries();
78
+ SavedQueriesDialog.editQueryByName(savedQueryName);
79
+ SaveQueryDialog.getQueryNameField().should('have.value', savedQueryName);
80
+ SaveQueryDialog.getQueryField().should('have.value', 'select *');
81
+ // Then I close the dialog
82
+ SaveQueryDialog.closeSaveQueryDialog();
67
83
  });
68
84
  });
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "2.8.7",
3
+ "version": "2.8.8-RC1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "graphdb-workbench-tests",
9
- "version": "2.8.7",
9
+ "version": "2.8.8-RC1",
10
10
  "license": "Apache-2.0",
11
11
  "devDependencies": {
12
12
  "cypress": "^13.3.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphdb-workbench-tests",
3
- "version": "2.8.7",
3
+ "version": "2.8.8-RC1",
4
4
  "description": "Cypress tests for GraphDB workbench",
5
5
  "scripts": {
6
6
  "prepack": "npm shrinkwrap",
@@ -1,3 +1,5 @@
1
+ const DELETE_SAVED_QUERY_URL = '/rest/sparql/saved-queries';
2
+
1
3
  Cypress.Commands.add('pasteQuery', (query) => {
2
4
  // Setting the textarea and the calling setValue seems to work
3
5
  // more reliably then other strategies (see history)
@@ -12,6 +14,24 @@ Cypress.Commands.add('executeQuery', () => {
12
14
  getLoader().should('not.exist');
13
15
  });
14
16
 
17
+ Cypress.Commands.add('deleteSavedQuery', (savedQueryName, secured = false) => {
18
+ const url = DELETE_SAVED_QUERY_URL + '?name=' + savedQueryName;
19
+ let headers = {'Content-Type': 'application/json'};
20
+ if (secured) {
21
+ const authHeader = Cypress.env('adminToken');
22
+ headers = {...headers,
23
+ 'Authorization': authHeader
24
+ }
25
+ }
26
+ return cy.request({
27
+ method: 'DELETE',
28
+ url: url,
29
+ headers,
30
+ // Prevent Cypress from failing the test on non-2xx status codes
31
+ failOnStatusCode: false
32
+ });
33
+ });
34
+
15
35
  Cypress.Commands.add('verifyResultsPageLength', (resultLength) => {
16
36
  getResultsWrapper().should('be.visible');
17
37
  getTableResultRows()