Skip to content

Commit 6117d24

Browse files
committed
[frontend]e2e creation & delete & pageModels
1 parent 662c0b7 commit 6117d24

File tree

3 files changed

+45
-132
lines changed

3 files changed

+45
-132
lines changed

opencti-platform/opencti-front/src/private/components/settings/sso_definitions/SSODefinitions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ const SSODefinitions = () => {
320320
} as UsePreloadedPaginationFragment<SSODefinitionsLinesPaginationQuery>;
321321

322322
return (
323-
<div style={{ paddingRight: '200px' }} data-testid="sso-security-page">
323+
<div style={{ paddingRight: '200px' }} data-testid="authentication-page">
324324
<Breadcrumbs elements={[
325325
{ label: t_i18n('Settings') },
326326
{ label: t_i18n('Security') },

opencti-platform/opencti-front/tests_e2e/SSO/sso.spec.ts

Lines changed: 31 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -23,142 +23,45 @@ test('SSO definition CRUD', { tag: ['@sso', '@mutation', '@ee'] }, async ({ page
2323
// region Create SSO
2424
// -----------------
2525

26-
await ssoPage.getCreateButton().click();
27-
await ssoPage.getCreateSAML().click();
26+
await ssoPage.getCreateButton();
27+
28+
await ssoPage.getCreateSAML();
2829
await expect(ssoForm.getCreateTitle()).toBeVisible();
29-
// // Step 1
30+
// Step 1
3031
const ssoName = 'e2e SSO Authentication';
3132
await ssoForm.nameField.fill('');
3233
await expect(ssoForm.getCreateButton()).toBeDisabled();
3334
await ssoForm.nameField.fill(ssoName);
3435
await expect(ssoForm.getCreateButton()).toBeEnabled();
3536
await ssoForm.descriptionField.fill('DESCRIPTION test');
36-
await ssoForm.issuerField.fill('issuer test');
37-
await ssoForm.samlURLField.fill('issuer test');
37+
await ssoForm.issuerField.fill('openctisaml test');
38+
await ssoForm.samlURLField.fill('http://localhost:9999/realms/master/protocol/saml test');
3839
await ssoForm.idpCertField.fill('issuer test');
3940
await ssoForm.privateKeyField.selectOption('Set a new secret');
4041
await ssoForm.valuePKField.fill('MIIEpAIBAAKCAQEAoHLhB8sf4e3NbRayxNAQ1fhJIS4XqSsh20opCQIWyykBTPUedGHOB89JwTTw0KzX/uWr9nBWv+Hl9QtIZ9UgVlF4rlD0Au7/RqSTLPsiwidwMevJ7o1CteQu9mJpbbE2TXKSrT4kOr3Jthis89q3Ur11gdh6StMGlyL581C6aPIl8H0l5skKrrw0or02nphJDo68PjXRfOATrUHjlW28Auc9BEC1d8kk8p78s980DZMMNLZr1XrwLhu9LkkcOw2c5PHo16IisYAVzbupQJkQgUTshu8ivZ4vZ4ERDHpaL4ckpQFsJfK0QaEXIvaMH/POt6/M6StD8/4bHv4hfEm9QIDAQABAoIBAD5I+kRNPP42k1Vy');
41-
// // Step 2
42-
// await expect(ssoForm.getCreateButton()).toBeDisabled();
43-
// await ssoForm.locationsField.selectOption('France');
44-
// await expect(ssoForm.getCreateButton()).toBeEnabled();
45-
// await ssoForm.industriesField.selectOption('Agriculture');
46-
// await ssoForm.getCreateButton().click();
47-
//
48-
// await ssoPage.getItemFromList(ssoName).click();
49-
// await pirDetails.toggleDetails();
50-
// await expect(pirDetails.getTitle(pirName)).toBeVisible();
51-
// await expect(pirDetails.getDescription('e2e PIR description')).toBeVisible();
52-
//
53-
// // ---------
54-
// // endregion
55-
//
56-
// // region Navigate through tabs
57-
// // ----------------------------
58-
//
59-
// await pirDetails.tabs.goToThreatsTab();
60-
// await pirDetails.tabs.goToAnalysesTab();
61-
// await pirDetails.tabs.goToActivitiesTab();
62-
// await pirDetails.tabs.goToOverviewTab();
63-
//
64-
// // ---------
65-
// // endregion
66-
//
67-
// // region Create a relation that flags entity
68-
// // ------------------------------------------
69-
//
70-
// await expect(pirDetails.getEntityTypeCount('Malware')).toContainText('0');
71-
// await addRelationship(request, {
72-
// relationship_type: 'targets',
73-
// toId: 'location--5acd8b26-51c2-4608-86ed-e9edd43ad971',
74-
// fromId: 'malware--48534a79-a9d7-4c34-a292-f5f102d26dea',
75-
// createdBy: 'identity--7b82b010-b1c0-4dae-981f-7756374a17df',
76-
// });
77-
//
78-
// // ---------
79-
// // endregion
80-
//
81-
// // region Control tab Overview after flagging
82-
// // ------------------------------------------
83-
//
84-
// const waitForFlagging = async () => {
85-
// await pirPage.navigateFromMenu();
86-
// await pirPage.getItemFromList(pirName).click();
87-
// const text = await pirDetails.getEntityTypeCount('Malware').innerText();
88-
// return text === '1';
89-
// };
90-
// await awaitUntilCondition(waitForFlagging, 5000, 20);
91-
// await expect(pirDetails.getEntityTypeCount('Malware')).toContainText('1');
92-
// await expect(pirDetails.getTopAuthorEntities('John Doe')).toBeVisible();
93-
// await expect(pirDetails.getTopAuthorRelationships('ANSSI')).toBeVisible();
94-
//
95-
// const historyItemName = 'Malware E2E dashboard - Malware - month ago added to PIR';
96-
// const waitForHistory = async () => {
97-
// await pirPage.navigateFromMenu();
98-
// await pirPage.getItemFromList(pirName).click();
99-
// return pirDetails.getNewsFeedItem(historyItemName).isVisible();
100-
// };
101-
// await awaitUntilCondition(waitForHistory, 5000, 20);
102-
// await expect(pirDetails.getNewsFeedItem(historyItemName)).toBeVisible();
103-
//
104-
// // ---------
105-
// // endregion
106-
//
107-
// // region Control tab Threats after flagging
108-
// // -----------------------------------------
109-
//
110-
// await pirDetails.tabs.goToThreatsTab();
111-
// await expect(pirDetails.dataTable.container.getByText('E2E dashboard - Malware - month ago')).toBeVisible();
112-
// await expect(pirDetails.dataTable.container.getByText('50')).toBeVisible();
113-
//
114-
// // ---------
115-
// // endregion
116-
//
117-
// // region Control tab History after flagging
118-
// // -----------------------------------------
119-
//
120-
// await pirDetails.tabs.goToActivitiesTab();
121-
// await expect(pirDetails.dataTable.container.getByText(historyItemName)).toBeVisible();
122-
//
123-
// // ---------
124-
// // endregion
125-
//
126-
// // region Delete relation that flags entity
127-
// // ----------------------------------------
128-
//
129-
// await pirDetails.tabs.goToOverviewTab();
130-
// await expect(pirDetails.getEntityTypeCount('Malware')).toContainText('1');
131-
// await deleteRelationship(request, {
132-
// relationship_type: 'targets',
133-
// toId: 'location--5acd8b26-51c2-4608-86ed-e9edd43ad971',
134-
// fromId: 'malware--48534a79-a9d7-4c34-a292-f5f102d26dea',
135-
// });
136-
//
137-
// // ---------
138-
// // endregion
139-
//
140-
// // region Control tab Overview after unflagging
141-
// // --------------------------------------------
142-
//
143-
// const waitForUnflagging = async () => {
144-
// await pirPage.navigateFromMenu();
145-
// await pirPage.getItemFromList(pirName).click();
146-
// const text = await pirDetails.getEntityTypeCount('Malware').innerText();
147-
// return text === '0';
148-
// };
149-
// await awaitUntilCondition(waitForUnflagging, 5000, 20);
150-
// await expect(pirDetails.getEntityTypeCount('Malware')).toContainText('0');
151-
//
152-
// // ---------
153-
// // endregion
154-
//
155-
// // region Delete the report
156-
// // ------------------------
157-
//
158-
// await pirDetails.delete();
159-
// await pirPage.navigateFromMenu();
160-
// await expect(pirPage.getItemFromList(pirName)).toBeHidden();
161-
//
162-
// // ---------
163-
// // endregion
42+
// // Step 2
43+
// await ssoForm.locationsField.selectOption('France');
44+
// await expect(ssoForm.getCreateButton()).toBeEnabled();
45+
// await ssoForm.industriesField.selectOption('Agriculture');
46+
// await ssoForm.getCreateButton().click();
47+
//
48+
// await ssoPage.getItemFromList(ssoName).click();
49+
// await pirDetails.toggleDetails();
50+
// await expect(pirDetails.getTitle(pirName)).toBeVisible();
51+
// await expect(pirDetails.getDescription('e2e PIR description')).toBeVisible();
52+
//
53+
// // ---------
54+
await ssoForm.getCreateButton().click();
55+
await expect(ssoPage.getSAMLConfig());
56+
// endregion
57+
58+
// region Delete the report
59+
// ------------------------
60+
61+
await ssoPage.delete();
62+
63+
await expect(ssoPage.getItemFromList(ssoName)).toBeHidden();
64+
65+
// ---------
66+
// endregion
16467
});

opencti-platform/opencti-front/tests_e2e/model/sso.pageModel.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,28 @@ export default class SSOPage {
99
}
1010

1111
async navigateFromMenu() {
12-
return this.page.getByTestId('sso-security-page');
12+
return this.page.getByTestId('authentication-page');
1313
}
1414

1515
getCreateButton() {
16-
return this.page.getByRole('button', { name: 'Create authentication', exact: true });
16+
return this.page.getByRole('button', { name: 'Create Authentication', exact: true }).click();
1717
}
1818

1919
getCreateSAML() {
20-
return this.page.getByRole('button', { name: 'Create SAML', exact: true });
20+
return this.page.getByRole('menuitem', { name: 'Create SAML' }).click();
2121
}
2222

2323
getItemFromList(name: string) {
2424
return this.page.getByTestId(name);
2525
}
26+
27+
getSAMLConfig() {
28+
return this.page.getByText('e2e SSO Authentication');
29+
}
30+
31+
async delete() {
32+
await this.page.getByRole('button', { name: 'Update' }).click();
33+
await this.page.getByRole('menuitem', { name: 'Delete' }).click();
34+
return this.page.getByRole('dialog').getByRole('button', { name: 'Confirm' }).click();
35+
}
2636
}

0 commit comments

Comments
 (0)