graphdb-workbench-tests 3.0.0-TR7 → 3.0.0-TR9
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.
- package/fixtures/graphql/soml/swapi-schema-planets.yaml +51 -0
- package/fixtures/graphql/soml/swapi-schema-species.yaml +66 -0
- package/fixtures/locale-en.json +101 -6
- package/fixtures/ttyg/agent/get-agent-list-autocomplete-query.json +23 -0
- package/fixtures/ttyg/autocomplete-response.json +154 -0
- package/integration/graphql/create-graphql-endpoint.spec.js +7 -6
- package/integration/graphql/edit-graphql-enpoint.spec.js +39 -103
- package/integration/graphql/graphql-endpoint-filtering.spec.js +12 -15
- package/integration/graphql/graphql-endpoint-management-view.spec.js +106 -99
- package/integration/graphql/graphql-playground.spec.js +68 -48
- package/integration/graphql/graphql-set-default-endpoint.spec.js +42 -0
- package/integration/sparql-editor/saved-query/readonly-query.spec.js +65 -0
- package/integration/ttyg/edit-agent.spec.js +45 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/steps/graphql/graphiql-editor-tools-steps.js +10 -0
- package/steps/graphql/graphiql-playground-steps.js +6 -0
- package/steps/graphql/graphql-endpoint-management-steps.js +10 -1
- package/steps/ttyg/ttyg-agent-settings-modal.steps.js +44 -0
- package/steps/yasgui/saved-queries-dialog.js +19 -3
- package/stubs/graphql/graphql-stubs.js +7 -3
- package/stubs/ttyg/ttyg-stubs.js +7 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {GraphqlEndpointManagementSteps} from "../../steps/graphql/graphql-endpoint-management-steps";
|
|
2
|
+
import {ApplicationSteps} from "../../steps/application-steps";
|
|
3
|
+
import {GraphqlPlaygroundSteps} from "../../steps/graphql/graphql-playground-steps";
|
|
4
|
+
|
|
5
|
+
describe('Graphql: set default endpoint', () => {
|
|
6
|
+
let repositoryId;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
repositoryId = 'graphql-endpoint-management-' + Date.now();
|
|
10
|
+
cy.createRepository({id: repositoryId});
|
|
11
|
+
cy.presetRepository(repositoryId);
|
|
12
|
+
cy.importServerFile(repositoryId, 'swapi-dataset.ttl');
|
|
13
|
+
cy.uploadGraphqlSchema(repositoryId, 'graphql/soml/swapi-schema.yaml', 'swapi');
|
|
14
|
+
cy.uploadGraphqlSchema(repositoryId, 'graphql/soml/swapi-schema-film-restricted.yaml', 'swapi');
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
afterEach(() => {
|
|
18
|
+
cy.deleteRepository(repositoryId);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('should be able to change the default endpoint', () => {
|
|
22
|
+
// Given I have a repository with active GraphQL endpoint
|
|
23
|
+
// And I have visited the endpoint management view
|
|
24
|
+
GraphqlEndpointManagementSteps.visit();
|
|
25
|
+
GraphqlEndpointManagementSteps.getView().should('be.visible');
|
|
26
|
+
GraphqlEndpointManagementSteps.getEndpointsInfo().should('have.length', 2);
|
|
27
|
+
// And there is a default endpoint
|
|
28
|
+
GraphqlEndpointManagementSteps.getEndpointDefaultStatusRadio(0).should('be.checked');
|
|
29
|
+
// When I click on the second endpoint to set it as default
|
|
30
|
+
GraphqlEndpointManagementSteps.setEndpointAsDefault(1);
|
|
31
|
+
// Then I should see a success toast
|
|
32
|
+
ApplicationSteps.getSuccessNotifications().should('be.visible');
|
|
33
|
+
// And the default endpoint should be changed
|
|
34
|
+
GraphqlEndpointManagementSteps.getEndpointDefaultStatusRadio(1).should('be.checked');
|
|
35
|
+
GraphqlEndpointManagementSteps.getEndpointDefaultStatusRadio(0).should('not.be.checked');
|
|
36
|
+
// When I open the GraphQL Playground
|
|
37
|
+
GraphqlEndpointManagementSteps.exploreEndpoint(1);
|
|
38
|
+
// Then the default endpoint should be selected by default in the playground
|
|
39
|
+
GraphqlPlaygroundSteps.getView().should('be.visible');
|
|
40
|
+
GraphqlPlaygroundSteps.getSelectedEndpoint().should('contain', 'film-restricted');
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {SparqlEditorSteps} from "../../../steps/sparql-editor-steps";
|
|
2
|
+
import {YasguiSteps} from "../../../steps/yasgui/yasgui-steps";
|
|
3
|
+
import {QueryStubs} from "../../../stubs/yasgui/query-stubs";
|
|
4
|
+
import {UserAndAccessSteps} from "../../../steps/setup/user-and-access-steps";
|
|
5
|
+
import {SavedQuery} from "../../../steps/yasgui/saved-query";
|
|
6
|
+
import {SavedQueriesDialog} from "../../../steps/yasgui/saved-queries-dialog";
|
|
7
|
+
|
|
8
|
+
const USER_NAME = 'saved_query_user';
|
|
9
|
+
const USER_ADMINISTRATOR = 'admin';
|
|
10
|
+
const PASSWORD = 'root';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Skipped because this type of implementation is not ideal. If the test fails and the `afterEach` hook
|
|
14
|
+
* fails to toggle security, all remaining tests will fail because security remains enabled.
|
|
15
|
+
*
|
|
16
|
+
* Tests like this should be refactored to use stubs or other alternative implementations.
|
|
17
|
+
*/
|
|
18
|
+
describe.skip('Readonly saved query', () => {
|
|
19
|
+
|
|
20
|
+
let repositoryId;
|
|
21
|
+
|
|
22
|
+
beforeEach(() => {
|
|
23
|
+
repositoryId = 'sparql-editor-' + Date.now();
|
|
24
|
+
QueryStubs.stubQueryCountResponse();
|
|
25
|
+
cy.createRepository({id: repositoryId});
|
|
26
|
+
cy.presetRepository(repositoryId);
|
|
27
|
+
QueryStubs.stubDefaultQueryResponse(repositoryId);
|
|
28
|
+
cy.createUser({username: USER_NAME, password: PASSWORD});
|
|
29
|
+
UserAndAccessSteps.visit();
|
|
30
|
+
UserAndAccessSteps.toggleSecurity();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
afterEach(() => {
|
|
34
|
+
UserAndAccessSteps.logout();
|
|
35
|
+
cy.deleteRepository(repositoryId);
|
|
36
|
+
UserAndAccessSteps.visit();
|
|
37
|
+
UserAndAccessSteps.loginWithUser(USER_ADMINISTRATOR, PASSWORD);
|
|
38
|
+
UserAndAccessSteps.toggleSecurity();
|
|
39
|
+
cy.deleteUser(USER_NAME);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('Should not allow modifying a saved query if it is readonly', () => {
|
|
43
|
+
// Given: There is a public saved query created by a user.
|
|
44
|
+
UserAndAccessSteps.loginWithUser(USER_NAME, PASSWORD);
|
|
45
|
+
SparqlEditorSteps.visitSparqlEditorPage();
|
|
46
|
+
YasguiSteps.getYasgui().should('be.visible');
|
|
47
|
+
const savedQueryName = SavedQuery.generateQueryName();
|
|
48
|
+
SavedQuery.create(savedQueryName);
|
|
49
|
+
UserAndAccessSteps.logout();
|
|
50
|
+
|
|
51
|
+
// When: I log in with another user
|
|
52
|
+
UserAndAccessSteps.loginWithUser(USER_ADMINISTRATOR, PASSWORD);
|
|
53
|
+
// and open the popup with the saved query.
|
|
54
|
+
SparqlEditorSteps.visitSparqlEditorPage();
|
|
55
|
+
YasguiSteps.showSavedQueries();
|
|
56
|
+
|
|
57
|
+
// Then: I expect:
|
|
58
|
+
// 1. The delete button should not be visible because a saved query can only be deleted by the user who created it.
|
|
59
|
+
SavedQueriesDialog.getDeleteQueryButtonByName(savedQueryName).should('not.exist');
|
|
60
|
+
// 2. The edit button should not be visible because a saved query can only be edited by the user who created it.
|
|
61
|
+
SavedQueriesDialog.getEditQueryButtonByName(savedQueryName).should('not.exist');
|
|
62
|
+
// 3. The share button should be visible because a public saved query should be visible to all users.
|
|
63
|
+
SavedQueriesDialog.getShareQueryButtonByName(savedQueryName).should('exist');
|
|
64
|
+
});
|
|
65
|
+
});
|
|
@@ -51,4 +51,49 @@ describe('TTYG edit an agent', () => {
|
|
|
51
51
|
TtygAgentSettingsModalSteps.getIriDiscoverySearchCheckbox().should('be.checked');
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
+
|
|
55
|
+
it('should be able to edit Autocomplete extraction method option', {
|
|
56
|
+
retries: {
|
|
57
|
+
runMode: 1,
|
|
58
|
+
openMode: 0
|
|
59
|
+
}
|
|
60
|
+
}, () => {
|
|
61
|
+
TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-autocomplete-query.json');
|
|
62
|
+
TTYGStubs.stubAutocompleteResponse();
|
|
63
|
+
// Given I have opened the ttyg page
|
|
64
|
+
TTYGViewSteps.visit();
|
|
65
|
+
cy.wait('@get-agent-list');
|
|
66
|
+
// When I select an agent that don't have activated additional extraction method
|
|
67
|
+
TTYGViewSteps.expandAgentsSidebar();
|
|
68
|
+
TTYGViewSteps.openAgentsMenu();
|
|
69
|
+
TTYGViewSteps.selectAgent(0);
|
|
70
|
+
TTYGViewSteps.editCurrentAgent();
|
|
71
|
+
|
|
72
|
+
// Then I expect that the autocomplete iri discovery checkbox is not checked
|
|
73
|
+
TtygAgentSettingsModalSteps.getAutocompleteSearchCheckbox().should('not.be.checked');
|
|
74
|
+
|
|
75
|
+
// When I check the autocomplete iri discovery checkbox
|
|
76
|
+
TtygAgentSettingsModalSteps.checkAutocompleteSearchCheckbox();
|
|
77
|
+
|
|
78
|
+
// Then I can set a value for the max results
|
|
79
|
+
TtygAgentSettingsModalSteps.setAutocompleteMaxResults(2);
|
|
80
|
+
|
|
81
|
+
// Then I can select predicates with the autocomplete
|
|
82
|
+
TtygAgentSettingsModalSteps.enterSearchPredicate('rest');
|
|
83
|
+
cy.wait('@autocomplete-suggestions');
|
|
84
|
+
TtygAgentSettingsModalSteps.selectAutocompleteOption(3);
|
|
85
|
+
|
|
86
|
+
// When I save the agent
|
|
87
|
+
TTYGStubs.stubAgentEdit();
|
|
88
|
+
TtygAgentSettingsModalSteps.saveAgent();
|
|
89
|
+
cy.wait('@edit-agent');
|
|
90
|
+
// Then I expect the agent to be saved
|
|
91
|
+
ToasterSteps.verifySuccess('The agent \'Test autocomplete extraction agent\' was saved successfully.');
|
|
92
|
+
TTYGViewSteps.editCurrentAgent();
|
|
93
|
+
TtygAgentSettingsModalSteps.getAutocompleteSearchCheckbox().should('be.checked');
|
|
94
|
+
TtygAgentSettingsModalSteps.toggleAutocompleteSearchPanel();
|
|
95
|
+
TtygAgentSettingsModalSteps.getAutocompleteMaxResults().should('have.value', '2');
|
|
96
|
+
TtygAgentSettingsModalSteps.getSearchPredicateTags().should('have.length', '1');
|
|
97
|
+
TtygAgentSettingsModalSteps.getSearchPredicateTags().should('contain.text', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#rest');
|
|
98
|
+
});
|
|
54
99
|
});
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphdb-workbench-tests",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-TR9",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "graphdb-workbench-tests",
|
|
9
|
-
"version": "3.0.0-
|
|
9
|
+
"version": "3.0.0-TR9",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"cypress": "^13.3.1",
|
package/package.json
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export class GraphiQLEditorToolsSteps {
|
|
2
|
+
|
|
3
|
+
static getGraphiQLEditorTools() {
|
|
4
|
+
return cy.get(".graphiql-editor-tools");
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
static getGraphiQLEditorTabButton(index) {
|
|
8
|
+
return GraphiQLEditorToolsSteps.getGraphiQLEditorTools().find('button').eq(index);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -81,7 +81,8 @@ export class GraphqlEndpointManagementSteps {
|
|
|
81
81
|
cy.wrap($row).within(() => {
|
|
82
82
|
cy.get('td').eq(1).should('contain', endpointInfo.id);
|
|
83
83
|
cy.get('td').eq(2).should('contain', endpointInfo.label);
|
|
84
|
-
|
|
84
|
+
const isDefaultCheck = endpointInfo.default ? 'be.checked' : 'not.be.checked'
|
|
85
|
+
cy.get('td').eq(3).find('.endpoint-default-state input[type="radio"]').should(isDefaultCheck);
|
|
85
86
|
cy.get('td').eq(4).should('contain', endpointInfo.active ? 'yes' : 'no');
|
|
86
87
|
cy.get('td').eq(5).should('contain', endpointInfo.modified);
|
|
87
88
|
cy.get('td').eq(6).should('contain', endpointInfo.types);
|
|
@@ -111,4 +112,12 @@ export class GraphqlEndpointManagementSteps {
|
|
|
111
112
|
this.openEndpointActionMenu(index);
|
|
112
113
|
return cy.get('.configure-endpoint-btn').eq(index).click();
|
|
113
114
|
}
|
|
115
|
+
|
|
116
|
+
static getEndpointDefaultStatusRadio(index) {
|
|
117
|
+
return this.getEndpointInfo(index).find('.endpoint-default-state input[type="radio"]');
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
static setEndpointAsDefault(index) {
|
|
121
|
+
this.getEndpointDefaultStatusRadio(index).check();
|
|
122
|
+
}
|
|
114
123
|
}
|
|
@@ -412,6 +412,50 @@ export class TtygAgentSettingsModalSteps extends ModalDialogSteps {
|
|
|
412
412
|
this.getIriDiscoverySearchCheckbox().uncheck({force: true});
|
|
413
413
|
}
|
|
414
414
|
|
|
415
|
+
static getAutocompleteSearchCheckbox() {
|
|
416
|
+
return cy.get('#autocomplete_iri_discovery_search_checkbox');
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
static checkAutocompleteSearchCheckbox() {
|
|
420
|
+
this.getAutocompleteSearchCheckbox().check({force: true});
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
static uncheckAutocompleteSearchCheckbox() {
|
|
424
|
+
this.getAutocompleteSearchCheckbox().uncheck({force: true});
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
static getAutocompleteMaxResults() {
|
|
428
|
+
return cy.get('#autocomplete_iri_discovery_search_maxNumberOfResultsPerCall');
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
static setAutocompleteMaxResults(number) {
|
|
432
|
+
this.getAutocompleteMaxResults().type(number);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
static getSearchPredicateInput() {
|
|
436
|
+
return cy.get('#autocompletePredicateField');
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
static enterSearchPredicate(text) {
|
|
440
|
+
this.getSearchPredicateInput().type(text);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
static getSearchPredicateTags() {
|
|
444
|
+
return this.getSearchPredicateInput().find('.tag-item');
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
static toggleAutocompleteSearchPanel() {
|
|
448
|
+
cy.get('.extraction-method-toggle .panel-toggle-link .toggle-icon').click();
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
static getSuggestionsList() {
|
|
452
|
+
return cy.get('ul.suggestion-list li.suggestion-item');
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
static selectAutocompleteOption(index) {
|
|
456
|
+
this.getSuggestionsList().eq(index).click();
|
|
457
|
+
}
|
|
458
|
+
|
|
415
459
|
// System instructions
|
|
416
460
|
|
|
417
461
|
static getSystemInstructionsFormGroup() {
|
|
@@ -14,16 +14,32 @@ export class SavedQueriesDialog {
|
|
|
14
14
|
static selectSavedQueryByName(name) {
|
|
15
15
|
this.getSavedQueries().contains(name).click();
|
|
16
16
|
}
|
|
17
|
+
|
|
18
|
+
static getQueryByName(name) {
|
|
19
|
+
return this.getSavedQueries().contains(name).realHover();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static getEditQueryButtonByName(name) {
|
|
23
|
+
return this.getQueryByName(name).closest('.saved-query').find('.edit-saved-query');
|
|
24
|
+
}
|
|
17
25
|
|
|
18
26
|
static editQueryByName(name) {
|
|
19
|
-
this.
|
|
27
|
+
this.getEditQueryButtonByName(name).click();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static getDeleteQueryButtonByName(name) {
|
|
31
|
+
return this.getQueryByName(name).closest('.saved-query').find('.delete-saved-query');
|
|
20
32
|
}
|
|
21
33
|
|
|
22
34
|
static deleteQueryByName(name) {
|
|
23
|
-
this.
|
|
35
|
+
this.getDeleteQueryButtonByName(name).click();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
static getShareQueryButtonByName(name) {
|
|
39
|
+
return this.getQueryByName(name).closest('.saved-query').find('.share-saved-query');
|
|
24
40
|
}
|
|
25
41
|
|
|
26
42
|
static shareQueryByName(name) {
|
|
27
|
-
this.
|
|
43
|
+
this.getShareQueryButtonByName(name).click();
|
|
28
44
|
}
|
|
29
45
|
}
|
|
@@ -28,7 +28,7 @@ export class GraphqlStubs {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
static stubGetEndpointsInfoError(repositoryId) {
|
|
31
|
-
cy.intercept('GET', `/rest/repositories/${repositoryId}/manage/
|
|
31
|
+
cy.intercept('GET', `/rest/repositories/${repositoryId}/graphql/manage/list`, {
|
|
32
32
|
statusCode: 500,
|
|
33
33
|
response: {
|
|
34
34
|
error: "Required request parameter 'query' for method parameter type String is not present"
|
|
@@ -68,11 +68,15 @@ export class GraphqlStubs {
|
|
|
68
68
|
}).as('get-endpoint-configuration');
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
static spySaveEndpointConfiguration(repositoryId, endpoint) {
|
|
72
|
+
cy.intercept('POST', `/rest/repositories/${repositoryId}/graphql/manage/endpoints/${endpoint}`).as('save-endpoint-configuration');
|
|
73
|
+
}
|
|
74
|
+
|
|
71
75
|
static stubSaveEndpointConfiguration(repositoryId, endpoint, delay = 0, shouldFail = false) {
|
|
72
|
-
cy.intercept('
|
|
76
|
+
cy.intercept('POST', `/rest/repositories/${repositoryId}/graphql/manage/endpoints/${endpoint}`, {
|
|
73
77
|
statusCode: shouldFail ? 400 : 200,
|
|
74
78
|
delay: delay
|
|
75
|
-
}).as('save-endpoint-configuration');
|
|
79
|
+
}).as('save-endpoint-configuration-failed');
|
|
76
80
|
}
|
|
77
81
|
}
|
|
78
82
|
|
package/stubs/ttyg/ttyg-stubs.js
CHANGED
|
@@ -163,4 +163,11 @@ export class TTYGStubs extends Stubs {
|
|
|
163
163
|
statusCode: 200
|
|
164
164
|
}).as('explain-response');
|
|
165
165
|
}
|
|
166
|
+
|
|
167
|
+
static stubAutocompleteResponse(fixture = '/ttyg/autocomplete-response.json') {
|
|
168
|
+
cy.intercept('GET', '/rest/autocomplete/query?*', {
|
|
169
|
+
fixture,
|
|
170
|
+
statusCode: 200,
|
|
171
|
+
}).as('autocomplete-suggestions');
|
|
172
|
+
}
|
|
166
173
|
}
|