graphdb-workbench-tests 3.4.0-dynamic-guides-test → 3.4.0-migrated-guide-services
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/e2e-legacy/guides/navigation/navigation-guide.spec.js +64 -0
- package/e2e-legacy/guides/ttyg/edit-agent/edit-ttyg-agent-guide.spec.js +1 -0
- package/e2e-legacy/guides/visual-graph/visual-graph-guide.spec.js +344 -122
- package/e2e-legacy/help/guides/guides-autostart.spec.js +36 -3
- package/e2e-legacy/help/guides/guides-confirm-cancel-dialog.js +83 -0
- package/e2e-legacy/home/cookie-policy/cookie-policy.spec.js +182 -0
- package/e2e-legacy/ttyg/chat-panel.spec.js +9 -0
- package/e2e-legacy/ttyg/clone-agent.spec.js +22 -0
- package/e2e-legacy/ttyg/edit-agent.spec.js +17 -0
- package/e2e-security/setup/home/cookie-policy.spec.js +232 -6
- package/e2e-security/setup/users-and-access/turn-on-security-and-password-change.spec.js +72 -59
- package/fixtures/guides/confirm-cancel-dialog/confirm-cancel-dialog-guide.json +15 -0
- package/fixtures/guides/navigation/navigation-guide.json +60 -0
- package/fixtures/guides/visual-graph/visual-graph-config-guide.json +39 -0
- package/fixtures/ttyg/chats/explain-response-1.json +2 -48
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/steps/cookie-policy/cookie-consent-banner-steps.js +21 -0
- package/steps/cookie-policy/cookie-policy-modal.steps.js +56 -0
- package/steps/guides/guide-dialog-steps.js +56 -2
- package/steps/header-steps.js +13 -0
- package/steps/home-steps.js +0 -20
- package/steps/login-steps.js +1 -0
- package/steps/main-menu-steps.js +1 -0
- package/steps/setup/settings-steps.js +1 -1
- package/steps/shared-modal-dialog-steps.js +45 -0
- package/steps/visual-graph-steps.js +57 -3
- package/stubs/guides/guides-stubs.js +8 -0
- package/stubs/repositories/repositories-stubs.js +22 -0
- package/stubs/security-stubs.js +4 -0
- package/stubs/sparql-stubs.js +10 -0
- package/support/e2e-security.js +1 -1
- package/support/settings-commands.js +18 -2
- package/e2e-legacy/home/cookie-policy.spec.js +0 -108
|
@@ -14,6 +14,39 @@ describe('Guides autostart', () => {
|
|
|
14
14
|
GuideSteps.assertPageNotInteractive();
|
|
15
15
|
GuideDialogSteps.assertDialogWithTitleIsVisible(`Welcome to`);
|
|
16
16
|
});
|
|
17
|
+
|
|
18
|
+
it('should not autostart the guide if it has been completed via autostart before', () => {
|
|
19
|
+
// Given, I visit the home page with autostart guide parameter in URL
|
|
20
|
+
GuideSteps.autostartGuide(guideName);
|
|
21
|
+
// Then, I should see the guide
|
|
22
|
+
GuideSteps.assertPageNotInteractive();
|
|
23
|
+
GuideDialogSteps.assertDialogWithTitleIsVisible(`Welcome to`);
|
|
24
|
+
|
|
25
|
+
// When, I finish the guide
|
|
26
|
+
GuideDialogSteps.clickOnNextButton();
|
|
27
|
+
GuideDialogSteps.clickOnNextButton();
|
|
28
|
+
// skip create repo
|
|
29
|
+
GuideDialogSteps.clickOnSkipButton();
|
|
30
|
+
// skip select repo
|
|
31
|
+
GuideDialogSteps.clickOnSkipButton();
|
|
32
|
+
// skip autocomplete
|
|
33
|
+
GuideDialogSteps.clickOnSkipButton();
|
|
34
|
+
// skip import
|
|
35
|
+
GuideDialogSteps.clickOnSkipButton();
|
|
36
|
+
// skip visual graph
|
|
37
|
+
GuideDialogSteps.clickOnSkipButton();
|
|
38
|
+
// skip sparql
|
|
39
|
+
GuideDialogSteps.clickOnSkipButton();
|
|
40
|
+
// close the dialog, completing the guide
|
|
41
|
+
GuideDialogSteps.clickOnCloseButton();
|
|
42
|
+
|
|
43
|
+
// Then, I should not see the guide anymore. A disabled flag should be set to true in the storage, when the
|
|
44
|
+
// guide is completed via autostart, preventing the guide from autostarting again.
|
|
45
|
+
GuideSteps.autostartGuide(guideName);
|
|
46
|
+
HomeSteps.getTutorialPanel().should('be.visible');
|
|
47
|
+
GuideSteps.getGuidesModal().should('not.exist');
|
|
48
|
+
GuideDialogSteps.getModalDialog().should('not.exist');
|
|
49
|
+
});
|
|
17
50
|
});
|
|
18
51
|
|
|
19
52
|
describe('With security enabled', () => {
|
|
@@ -26,7 +59,7 @@ describe('Guides autostart', () => {
|
|
|
26
59
|
cy.switchOffSecurity(true);
|
|
27
60
|
});
|
|
28
61
|
|
|
29
|
-
|
|
62
|
+
describe('admin', () => {
|
|
30
63
|
it('Should autostart guide with admin', () => {
|
|
31
64
|
// Given, I visit the home page with autostart guide parameter in URL
|
|
32
65
|
GuideSteps.autostartGuide(guideName);
|
|
@@ -38,7 +71,7 @@ describe('Guides autostart', () => {
|
|
|
38
71
|
});
|
|
39
72
|
});
|
|
40
73
|
|
|
41
|
-
|
|
74
|
+
describe('repo manager', () => {
|
|
42
75
|
beforeEach(() => {
|
|
43
76
|
cy.loginAsAdmin();
|
|
44
77
|
cy.createUser({
|
|
@@ -64,7 +97,7 @@ describe('Guides autostart', () => {
|
|
|
64
97
|
});
|
|
65
98
|
});
|
|
66
99
|
|
|
67
|
-
|
|
100
|
+
describe('user', () => {
|
|
68
101
|
beforeEach(() => {
|
|
69
102
|
cy.loginAsAdmin();
|
|
70
103
|
cy.createUser({
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import {GuideSteps} from "../../../steps/guides/guide-steps.js";
|
|
2
|
+
import {GuideDialogSteps} from "../../../steps/guides/guide-dialog-steps.js";
|
|
3
|
+
import {GuidesStubs} from "../../../stubs/guides/guides-stubs.js";
|
|
4
|
+
|
|
5
|
+
describe('Confirm cancel dialog', () => {
|
|
6
|
+
it('Should open confirm cancel dialog', () => {
|
|
7
|
+
GuidesStubs.stubWelcomGuide();
|
|
8
|
+
GuideSteps.visit();
|
|
9
|
+
GuideSteps.verifyGuidesListExists();
|
|
10
|
+
cy.wait('@getGuides');
|
|
11
|
+
|
|
12
|
+
// Given, I start a guide
|
|
13
|
+
GuideSteps.runFirstGuide();
|
|
14
|
+
GuideSteps.assertPageNotInteractive();
|
|
15
|
+
GuideDialogSteps.assertDialogWithTitleIsVisible(`Welcome to`);
|
|
16
|
+
|
|
17
|
+
// When, I try to cancel the guide
|
|
18
|
+
GuideDialogSteps.clickOnCancelButton();
|
|
19
|
+
|
|
20
|
+
// Then, I should see a confirm cancel dialog
|
|
21
|
+
GuideDialogSteps.getConfirmCancelDialog().should('be.visible');
|
|
22
|
+
GuideDialogSteps.getModalDialog().should('not.exist');
|
|
23
|
+
|
|
24
|
+
// When I press the cancel button
|
|
25
|
+
GuideDialogSteps.clickConfirmCancelDialogCancelButton();
|
|
26
|
+
|
|
27
|
+
// Then, I should see the guide dialog again as I didn't cancel it
|
|
28
|
+
GuideDialogSteps.getModalDialog().should('be.visible');
|
|
29
|
+
GuideDialogSteps.assertDialogWithTitleIsVisible(`Welcome to`);
|
|
30
|
+
|
|
31
|
+
// When I press the cancel dialog again
|
|
32
|
+
GuideDialogSteps.clickOnCancelButton();
|
|
33
|
+
GuideDialogSteps.getConfirmCancelDialog().should('be.visible');
|
|
34
|
+
GuideDialogSteps.getModalDialog().should('not.exist');
|
|
35
|
+
|
|
36
|
+
// And click on the close (X) icon button
|
|
37
|
+
GuideDialogSteps.clickOnConfirmCancelDialogCloseButton();
|
|
38
|
+
|
|
39
|
+
// Then, I should see the guide again as I didn't cancel it
|
|
40
|
+
GuideDialogSteps.getModalDialog().should('be.visible');
|
|
41
|
+
GuideDialogSteps.assertDialogWithTitleIsVisible(`Welcome to`);
|
|
42
|
+
|
|
43
|
+
// When I try to cancel it a third time
|
|
44
|
+
GuideDialogSteps.clickOnCancelButton();
|
|
45
|
+
GuideDialogSteps.getConfirmCancelDialog().should('be.visible');
|
|
46
|
+
GuideDialogSteps.getModalDialog().should('not.exist');
|
|
47
|
+
|
|
48
|
+
// And click on exit
|
|
49
|
+
GuideDialogSteps.clickConfirmCancelDialogExitButton();
|
|
50
|
+
|
|
51
|
+
// Then, I should see the guides list and no active guide as I canceled it
|
|
52
|
+
GuideDialogSteps.getModalDialog().should('not.exist');
|
|
53
|
+
GuideDialogSteps.getConfirmCancelDialog().should('not.exist');
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('Should disable autostart when don\'t show again is pressed', () => {
|
|
57
|
+
const guideName = 'star-wars';
|
|
58
|
+
// Given, I visit the home page with autostart guide parameter in URL
|
|
59
|
+
GuideSteps.autostartGuide(guideName);
|
|
60
|
+
// Then, I should see the guide
|
|
61
|
+
GuideSteps.assertPageNotInteractive();
|
|
62
|
+
GuideDialogSteps.assertDialogWithTitleIsVisible(`Welcome to`);
|
|
63
|
+
|
|
64
|
+
// When I try to cancel the dialog
|
|
65
|
+
GuideDialogSteps.clickOnCancelButton();
|
|
66
|
+
|
|
67
|
+
// Then, I should see a confirm cancel dialog with "Don't show again" button
|
|
68
|
+
GuideDialogSteps.getConfirmCancelDialog().should('be.visible');
|
|
69
|
+
GuideDialogSteps.getConfirmCancelDialogDontShowAgainButton().should('be.visible');
|
|
70
|
+
|
|
71
|
+
// When I click on the "don't show again" button
|
|
72
|
+
GuideDialogSteps.clickConfirmCancelDialogDontShowAgainButton();
|
|
73
|
+
|
|
74
|
+
// Then, the confirm cancel dialog should be closed and the guide should be canceled
|
|
75
|
+
GuideDialogSteps.getConfirmCancelDialog().should('not.exist');
|
|
76
|
+
|
|
77
|
+
// When I try to autostart it again
|
|
78
|
+
GuideSteps.autostartGuide(guideName);
|
|
79
|
+
// Then, I should not see the guide anymore. A disabled flag should be set to true in the storage,
|
|
80
|
+
// when the guide is completed via autostart, preventing the guide from autostarting again.
|
|
81
|
+
GuideDialogSteps.getModalDialog().should('not.exist');
|
|
82
|
+
});
|
|
83
|
+
});
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import HomeSteps from '../../../steps/home-steps';
|
|
2
|
+
import {SecurityStubs} from '../../../stubs/security-stubs';
|
|
3
|
+
import {SettingsSteps} from '../../../steps/setup/settings-steps';
|
|
4
|
+
import {LicenseStubs} from '../../../stubs/license-stubs';
|
|
5
|
+
import {CookiePolicyModalSteps} from '../../../steps/cookie-policy/cookie-policy-modal.steps';
|
|
6
|
+
import {MainMenuSteps} from '../../../steps/main-menu-steps.js';
|
|
7
|
+
import {CookieConsentBannerSteps} from '../../../steps/cookie-policy/cookie-consent-banner-steps.js';
|
|
8
|
+
|
|
9
|
+
Cypress.env('set_default_user_data', false);
|
|
10
|
+
|
|
11
|
+
describe('Cookie policy', () => {
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
cy.setCookieConsent(undefined);
|
|
14
|
+
cy.viewport(1280, 1000);
|
|
15
|
+
LicenseStubs.stubFreeLicense();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
afterEach(() => {
|
|
19
|
+
cy.setCookieConsent(undefined);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should have default state when security is OFF', () => {
|
|
23
|
+
// Given GDB security is OFF
|
|
24
|
+
// When I open home page
|
|
25
|
+
HomeSteps.visitInProdMode();
|
|
26
|
+
// Then I expect to see cookie consent banner
|
|
27
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('be.visible');
|
|
28
|
+
// When I click on the cookie policy link in the banner
|
|
29
|
+
CookieConsentBannerSteps.clickCookiePolicyLink();
|
|
30
|
+
// Then I see the cookie policy
|
|
31
|
+
CookiePolicyModalSteps.getDialogComponent().and('be.visible');
|
|
32
|
+
CookiePolicyModalSteps.getBody().should('be.visible');
|
|
33
|
+
// And I expect to see that analytic and third party cookies are allowed
|
|
34
|
+
CookiePolicyModalSteps.validateCookiePolicyDialog(true, true);
|
|
35
|
+
// When I close the cookie policy modal
|
|
36
|
+
CookiePolicyModalSteps.closeDialog();
|
|
37
|
+
// Then I expect the cookie policy modal to be closed
|
|
38
|
+
CookiePolicyModalSteps.getDialogComponent().should('not.exist');
|
|
39
|
+
// When I open my settings page
|
|
40
|
+
SettingsSteps.visitInProdMode();
|
|
41
|
+
// Then I expect to see cookie policy button in My settings widget
|
|
42
|
+
SettingsSteps.getCookiePolicyButton().and('be.visible');
|
|
43
|
+
// When I click on the cookie policy button in My settings widget
|
|
44
|
+
SettingsSteps.clickCookiePolicyLink();
|
|
45
|
+
// Then I see the cookie policy
|
|
46
|
+
CookiePolicyModalSteps.getDialogComponent().and('be.visible');
|
|
47
|
+
CookiePolicyModalSteps.getBody().should('be.visible');
|
|
48
|
+
// And I expect to see that analytic and third party cookies are allowed
|
|
49
|
+
CookiePolicyModalSteps.validateCookiePolicyDialog(true, true);
|
|
50
|
+
// When I close the cookie policy modal
|
|
51
|
+
CookiePolicyModalSteps.closeDialog();
|
|
52
|
+
// Then I expect the cookie policy modal to be closed
|
|
53
|
+
CookiePolicyModalSteps.getDialogComponent().should('not.exist');
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('should give consent for default cookie policy when security is OFF', () => {
|
|
57
|
+
// Given GDB security is OFF
|
|
58
|
+
// When I open home page
|
|
59
|
+
HomeSteps.visitInProdMode();
|
|
60
|
+
// Then I expect to see cookie consent banner
|
|
61
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('be.visible');
|
|
62
|
+
// When I click OK in the cookie consent banner
|
|
63
|
+
SecurityStubs.spyOnUserUpdate('admin');
|
|
64
|
+
CookieConsentBannerSteps.giveCookieConsent();
|
|
65
|
+
// Then I expect to save cookie consent in user settings
|
|
66
|
+
validateUserUpdateWithCookieConsent();
|
|
67
|
+
// And I expect the banner to be hidden
|
|
68
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
|
|
69
|
+
// And I expect GA tracking script to be added to the head
|
|
70
|
+
validateGATracking();
|
|
71
|
+
// When I open another page
|
|
72
|
+
MainMenuSteps.clickOnMenuImport();
|
|
73
|
+
cy.url().should('include', '/import');
|
|
74
|
+
// Then I expect the banner to be hidden
|
|
75
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
|
|
76
|
+
// When I reload the page
|
|
77
|
+
cy.reload();
|
|
78
|
+
// Then I expect the banner to be hidden
|
|
79
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('should update cookie policy and give consent when security is OFF', () => {
|
|
83
|
+
// Given GDB security is OFF
|
|
84
|
+
// When I open home page
|
|
85
|
+
HomeSteps.visitInProdMode();
|
|
86
|
+
// Then I expect to see cookie consent banner
|
|
87
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('be.visible');
|
|
88
|
+
// When I click on the cookie policy link in the banner
|
|
89
|
+
CookieConsentBannerSteps.clickCookiePolicyLink();
|
|
90
|
+
// Then I see the cookie policy
|
|
91
|
+
CookiePolicyModalSteps.getDialogComponent().should('be.visible');
|
|
92
|
+
CookiePolicyModalSteps.validateCookiePolicyDialog(true, true);
|
|
93
|
+
// When I toggle off the analytics cookie checkbox
|
|
94
|
+
CookiePolicyModalSteps.toggleStatisticCookies();
|
|
95
|
+
// And I close the dialog
|
|
96
|
+
CookiePolicyModalSteps.closeDialog();
|
|
97
|
+
CookiePolicyModalSteps.getDialog().should('not.exist');
|
|
98
|
+
// When I reopen the cookie policy dialog using the button in the banner
|
|
99
|
+
CookieConsentBannerSteps.clickCookiePolicyLink();
|
|
100
|
+
// And I expect to see that analytic cookies are not allowed and third party cookies are allowed
|
|
101
|
+
CookiePolicyModalSteps.validateCookiePolicyDialog(false, true);
|
|
102
|
+
// When I close the cookie policy dialog
|
|
103
|
+
CookiePolicyModalSteps.closeDialog();
|
|
104
|
+
// And I open my settings page
|
|
105
|
+
MainMenuSteps.clickOnMySettings();
|
|
106
|
+
// Then I expect to see cookie policy button in My settings widget
|
|
107
|
+
SettingsSteps.getCookiePolicyButton().and('be.visible');
|
|
108
|
+
// When I click on the cookie policy button in My settings widget
|
|
109
|
+
SettingsSteps.clickCookiePolicyLink();
|
|
110
|
+
// Then I see the cookie policy
|
|
111
|
+
CookiePolicyModalSteps.getDialogComponent().should('be.visible');
|
|
112
|
+
// And I expect to see that analytic cookies are not allowed and third party cookies are allowed
|
|
113
|
+
CookiePolicyModalSteps.validateCookiePolicyDialog(false, true);
|
|
114
|
+
// When I toggle off the third party cookies checkbox
|
|
115
|
+
CookiePolicyModalSteps.toggleThirdPartyCookies();
|
|
116
|
+
// And I close the cookie policy dialog
|
|
117
|
+
CookiePolicyModalSteps.closeDialog();
|
|
118
|
+
// When I reopen the cookie policy dialog using the button in my settings widget
|
|
119
|
+
SettingsSteps.clickCookiePolicyLink();
|
|
120
|
+
// And I expect to see that analytic cookies are not allowed and third party cookies are not allowed
|
|
121
|
+
CookiePolicyModalSteps.validateCookiePolicyDialog(false, false);
|
|
122
|
+
CookiePolicyModalSteps.closeDialog();
|
|
123
|
+
// When I reload the page
|
|
124
|
+
cy.reload();
|
|
125
|
+
// And I reopen the cookie policy dialog using the button in my settings widget
|
|
126
|
+
SettingsSteps.clickCookiePolicyLink();
|
|
127
|
+
// And I expect to see that analytic cookies are not allowed and third party cookies are not allowed
|
|
128
|
+
CookiePolicyModalSteps.validateCookiePolicyDialog(false, false);
|
|
129
|
+
// When I close the cookie policy dialog
|
|
130
|
+
CookiePolicyModalSteps.closeDialog();
|
|
131
|
+
// And I click OK in the cookie consent banner
|
|
132
|
+
CookieConsentBannerSteps.giveCookieConsent();
|
|
133
|
+
// Then I expect the banner to be hidden
|
|
134
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
|
|
135
|
+
// When I reload the page
|
|
136
|
+
cy.reload();
|
|
137
|
+
// Then I expect the banner to be hidden
|
|
138
|
+
CookieConsentBannerSteps.getCookieConsentBanner().should('not.exist');
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
function validateUserUpdateWithCookieConsent() {
|
|
143
|
+
cy.wait('@updateUser').then((xhr) => {
|
|
144
|
+
expect(xhr.request.body.appSettings).to.include({
|
|
145
|
+
DEFAULT_INFERENCE: true,
|
|
146
|
+
DEFAULT_VIS_GRAPH_SCHEMA: true,
|
|
147
|
+
DEFAULT_SAMEAS: true,
|
|
148
|
+
IGNORE_SHARED_QUERIES: false,
|
|
149
|
+
EXECUTE_COUNT: true
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
// Assert COOKIE_CONSENT properties, excluding updatedAt
|
|
153
|
+
expect(xhr.request.body.appSettings.COOKIE_CONSENT).to.include({
|
|
154
|
+
policyAccepted: true
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
// Assert that updatedAt is present, is a number, and is a reasonable timestamp
|
|
158
|
+
const updatedAt = xhr.request.body.appSettings.COOKIE_CONSENT.updatedAt;
|
|
159
|
+
expect(updatedAt).to.exist;
|
|
160
|
+
expect(updatedAt).to.be.a('number');
|
|
161
|
+
|
|
162
|
+
// Check that updatedAt is within 1 hour of the current time
|
|
163
|
+
const oneHourInMilliseconds = 60 * 60 * 1000;
|
|
164
|
+
const now = Date.now();
|
|
165
|
+
expect(updatedAt).to.be.within(now - oneHourInMilliseconds, now + oneHourInMilliseconds);
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function validateGATracking() {
|
|
170
|
+
// Check if the GA tracking script is set correctly in the head
|
|
171
|
+
cy.document()
|
|
172
|
+
.get('head script')
|
|
173
|
+
.should("have.attr", "src")
|
|
174
|
+
.should('include', 'https://www.googletagmanager.com/gtm.js?id=GTM-WBP6C6Z4');
|
|
175
|
+
|
|
176
|
+
// Check if the installation ID cookie is set correctly
|
|
177
|
+
cy.getCookie('_wb').then((cookie) => {
|
|
178
|
+
expect(cookie).to.exist;
|
|
179
|
+
// Check the cookie structure: WB1.<installationId>.<timestamp>
|
|
180
|
+
expect(cookie.value).to.match(/^WB1\.[a-zA-Z0-9\-]+\.\d+$/);
|
|
181
|
+
});
|
|
182
|
+
}
|
|
@@ -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');
|