Skip to content

Commit

Permalink
[frontend] improve e2e tests (#6343)
Browse files Browse the repository at this point in the history
  • Loading branch information
SarahBocognano committed Mar 15, 2024
1 parent e536937 commit 249bff1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ const StixCoreRelationshipCreationFromEntity: FunctionComponent<StixCoreRelation

const renderSelectEntity = () => {
return (
<>
<div data-testid="stixCoreRelationshipCreationFromEntity-component">
<div className={classes.header}>
<IconButton
aria-label="Close"
Expand Down Expand Up @@ -678,7 +678,7 @@ const StixCoreRelationshipCreationFromEntity: FunctionComponent<StixCoreRelation
</Fab>
)}
</div>
</>
</div>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ import { expect, test } from '../fixtures/baseFixtures';
import IntrusionSetPage from '../model/intrusionSet.pageModel';
import IntrusionSetFormPage from '../model/intrusionSetForm.pageModel';
import IntrusionSetDetailsPage from '../model/intrusionSetDetails.pageModel';
import StixCoreRelationshipCreationFromEntityFormPage from '../model/stixCoreRelationshipCreationFromEntityForm.pageModel';

test('Create a new relationship in intrusion set knowledge', async ({ page }) => {
const intrusionSetPage = new IntrusionSetPage(page);
const intrusionSetForm = new IntrusionSetFormPage(page);
const intrusionSetDetailsPage = new IntrusionSetDetailsPage(page);
const stixCoreRelationshipCreationFromEntity = new StixCoreRelationshipCreationFromEntityFormPage(page);
await page.goto('/dashboard/threats/intrusion_sets');
await intrusionSetPage.addNewIntrusionSet();
await intrusionSetForm.fillNameInput('Test e2e');
Expand All @@ -16,5 +18,5 @@ test('Create a new relationship in intrusion set knowledge', async ({ page }) =>
await intrusionSetDetailsPage.getKnowledgeTab();
await intrusionSetDetailsPage.getVictimologyTab();
await intrusionSetDetailsPage.getCreateRelationshipButton().click();
await expect(intrusionSetDetailsPage.getStixCoreRelationshipCreationFromEntityComponent()).toBeVisible();
await expect(stixCoreRelationshipCreationFromEntity.getStixCoreRelationshipCreationFromEntityComponent()).toBeVisible();
});
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,4 @@ export default class IntrusionSetDetailsPage {
getCreateRelationshipButton() {
return this.page.getByLabel('Add', { exact: true });
}

getStixCoreRelationshipCreationFromEntityComponent() {
return this.page.getByRole('heading', { name: 'Create a relationship' });
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { Page } from '@playwright/test';

export default class StixCoreRelationshipCreationFromEntityFormPage {
constructor(private page: Page) {}

getStixCoreRelationshipCreationFromEntityComponent() {
return this.page.getByTestId('stixCoreRelationshipCreationFromEntity-component');
}
}

0 comments on commit 249bff1

Please sign in to comment.