graphdb-workbench-tests 3.4.0-dynamic-guides-test → 3.4.0

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.
Files changed (69) hide show
  1. package/e2e-legacy/cluster/cluster-states.spec.js +3 -3
  2. package/e2e-legacy/explore/visual-graph/node-info-panel.spec.js +58 -0
  3. package/e2e-legacy/explore/visual-graph/visual-graph-links-limit.spec.js +167 -0
  4. package/e2e-legacy/explore/visual-graph/visual.graph.spec.js +55 -78
  5. package/e2e-legacy/graphql/graphql-in-remote-location.spec.js +49 -0
  6. package/e2e-legacy/guides/navigation/navigation-guide.spec.js +64 -0
  7. package/e2e-legacy/guides/table-graph-explore/table-graph-explore-guide.spec.js +2 -1
  8. package/e2e-legacy/guides/ttyg/configure-agent/configure-agent-guide.spec.js +34 -26
  9. package/e2e-legacy/guides/ttyg/edit-agent/edit-ttyg-agent-guide.spec.js +1 -0
  10. package/e2e-legacy/guides/visual-graph/visual-graph-guide.spec.js +330 -124
  11. package/e2e-legacy/help/guides/guides-autostart.spec.js +36 -3
  12. package/e2e-legacy/help/guides/guides-confirm-cancel-dialog.js +83 -0
  13. package/e2e-legacy/home/cookie-policy/cookie-policy.spec.js +182 -0
  14. package/e2e-legacy/home/create-repository.spec.js +6 -0
  15. package/e2e-legacy/repository/attach-remote-location.spec.js +47 -12
  16. package/e2e-legacy/resource/resource.spec.js +33 -13
  17. package/e2e-legacy/setup/aclmanagement/acl-management-with-selected repository.spec.js +44 -0
  18. package/e2e-legacy/sparql-editor/actions/expand-results-over-sameas.spec.js +8 -8
  19. package/e2e-legacy/sparql-editor/actions/include-inferred-statements.spec.js +4 -4
  20. package/e2e-legacy/sparql-editor/actions/inferred-sameas.spec.js +3 -3
  21. package/e2e-legacy/sparql-editor/yasr/toolbar/visual-graph-button.spec.js +90 -36
  22. package/e2e-legacy/sparql-editor/yasr/yasr.spec.js +80 -0
  23. package/e2e-legacy/ttyg/chat-panel.spec.js +9 -0
  24. package/e2e-legacy/ttyg/clone-agent.spec.js +22 -0
  25. package/e2e-legacy/ttyg/edit-agent.spec.js +17 -0
  26. package/e2e-security/setup/home/cookie-policy.spec.js +232 -6
  27. package/e2e-security/setup/users-and-access/turn-on-security-and-password-change.spec.js +72 -59
  28. package/fixtures/graph/graph-configurations.json +59 -0
  29. package/fixtures/guides/confirm-cancel-dialog/confirm-cancel-dialog-guide.json +15 -0
  30. package/fixtures/guides/navigation/navigation-guide.json +60 -0
  31. package/fixtures/guides/ttyg/configure-agent/configure-ttyg-agent-guide.json +6 -1
  32. package/fixtures/guides/visual-graph/visual-graph-config-guide.json +39 -0
  33. package/fixtures/ttyg/chats/explain-response-1.json +2 -48
  34. package/npm-shrinkwrap.json +32 -33
  35. package/package.json +1 -1
  36. package/steps/cookie-policy/cookie-consent-banner-steps.js +21 -0
  37. package/steps/cookie-policy/cookie-policy-modal.steps.js +56 -0
  38. package/steps/graphql/create-graphql-endpoint-steps.js +8 -0
  39. package/steps/graphql/graphql-endpoint-management-steps.js +8 -0
  40. package/steps/graphql/graphql-playground-steps.js +8 -0
  41. package/steps/guides/guide-dialog-steps.js +56 -2
  42. package/steps/guides/movies-guide-steps.js +2 -1
  43. package/steps/header-steps.js +13 -0
  44. package/steps/home-steps.js +4 -27
  45. package/steps/login-steps.js +1 -0
  46. package/steps/main-menu-steps.js +1 -0
  47. package/steps/repositories/attach-repository-steps.js +16 -0
  48. package/steps/repository-steps.js +24 -0
  49. package/steps/resource/resource-steps.js +0 -8
  50. package/steps/setup/acl-management-steps.js +12 -0
  51. package/steps/setup/settings-steps.js +1 -1
  52. package/steps/shared-modal-dialog-steps.js +45 -0
  53. package/steps/sparql-editor-steps.js +18 -4
  54. package/steps/ttyg/ttyg-agent-settings-modal.steps.js +1 -1
  55. package/steps/visual-graph-split-button-steps.js +45 -0
  56. package/steps/visual-graph-steps.js +69 -3
  57. package/steps/yasgui/yasr-steps.js +30 -6
  58. package/stubs/cluster/remote-location-stubs.js +4 -0
  59. package/stubs/graph-config-stubs.js +17 -0
  60. package/stubs/guides/guides-stubs.js +8 -0
  61. package/stubs/repositories/repositories-stubs.js +22 -0
  62. package/stubs/security-stubs.js +4 -0
  63. package/stubs/sparql-stubs.js +10 -0
  64. package/support/commands.js +1 -0
  65. package/support/e2e-security.js +1 -1
  66. package/support/repository-commands.js +22 -3
  67. package/support/settings-commands.js +18 -2
  68. package/support/url-commands.js +13 -0
  69. package/e2e-legacy/home/cookie-policy.spec.js +0 -108
@@ -64,7 +64,7 @@ describe('Include inferred statements', () => {
64
64
  YasguiSteps.getYasgui().should('be.visible');
65
65
 
66
66
  // Then I expect that "infer" element to be enabled by default,
67
- YasqeSteps.getActionButton(3).should('have.class', 'icon-inferred-on');
67
+ YasqeSteps.getActionButton(4).should('have.class', 'icon-inferred-on');
68
68
  // and the tooltip of element describes that "infer" functionality is enabled.
69
69
  YasqeSteps.getActionButtonTooltip(3).should('have.attr', 'yasgui-data-tooltip', 'Include inferred data in results: ON');
70
70
 
@@ -72,7 +72,7 @@ describe('Include inferred statements', () => {
72
72
  YasguiSteps.openANewTab();
73
73
 
74
74
  // Then I expect that inferred element to be enabled in the new tab,
75
- YasqeSteps.getActionButton(3).should('have.class', 'icon-inferred-on');
75
+ YasqeSteps.getActionButton(4).should('have.class', 'icon-inferred-on');
76
76
  // and the tooltip of element describes that "infer" element is enabled.
77
77
  YasqeSteps.getActionButtonTooltip(3).should('have.attr', 'yasgui-data-tooltip', 'Include inferred data in results: ON');
78
78
  });
@@ -85,7 +85,7 @@ describe('Include inferred statements', () => {
85
85
  YasguiSteps.getYasgui().should('be.visible');
86
86
 
87
87
  // Then I expect that "infer" element to be disabled by default,
88
- YasqeSteps.getActionButton(3).should('have.class', 'icon-inferred-off');
88
+ YasqeSteps.getActionButton(4).should('have.class', 'icon-inferred-off');
89
89
  // and the tooltip of element describes that "infer" element is disabled.
90
90
  YasqeSteps.getActionButtonTooltip(3).should('have.attr', 'yasgui-data-tooltip', 'Include inferred data in results: OFF');
91
91
 
@@ -93,7 +93,7 @@ describe('Include inferred statements', () => {
93
93
  YasguiSteps.openANewTab();
94
94
 
95
95
  // Then I expect that inferred element to be disabled in the new tab,
96
- YasqeSteps.getActionButton(3).should('have.class', 'icon-inferred-off');
96
+ YasqeSteps.getActionButton(4).should('have.class', 'icon-inferred-off');
97
97
  // and the tooltip of element describes that "infer" element is disabled.
98
98
  YasqeSteps.getActionButtonTooltip(3).should('have.attr', 'yasgui-data-tooltip', 'Include inferred data in results: OFF');
99
99
  });
@@ -37,13 +37,13 @@ describe('Expand results over owl:sameAs', () => {
37
37
 
38
38
  // Then I expect inferred button to be on.
39
39
  YasqeSteps.getActionButtonTooltip(3).should('have.attr', 'yasgui-data-tooltip', 'Include inferred data in results: ON');
40
- YasqeSteps.getActionButton(3).should('have.class', 'icon-inferred-on');
40
+ YasqeSteps.getActionButton(4).should('have.class', 'icon-inferred-on');
41
41
 
42
42
  // When I click on inferred button
43
- YasqeSteps.getActionButton(3).click({force: true});
43
+ YasqeSteps.getActionButton(4).click({force: true});
44
44
 
45
45
  // Then I expect inferred button to not be toggled.
46
46
  YasqeSteps.getActionButtonTooltip(3).should('have.attr', 'yasgui-data-tooltip', 'Include inferred data in results: ON');
47
- YasqeSteps.getActionButton(3).should('have.class', 'icon-inferred-on');
47
+ YasqeSteps.getActionButton(4).should('have.class', 'icon-inferred-on');
48
48
  });
49
49
  });
@@ -1,17 +1,19 @@
1
- import {SparqlEditorSteps} from "../../../../steps/sparql-editor-steps";
2
- import {YasqeSteps} from "../../../../steps/yasgui/yasqe-steps";
3
- import {YasrSteps} from "../../../../steps/yasgui/yasr-steps";
4
- import {QueryStubs} from "../../../../stubs/yasgui/query-stubs";
1
+ import {SparqlEditorSteps} from '../../../../steps/sparql-editor-steps';
2
+ import {YasqeSteps} from '../../../../steps/yasgui/yasqe-steps';
3
+ import {QueryStubs} from '../../../../stubs/yasgui/query-stubs';
4
+ import {GraphConfigStubs} from '../../../../stubs/graph-config-stubs.js';
5
+ import {BrowserStubs} from '../../../../stubs/browser-stubs.js';
6
+ import {VisualGraphSplitButtonSteps} from '../../../../steps/visual-graph-split-button-steps.js';
5
7
 
6
- describe('Visual graph button when user execute a CONSTRUCT query', () => {
8
+ describe('"Visualize" split button', () => {
7
9
  let repositoryId;
8
10
 
9
11
  beforeEach(() => {
10
- repositoryId = 'sparql-editor-' + Date.now();
12
+ repositoryId = 'yasr-vizualize-split-button' + Date.now();
11
13
  QueryStubs.stubQueryCountResponse();
12
14
  cy.createRepository({id: repositoryId});
13
15
  cy.presetRepository(repositoryId);
14
- // Given I visit a page with "ontotex-yasgu-web-component" in it.
16
+ // Given I visit a page with 'ontotex-yasgu-web-component' in it.
15
17
  SparqlEditorSteps.visitSparqlEditorPage();
16
18
  });
17
19
 
@@ -19,34 +21,86 @@ describe('Visual graph button when user execute a CONSTRUCT query', () => {
19
21
  cy.deleteRepository(repositoryId);
20
22
  });
21
23
 
22
- it('Should display a "Visual" graph button configured by user', () => {
23
- // When I visit a page with "ontotext-yasgui-web-component" on it,
24
- // and select a CONSTRUCT query.
25
- YasqeSteps.executeQuery();
26
-
27
- // Then I expect "Visual" button to not be visible.
28
- YasrSteps.getVisualButton().should('not.be.visible');
29
-
30
- // When I execute a CONSTRUCT query.
31
- YasqeSteps.pasteQuery(
32
- 'PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>' +
33
- 'PREFIX onto: <http://www.ontotext.com/>' +
34
- 'CONSTRUCT {' +
35
- '?source rdf:type ?destination .' +
36
- '} WHERE {' +
37
- '?bag rdf:type ?source .' +
38
- '?flight rdf:type ?destination' +
39
- '}');
40
- YasqeSteps.executeQuery();
41
-
42
- // Then I expect "Visual" button to be visible.
43
- YasrSteps.getVisualButton().should('be.visible');
44
-
45
- // When I execute SELECT query again.
46
- YasqeSteps.pasteQuery('select * where {?s ?p ?o.}');
47
- YasqeSteps.executeQuery();
48
-
49
- // Then I expect "Visual" button to not be visible.
50
- YasrSteps.getVisualButton().should('not.be.visible');
24
+ it('should display "Visualize" split button when user execute a CONSTRUCT query', () => {
25
+ // WHEN: I visit a page with 'ontotext-yasgui-web-component' on it, and execute select query.
26
+ executeSelectQuery();
27
+ // THEN: I expect the 'Visualize' button to not be visible.
28
+ VisualGraphSplitButtonSteps.getVisualizeMainButton().should('not.be.visible');
29
+
30
+ // WHEN: I execute a CONSTRUCT query.
31
+ executeConstructQuery();
32
+ // THEN: I expect the 'Visualize' button to be visible.
33
+ VisualGraphSplitButtonSteps.getVisualizeMainButton().should('be.visible');
34
+
35
+ // WHEN: I execute SELECT query again.
36
+ executeSelectQuery();
37
+ // THEN: I expect the 'Visualize' button to not be visible.
38
+ VisualGraphSplitButtonSteps.getVisualizeMainButton().should('not.be.visible');
39
+ });
40
+
41
+ it('should inform user that there no created graph configurations', () => {
42
+ // GIVEN: There are no graph configurations.
43
+ GraphConfigStubs.stubGetEmptyGraphConfigs();
44
+ // AND: I visit a page with 'ontotext-yasgui-web-component' on it, and the 'Visualize' button is visible.
45
+ executeConstructQuery();
46
+
47
+ // WHEN: I open the dropdown.
48
+ VisualGraphSplitButtonSteps.toggleGraphConfigDropdown();
49
+ // THEN: I expect to see message that informs that there are no graph configurations.
50
+ VisualGraphSplitButtonSteps.getNoConfigurationsMessage().should('contain.text', 'No advanced graph configuration.');
51
+
52
+ // WHEN: I click on create link.
53
+ BrowserStubs.stubWindowOpen();
54
+ VisualGraphSplitButtonSteps.clickCreateGraphConfigLink();
55
+ // THEN: I expect to be navigated to graph configurations page.
56
+ cy.get(BrowserStubs.WINDOW_OPEN_ALIAS()).should('have.been.calledWithMatch', 'graphs-visualizations', '_blank', 'noopener,noreferrer');
57
+ });
58
+
59
+ it('should open graphs-visualizations view when click on main button', () => {
60
+ // GIVEN: I visit a page with 'ontotext-yasgui-web-component' on it, and the 'Visualize' button is visible.
61
+ executeConstructQuery();
62
+
63
+ // WHEN: I click on main button
64
+ VisualGraphSplitButtonSteps.clickOnVisualizeMainButton();
65
+ // THEN: I expect to be navigated to graphs-visualizations view.
66
+ cy.url().should('include', 'graphs-visualizations');
67
+ cy.getQueryParam('query').should('include', 'PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>PREFIX onto: <http://www.ontotext.com/>CONSTRUCT {?source rdf:type ?destination .} WHERE {?bag rdf:type ?source .?flight rdf:type ?destination}');
68
+ cy.getQueryParam('config').should('not.exist');
69
+ });
70
+
71
+ it('should open graphs-visualizations view when select a graph configuration', () => {
72
+ // GIVEN: I visit a page with 'ontotext-yasgui-web-component' on it, and the 'Visualize' button is visible.
73
+ executeConstructQuery();
74
+ GraphConfigStubs.stubGetGraphConfigs();
75
+
76
+ // WHEN: I open the dropdown.
77
+ VisualGraphSplitButtonSteps.toggleGraphConfigDropdown();
78
+ // THEN: I expect to see all graph configurations.
79
+ VisualGraphSplitButtonSteps.getGraphConfigs().should('have.length', 3);
80
+
81
+ // WHEN: I select a graph configuration
82
+ VisualGraphSplitButtonSteps.selectGraphConfig();
83
+ // THEN: I expect to be navigated to graphs-visualizations view.
84
+ cy.url().should('include', 'graphs-visualizations');
85
+ cy.getQueryParam('query').should('include', 'PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>PREFIX onto: <http://www.ontotext.com/>CONSTRUCT {?source rdf:type ?destination .} WHERE {?bag rdf:type ?source .?flight rdf:type ?destination}');
86
+ cy.getQueryParam('config').should('eq', 'de99fd5de7f94ef98f1875dff55fc1c9');
51
87
  });
52
88
  });
89
+
90
+ const executeSelectQuery = () => {
91
+ YasqeSteps.pasteQuery('select * where {?s ?p ?o.}');
92
+ YasqeSteps.executeQuery();
93
+ };
94
+
95
+ const executeConstructQuery = () => {
96
+ YasqeSteps.pasteQuery(
97
+ 'PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>' +
98
+ 'PREFIX onto: <http://www.ontotext.com/>' +
99
+ 'CONSTRUCT {' +
100
+ '?source rdf:type ?destination .' +
101
+ '} WHERE {' +
102
+ '?bag rdf:type ?source .' +
103
+ '?flight rdf:type ?destination' +
104
+ '}');
105
+ YasqeSteps.executeQuery();
106
+ };
@@ -0,0 +1,80 @@
1
+ import {SparqlEditorSteps} from '../../../steps/sparql-editor-steps.js';
2
+ import {YasrSteps} from '../../../steps/yasgui/yasr-steps.js';
3
+ import {YasqeSteps} from '../../../steps/yasgui/yasqe-steps.js';
4
+
5
+ describe('YASR', () => {
6
+ let repositoryId;
7
+ let secondRepositoryId;
8
+
9
+ beforeEach(() => {
10
+ repositoryId = 'yasr-' + Date.now();
11
+ cy.createRepository({id: repositoryId});
12
+ cy.presetRepository(repositoryId);
13
+ });
14
+
15
+ afterEach(() => {
16
+ cy.deleteRepository(repositoryId);
17
+ cy.deleteRepository(secondRepositoryId);
18
+ });
19
+
20
+ it('should load YASR in fullscreen with plugin config from URL', () => {
21
+ // WHEN: I visit SPARQL Query & Update page with url parameters: embedded and pluginName
22
+ SparqlEditorSteps.visitSparqlEditorPageAndWaitForResults(getUrl(repositoryId, 'pivotTable', true));
23
+ // THEN: YASR is in fullscreen mode because the workbench is embedded.
24
+ YasrSteps.getYasr().should('have.class', 'yasr-fullscreen');
25
+ // AND: I expect the raw response plugin to be visible
26
+ YasrSteps.getPivotTablePlugin().should('be.visible');
27
+
28
+ // WHEN: I press the ESC key.
29
+ YasrSteps.typeEscapeKey();
30
+ // THEN: I see YASR results in fullscreen mode because Escape is disabled in this mode.
31
+ YasrSteps.getYasr().should('have.class', 'yasr-fullscreen');
32
+
33
+ // WHEN: I visit SPARQL Query & Update page with without embedded url parameter.
34
+ SparqlEditorSteps.visitSparqlEditorPageAndWaitForResults(getUrl(repositoryId, 'googleChart'));
35
+ // THEN: I expect yasr to be in non-fullscreen mode
36
+ YasrSteps.getYasr().should('not.have.class', 'yasr-fullscreen');
37
+ // AND: I expect Google Chart plugin to be visible
38
+ YasrSteps.getGoogleChartPlugin().should('be.visible');
39
+
40
+ // WHEN: I visit SPARQL Query & Update page with without embedded and pluginName url parameters.
41
+ SparqlEditorSteps.visitSparqlEditorPageAndWaitForResults(getUrl(repositoryId));
42
+ // THEN: I expect yasr to be in non-fullscreen mode
43
+ YasrSteps.getYasr().should('not.have.class', 'yasr-fullscreen');
44
+ // AND: I expect Google Chart plugin to be visible, because it was the last used plugin.
45
+ YasrSteps.getGoogleChartPlugin().should('be.visible');
46
+
47
+ // WHEN: I visit SPARQL Query & Update page with without embedded and pluginName url parameters.
48
+ // AND: There are no persisted yasr data.
49
+ cy.clearLocalStorage('yagui__graphdb-workbench-sparql-editor');
50
+ SparqlEditorSteps.visitSparqlEditorPageAndWaitForResults(getUrl(repositoryId));
51
+ // THEN: I expect yasr to be in non-fullscreen mode
52
+ YasrSteps.getYasr().should('not.have.class', 'yasr-fullscreen');
53
+ // AND: I expect the default plugin to be visible
54
+ YasrSteps.getExtendedTablePlugin().should('be.visible');
55
+ });
56
+
57
+ it('should trigger YASR fullscreen mode', () => {
58
+ // GIVEN: I open a page that contains "ontotext-yasgui-web-component".
59
+ SparqlEditorSteps.visitSparqlEditorPage();
60
+
61
+ // WHEN: I execute a query.
62
+ YasqeSteps.executeQuery();
63
+ // THEN: I should see YASR results in non-fullscreen mode.
64
+ YasrSteps.getYasr().should('not.have.class', 'yasr-fullscreen');
65
+
66
+ // WHEN: I toggle to fullscreen mode.
67
+ YasrSteps.toggleFullscreen();
68
+ // THEN: I should see YASR results in fullscreen mode.
69
+ YasrSteps.getYasr().should('have.class', 'yasr-fullscreen');
70
+
71
+ // WHEN: I press the ESC key.
72
+ YasrSteps.typeEscapeKey();
73
+ // THEN: I should see YASR results in non-fullscreen mode, because escape is enabled when workbench is not embedded.
74
+ YasrSteps.getYasr().should('not.have.class', 'yasr-fullscreen');
75
+ });
76
+ });
77
+
78
+ const getUrl = (repositoryId, pluginName, embedded = false) => {
79
+ return `repositoryId=${repositoryId}${pluginName ? ('&pluginName=' + pluginName) : ''}${embedded ? '&embedded' : ''}&query=SELECT * { ?s ?p ?o }&execute=true`;
80
+ }
@@ -3,6 +3,8 @@ import {TTYGStubs} from "../../stubs/ttyg/ttyg-stubs";
3
3
  import {TTYGViewSteps} from "../../steps/ttyg/ttyg-view-steps";
4
4
  import {ChatPanelSteps} from "../../steps/ttyg/chat-panel-steps";
5
5
  import {ApplicationSteps} from "../../steps/application-steps";
6
+ import {TtygAgentSettingsModalSteps} from '../../steps/ttyg/ttyg-agent-settings-modal.steps.js';
7
+ import {SparqlStubs} from '../../stubs/sparql-stubs.js';
6
8
 
7
9
  describe('Ttyg ChatPanel', () => {
8
10
 
@@ -147,6 +149,13 @@ describe('Ttyg ChatPanel', () => {
147
149
  TTYGViewSteps.clickOnExplainResponse(0);
148
150
  // Then I expect the hint message to not exist (it should only exist for the last 'Explain' response).
149
151
  TTYGViewSteps.getHowDeliverAnswerButton().should('not.exist');
152
+ // When I click on the open in sparql editor button for the explain response
153
+ SparqlStubs.spyAddKnownPrefixes();
154
+ TtygAgentSettingsModalSteps.clickOpenQueryInSparqlEditor(0);
155
+ // Then I expect a request for appending prefixes to be sent with the correct query.
156
+ cy.wait('@addKnownPrefixes').its('request.body').then((body) => {
157
+ expect(body).to.contain('SELECT ?name ?height WHERE {\n ?character voc:height ?height;\n rdfs:label ?name.\n FILTER(?name = "Luke Skywalker" || ?name = "Leia Organa")\n}');
158
+ });
150
159
 
151
160
  // Then when I click on explain response button on the second answer
152
161
  TTYGStubs.stubExplainResponse('/ttyg/chats/explain-response-2.json');
@@ -17,6 +17,7 @@ describe('TTYG clone an agent', () => {
17
17
  TTYGStubs.stubAgentListGet();
18
18
  TTYGStubs.stubChatsListGet();
19
19
  TTYGStubs.stubChatGet();
20
+ RepositoriesStubs.stubRepositoryModel(repositoryId);
20
21
  // Given I have opened the ttyg page
21
22
  TTYGViewSteps.visit();
22
23
  cy.wait('@get-all-repositories');
@@ -45,6 +46,7 @@ describe('TTYG clone an agent', () => {
45
46
  TTYGStubs.stubAgentCreate();
46
47
  TtygAgentSettingsModalSteps.saveAgent();
47
48
  cy.wait('@create-agent').then((interception) => {
49
+ // eslint-disable-next-line no-undef
48
50
  assert.deepEqual(interception.request.body, {
49
51
  "id": "asst_gAPcrHQQ9ZIxD5eXWH2BNFfo",
50
52
  "name": "agent-11",
@@ -72,4 +74,24 @@ describe('TTYG clone an agent', () => {
72
74
  });
73
75
  });
74
76
  });
77
+
78
+ it('should not be able to clone an agent if an extraction method is selected but the precondition has failed', () => {
79
+ TTYGStubs.stubAgentListGet();
80
+ TTYGStubs.stubChatsListGet();
81
+ TTYGStubs.stubChatGet();
82
+ RepositoriesStubs.stubFtsSearchDisabled(repositoryId);
83
+
84
+ // GIVEN: I have opened the TTYG page
85
+ TTYGViewSteps.visit();
86
+ cy.wait('@get-all-repositories');
87
+ cy.wait('@get-agent-list');
88
+ cy.wait('@get-chat');
89
+
90
+ // WHEN: I try to clone an agent that has the FTS extraction method enabled, but FTS is disabled in the repository
91
+ TTYGViewSteps.expandAgentsSidebar();
92
+ TTYGViewSteps.triggerCloneAgentActionMenu(0);
93
+
94
+ // THEN: The Save Agent button should be disabled
95
+ TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
96
+ });
75
97
  });
@@ -12,6 +12,7 @@ describe('TTYG edit an agent', () => {
12
12
  beforeEach(() => {
13
13
  RepositoriesStubs.stubRepositories(0, '/repositories/get-ttyg-repositories.json');
14
14
  RepositoriesStubs.stubBaseEndpoints(repositoryId);
15
+ RepositoriesStubs.stubRepositoryModel(repositoryId);
15
16
  cy.presetRepository(repositoryId);
16
17
  TTYGStubs.stubAgentDefaultsGet();
17
18
  });
@@ -44,6 +45,22 @@ describe('TTYG edit an agent', () => {
44
45
  ToasterSteps.verifySuccess('The agent \'agent-1\' was saved successfully.');
45
46
  });
46
47
 
48
+ it('should not be able to edit an agent if an extraction method is selected but the precondition has failed', () => {
49
+ TTYGStubs.stubChatsListGet();
50
+ TTYGStubs.stubAgentListGet();
51
+ TTYGStubs.stubChatGet();
52
+ RepositoriesStubs.stubFtsSearchDisabled(repositoryId);
53
+ // GIVEN: I have opened the TTYG page
54
+ TTYGViewSteps.visit();
55
+ cy.wait('@get-chat-list');
56
+ cy.wait('@get-agent-list');
57
+ cy.wait('@get-chat');
58
+ // WHEN: I try to edit an agent that has the FTS extraction method enabled, but FTS is disabled in the repository
59
+ TTYGViewSteps.openAgentSettingsModalForAgent(0);
60
+
61
+ // THEN: The Save Agent button should be disabled
62
+ TtygAgentSettingsModalSteps.getSaveAgentButton().should('be.disabled');
63
+ });
47
64
 
48
65
  it('should be able to edit Autocomplete extraction method option', () => {
49
66
  TTYGStubs.stubAgentListGet('/ttyg/agent/get-agent-list-autocomplete-query.json');
@@ -2,7 +2,12 @@ import {UserAndAccessSteps} from "../../../steps/setup/user-and-access-steps";
2
2
  import {LicenseStubs} from "../../../stubs/license-stubs";
3
3
  import {LoginSteps} from "../../../steps/login-steps";
4
4
  import {ModalDialogSteps} from "../../../steps/modal-dialog-steps";
5
- import HomeSteps from "../../../steps/home-steps";
5
+ import {MainMenuSteps} from '../../../steps/main-menu-steps.js';
6
+ import {CookieConsentBannerSteps} from '../../../steps/cookie-policy/cookie-consent-banner-steps.js';
7
+ import ImportSteps from '../../../steps/import/import-steps.js';
8
+ import {CookiePolicyModalSteps} from '../../../steps/cookie-policy/cookie-policy-modal.steps.js';
9
+ import {SettingsSteps} from '../../../steps/setup/settings-steps.js';
10
+ import {HeaderSteps} from '../../../steps/header-steps.js';
6
11
 
7
12
  Cypress.env('set_default_user_data', false);
8
13
 
@@ -15,7 +20,7 @@ describe('Cookie policy', () => {
15
20
  cy.switchOffFreeAccess(true);
16
21
  cy.switchOffSecurity(true);
17
22
  });
18
- cy.setDefaultUserData(false);
23
+ cy.setDefaultUserData(undefined);
19
24
  LicenseStubs.stubFreeLicense();
20
25
  repository = 'cypress-test-cookie-policy-security-' + Date.now();
21
26
  cy.createRepository({id: repository});
@@ -26,10 +31,231 @@ describe('Cookie policy', () => {
26
31
  cy.loginAsAdmin().then(() => {
27
32
  cy.switchOffFreeAccess(true);
28
33
  cy.switchOffSecurity(true);
29
- cy.setDefaultUserData();
34
+ cy.setDefaultUserData(undefined);
30
35
  });
31
36
  });
32
37
 
38
+ // Scenario 5
39
+ it('should hide cookie consent banner when security is ON and user is logged out', () => {
40
+ // Given I open user and access page in prod mode
41
+ UserAndAccessSteps.visitInProdMode();
42
+ // Then the cookie policy banner should be visible
43
+ CookieConsentBannerSteps.getCookieConsentBanner().should('exist').and('be.visible');
44
+ // When I enable security
45
+ UserAndAccessSteps.toggleSecurity();
46
+ // Then I should be logged out
47
+ LoginSteps.getLoginPage().should('be.visible');
48
+ // And the cookie policy banner should be hidden
49
+ CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
50
+ // When I login with admin
51
+ LoginSteps.loginWithUser('admin', 'root');
52
+ // Then the cookie policy banner should be visible
53
+ UserAndAccessSteps.getUsersTable().should('be.visible');
54
+ CookieConsentBannerSteps.getCookieConsentBanner().should('exist').and('be.visible');
55
+ });
56
+
57
+ // Scenario 6
58
+ it('should give cookie consent when security is ON', () => {
59
+ // Given I open user and access page in prod mode
60
+ UserAndAccessSteps.visitInProdMode();
61
+ // When I enable security
62
+ UserAndAccessSteps.toggleSecurity();
63
+ // Then I should be logged out
64
+ LoginSteps.getLoginPage().should('be.visible');
65
+ // When I login with admin
66
+ LoginSteps.loginWithUser('admin', 'root');
67
+ // Then I should see the users and access page
68
+ UserAndAccessSteps.getUsersTable().should('be.visible');
69
+ // Then the cookie policy banner should be visible
70
+ CookieConsentBannerSteps.getCookieConsentBanner().should('be.visible');
71
+ // When I click OK in the cookie consent banner
72
+ CookieConsentBannerSteps.giveCookieConsent();
73
+ // Then the cookie policy banner should be hidden
74
+ CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
75
+ // When I open another page
76
+ MainMenuSteps.clickOnMenuImport();
77
+ ImportSteps.getView().should('be.visible');
78
+ // Then the cookie policy banner should be hidden
79
+ CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
80
+ // When I reload the page
81
+ cy.reload();
82
+ // Then the cookie policy banner should be hidden
83
+ CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
84
+ });
85
+
86
+ // Scenario 7
87
+ it('should update cookie policy and give cookie consent when security is ON', () => {
88
+ // Given I open user and access page in prod mode
89
+ UserAndAccessSteps.visitInProdMode();
90
+ // And I enable security
91
+ UserAndAccessSteps.toggleSecurity();
92
+ // And I login with admin
93
+ LoginSteps.loginWithUser('admin', 'root');
94
+ // When I click on the cookie policy link in the banner
95
+ CookieConsentBannerSteps.clickCookiePolicyLink();
96
+ // Then I see the cookie policy
97
+ CookiePolicyModalSteps.getDialogComponent().should('be.visible');
98
+ CookiePolicyModalSteps.validateCookiePolicyDialog(true, true);
99
+ // When I toggle off the analytics cookie checkbox
100
+ CookiePolicyModalSteps.toggleStatisticCookies();
101
+ // And I close the dialog
102
+ CookiePolicyModalSteps.closeDialog();
103
+ CookiePolicyModalSteps.getDialog().should('not.exist');
104
+ // When I reload the page
105
+ cy.reload();
106
+ // Then I expect to see that analytic cookies are not allowed and third party cookies are allowed
107
+ CookieConsentBannerSteps.clickCookiePolicyLink();
108
+ CookiePolicyModalSteps.validateCookiePolicyDialog(false, true);
109
+ // And I close the cookie policy dialog
110
+ CookiePolicyModalSteps.closeDialog();
111
+ // When I open my settings page
112
+ MainMenuSteps.clickOnMySettings();
113
+ // And I open cookie policy modal using the button in the my settings widget
114
+ SettingsSteps.clickCookiePolicyLink();
115
+ // Then I should see the cookie policy
116
+ CookiePolicyModalSteps.getDialogComponent().should('be.visible');
117
+ // And I expect to see that analytic cookies are not allowed and third party cookies are allowed
118
+ CookiePolicyModalSteps.validateCookiePolicyDialog(false, true);
119
+ // When I toggle off third party cookies checkbox
120
+ CookiePolicyModalSteps.toggleThirdPartyCookies();
121
+ // And I close the modal
122
+ CookiePolicyModalSteps.closeDialog();
123
+ // When I reopen modal from the widget
124
+ SettingsSteps.clickCookiePolicyLink();
125
+ // Then I expect to see that analytic cookies are not allowed and third party cookies are not allowed
126
+ CookiePolicyModalSteps.validateCookiePolicyDialog(false, false);
127
+ CookiePolicyModalSteps.closeDialog();
128
+ // When I click OK in the banner
129
+ CookieConsentBannerSteps.giveCookieConsent();
130
+ // Then I expect the banner to be hidden
131
+ CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
132
+ // When I reload the page
133
+ cy.reload();
134
+ // Then I expect the banner to be hidden
135
+ CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
136
+ // When I logout
137
+ LoginSteps.logout();
138
+ // Then I should see the login page
139
+ LoginSteps.getLoginPage().should('be.visible');
140
+ // And the cookie policy banner should be hidden
141
+ CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
142
+ // When I login with admin
143
+ LoginSteps.loginWithUser('admin', 'root');
144
+ // Then the cookie policy banner should be hidden
145
+ CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
146
+ // When I open cookie policy modal from the widget
147
+ SettingsSteps.clickCookiePolicyLink();
148
+ // Then I expect to see that analytic cookies are not allowed and third party cookies are not allowed
149
+ CookiePolicyModalSteps.validateCookiePolicyDialog(false, false);
150
+ // When I toggle on third party cookies checkbox
151
+ CookiePolicyModalSteps.toggleThirdPartyCookies();
152
+ // And I close the modal
153
+ CookiePolicyModalSteps.closeDialog();
154
+ // When I reload the page
155
+ cy.reload();
156
+ // Then I expect to see that analytic cookies are not allowed and third party cookies are allowed
157
+ SettingsSteps.clickCookiePolicyLink();
158
+ CookiePolicyModalSteps.validateCookiePolicyDialog(false, true);
159
+ });
160
+
161
+ // Scenario 8
162
+ it('should update cookie policy and give cookie consent when security is ON and free access is ON', () => {
163
+ // Given I open user and access page in prod mode
164
+ UserAndAccessSteps.visitInProdMode();
165
+ // And I enable security
166
+ UserAndAccessSteps.toggleSecurity();
167
+ // And I login with admin
168
+ LoginSteps.loginWithUser('admin', 'root');
169
+ // And I enable free access
170
+ UserAndAccessSteps.toggleFreeAccess();
171
+ UserAndAccessSteps.clickFreeWriteAccessRepo(repository);
172
+ ModalDialogSteps.clickOKButton();
173
+ // Then the cookie policy banner should be visible
174
+ CookieConsentBannerSteps.getCookieConsentBanner().and('be.visible');
175
+ // When I click on the cookie policy link in the banner
176
+ CookieConsentBannerSteps.clickCookiePolicyLink();
177
+ // Then I see the cookie policy
178
+ CookiePolicyModalSteps.getDialogComponent().should('be.visible');
179
+ // And I expect to see that analytic and third party cookies are allowed
180
+ CookiePolicyModalSteps.validateCookiePolicyDialog(true, true);
181
+ // When I toggle off the analytics cookie checkbox
182
+ // The policy is saved on the server
183
+ CookiePolicyModalSteps.toggleStatisticCookies();
184
+ // And I close the dialog
185
+ CookiePolicyModalSteps.closeDialog();
186
+ CookiePolicyModalSteps.getDialog().should('not.exist');
187
+ // When I logout
188
+ HeaderSteps.logout();
189
+ // Then I should still see the user and access page but I have no access to it which is unimportant for this test
190
+ cy.url().should('include', '/users');
191
+ // And the cookie policy banner should be visible
192
+ CookieConsentBannerSteps.getCookieConsentBanner().and('be.visible');
193
+ // When I click on the cookie policy link in the banner
194
+ CookieConsentBannerSteps.clickCookiePolicyLink();
195
+ // Then I see the cookie policy
196
+ CookiePolicyModalSteps.getDialogComponent().should('be.visible');
197
+ // And I expect to see that analytic cookies are allowed and third party cookies are allowed
198
+ // (using browser data, because user is logged out)
199
+ CookiePolicyModalSteps.validateCookiePolicyDialog(true, true);
200
+ // And I close the cookie policy modal
201
+ CookiePolicyModalSteps.closeDialog();
202
+ // When I open another page
203
+ MainMenuSteps.clickOnMenuImport();
204
+ // Then the cookie policy banner should be visible
205
+ CookieConsentBannerSteps.getCookieConsentBanner().and('be.visible');
206
+ // When I give cookie consent
207
+ CookieConsentBannerSteps.giveCookieConsent();
208
+ // Then the cookie policy banner should be hidden
209
+ CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
210
+ // When I open another page
211
+ MainMenuSteps.clickOnSparqlMenu();
212
+ cy.url().should('include', '/sparql');
213
+ // Then the cookie policy banner should be hidden
214
+ CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
215
+ // When I reload the page
216
+ cy.reload();
217
+ // Then the cookie policy banner should be hidden
218
+ CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
219
+ // When I login with admin
220
+ HeaderSteps.login();
221
+ LoginSteps.loginWithUser('admin', 'root');
222
+ cy.url().should('include', '/sparql');
223
+ // Then the cookie policy banner should be visible (because consent is saved on the server, but user has no changes persisted on server, so defaults are considered)
224
+ CookieConsentBannerSteps.getCookieConsentBanner().and('be.visible');
225
+ // When I click on the cookie policy link in the banner
226
+ CookieConsentBannerSteps.clickCookiePolicyLink();
227
+ // Then I see the cookie policy
228
+ CookiePolicyModalSteps.getDialogComponent().should('be.visible');
229
+ // And I expect to see that analytic cookies are allowed and third party cookies are allowed
230
+ CookiePolicyModalSteps.validateCookiePolicyDialog(false, true);
231
+ // When I toggle off third party cookies checkbox
232
+ CookiePolicyModalSteps.toggleThirdPartyCookies();
233
+ // And I close the modal
234
+ CookiePolicyModalSteps.closeDialog();
235
+ // When I reopen modal from the banner button
236
+ CookieConsentBannerSteps.clickCookiePolicyLink();
237
+ // Then I expect to see that analytic cookies are allowed and third party cookies are not allowed
238
+ CookiePolicyModalSteps.validateCookiePolicyDialog(false, false);
239
+ CookiePolicyModalSteps.closeDialog();
240
+ // When I logout
241
+ HeaderSteps.logout();
242
+ // And the cookie policy banner should be hidden (using browser data)
243
+ CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
244
+ // When I login with admin
245
+ HeaderSteps.login();
246
+ LoginSteps.loginWithUser('admin', 'root');
247
+ // Then the cookie policy banner should be visible (consent is persisted with the user on server)
248
+ CookieConsentBannerSteps.getCookieConsentBanner().should('be.visible');
249
+ // When I give cookie consent
250
+ CookieConsentBannerSteps.giveCookieConsent();
251
+ // Then the cookie policy banner should be hidden
252
+ CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
253
+ // When I reload the page
254
+ cy.reload();
255
+ // Then the cookie policy banner should be hidden
256
+ CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
257
+ });
258
+
33
259
  it('should show the consent popup if free access is on and the user is on the login page', () => {
34
260
  // Given: Security is enabled and free access is on
35
261
  UserAndAccessSteps.visitInProdMode();
@@ -44,7 +270,7 @@ describe('Cookie policy', () => {
44
270
  // When: The user visits the login page
45
271
  LoginSteps.visitInProdMode();
46
272
  // Then: The cookie policy popup should be shown
47
- HomeSteps.getCookieConsentPopup().should('exist').and('be.visible');
273
+ CookieConsentBannerSteps.getCookieConsentBanner().should('exist').and('be.visible');
48
274
  });
49
275
 
50
276
  it('should not show the consent popup if free access is off and the user is on the login page', () => {
@@ -57,8 +283,8 @@ describe('Cookie policy', () => {
57
283
  // When: The user logs out and visits the login page
58
284
  LoginSteps.logout();
59
285
  // Then: The cookie policy popup should not be shown
60
- HomeSteps.getCookieConsentPopup().should('not.exist');
286
+ CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
61
287
  LoginSteps.visitInProdMode();
62
- HomeSteps.getCookieConsentPopup().should('not.exist');
288
+ CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
63
289
  });
64
290
  });