-
Notifications
You must be signed in to change notification settings - Fork 946
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[frontend] Fix error message when attempting to create an artifact wi…
…thout file (#6052) Co-authored-by: Laurent Bonnet <146674147+labo-flg@users.noreply.github.com>
- Loading branch information
1 parent
3101813
commit c6c2622
Showing
6 changed files
with
69 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
opencti-platform/opencti-front/tests_e2e/artifact/createArtifact.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { ArtifactPage} from "../model/Artifact.pageModel"; | ||
import { ArtifactImportPage} from "../model/ArtifactImport.pageModel"; | ||
import { expect, test } from "../fixtures/baseFixtures"; | ||
|
||
|
||
test('Artifact error message in the absence of a file.', async ({ page }) => { | ||
const artifactPage = new ArtifactPage(page); | ||
const artifactImport = new ArtifactImportPage(page); | ||
await page.goto('/dashboard/observations/artifacts') | ||
await artifactPage.addNewArtifactImport().click(); | ||
artifactImport.getFileInput(); | ||
await artifactImport.getCreateArtifactImportButton().click(); | ||
await expect (artifactImport.getErrorMessage()).toBeVisible(); | ||
}) |
12 changes: 12 additions & 0 deletions
12
opencti-platform/opencti-front/tests_e2e/model/Artifact.pageModel.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Page } from "@playwright/test"; | ||
|
||
export class ArtifactPage { | ||
constructor(private page: Page) { | ||
} | ||
getPage() { | ||
return this.page.getByTestId('Artifact-page'); | ||
} | ||
addNewArtifactImport() { | ||
return this.page.getByLabel('Add', { exact: true }) | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
opencti-platform/opencti-front/tests_e2e/model/ArtifactImport.pageModel.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Page } from "@playwright/test"; | ||
|
||
export class ArtifactImportPage { | ||
constructor(private page: Page) { | ||
} | ||
getFileInput() { | ||
return this.page.getByLabel('file'); | ||
} | ||
getCreateArtifactImportButton() { | ||
return this.page.getByRole('button', { name: 'Create' }); | ||
} | ||
getErrorMessage() { | ||
return this.page.getByText('This field is required') | ||
} | ||
}; |