-
Notifications
You must be signed in to change notification settings - Fork 799
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
304 additions
and
158 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
7 changes: 5 additions & 2 deletions
7
opencti-platform/opencti-front/tests_e2e/model/field/ConfidenceField.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
31 changes: 31 additions & 0 deletions
31
opencti-platform/opencti-front/tests_e2e/model/field/DateField.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,31 @@ | ||
import { Locator, Page } from '@playwright/test'; | ||
|
||
export default class DateFieldPageModel { | ||
private readonly inputLocator: Locator; | ||
|
||
constructor( | ||
private readonly page: Page, | ||
label: string, | ||
) { | ||
this.inputLocator = this.page.getByLabel(label); | ||
} | ||
|
||
getInput() { | ||
return this.inputLocator; | ||
} | ||
|
||
value() { | ||
return this.inputLocator.inputValue(); | ||
} | ||
|
||
async clear() { | ||
await this.inputLocator.click(); | ||
await this.page.keyboard.press('Control+A'); | ||
return this.page.keyboard.press('Backspace'); | ||
} | ||
|
||
async fill(input: string) { | ||
await this.inputLocator.click(); | ||
return this.page.keyboard.type(input); | ||
} | ||
} |
24 changes: 8 additions & 16 deletions
24
opencti-platform/opencti-front/tests_e2e/model/field/SelectField.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
41 changes: 41 additions & 0 deletions
41
opencti-platform/opencti-front/tests_e2e/model/field/TextField.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,41 @@ | ||
import { Locator, Page } from '@playwright/test'; | ||
|
||
type TextFieldPageModelType = 'text' | 'text-area' | 'rich-content'; | ||
|
||
export default class TextFieldPageModel { | ||
private readonly inputLocator: Locator; | ||
|
||
constructor( | ||
private readonly page: Page, | ||
label: string, | ||
type: TextFieldPageModelType = 'text', | ||
) { | ||
if (type === 'text-area') { | ||
const parent = this.page.getByText(label).locator('..'); | ||
this.inputLocator = parent.getByTestId('text-area'); | ||
} else if (type === 'rich-content') { | ||
const parent = this.page.getByText(label).locator('..'); | ||
this.inputLocator = parent.getByLabel('Editor editing area: main'); | ||
} else { | ||
this.inputLocator = this.page.getByLabel(label); | ||
} | ||
} | ||
|
||
get() { | ||
return this.inputLocator; | ||
} | ||
|
||
value() { | ||
return this.inputLocator.inputValue(); | ||
} | ||
|
||
async clear() { | ||
await this.inputLocator.clear(); | ||
} | ||
|
||
async fill(input: string, clear = true) { | ||
await this.inputLocator.click(); | ||
if (clear) await this.clear(); | ||
return this.inputLocator.fill(input); | ||
} | ||
} |
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
98 changes: 22 additions & 76 deletions
98
opencti-platform/opencti-front/tests_e2e/model/reportForm.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 |
---|---|---|
@@ -1,95 +1,41 @@ | ||
import { Page } from '@playwright/test'; | ||
import SelectFieldPageModel from './field/SelectField.pageModel'; | ||
import ConfidenceFieldPageModel from './field/ConfidenceField.pageModel'; | ||
import DateFieldPageModel from './field/DateField.pageModel'; | ||
import TextFieldPageModel from './field/TextField.pageModel'; | ||
|
||
export default class ReportFormPage { | ||
reportTypesSelect = new SelectFieldPageModel('Report types', { | ||
page: this.page, | ||
}); | ||
nameField = new TextFieldPageModel(this.page, 'Name'); | ||
contentField = new TextFieldPageModel(this.page, 'Content', 'rich-content'); | ||
descriptionField = new TextFieldPageModel(this.page, 'Description', 'text-area'); | ||
|
||
reliabilitySelect = new SelectFieldPageModel('Reliability', { | ||
page: this.page, | ||
multiple: false, | ||
}); | ||
confidenceLevelField = new ConfidenceFieldPageModel(this.page, 'Confidence level'); | ||
|
||
assigneesSelect = new SelectFieldPageModel('Assignee(s)', { | ||
page: this.page, | ||
multiple: true, | ||
}); | ||
publicationDateField = new DateFieldPageModel(this.page, 'Publication date'); | ||
|
||
participantsSelect = new SelectFieldPageModel('Participant(s)', { | ||
page: this.page, | ||
multiple: true, | ||
}); | ||
|
||
authorSelect = new SelectFieldPageModel('Author', { | ||
page: this.page, | ||
multiple: false, | ||
}); | ||
|
||
labelsSelect = new SelectFieldPageModel('Labels', { | ||
page: this.page, | ||
multiple: true, | ||
}); | ||
|
||
markingsSelect = new SelectFieldPageModel('Markings', { | ||
page: this.page, | ||
multiple: true, | ||
}); | ||
|
||
externalReferencesSelect = new SelectFieldPageModel('External references', { | ||
page: this.page, | ||
multiple: true, | ||
}); | ||
|
||
confidenceLevelField = new ConfidenceFieldPageModel('Confidence level', this.page); | ||
labelsSelect = new SelectFieldPageModel(this.page, 'Labels'); | ||
markingsSelect = new SelectFieldPageModel(this.page, 'Markings'); | ||
authorSelect = new SelectFieldPageModel(this.page, 'Author', false); | ||
assigneesSelect = new SelectFieldPageModel(this.page, 'Assignee(s)'); | ||
reportTypesSelect = new SelectFieldPageModel(this.page, 'Report types'); | ||
participantsSelect = new SelectFieldPageModel(this.page, 'Participant(s)'); | ||
reliabilitySelect = new SelectFieldPageModel(this.page, 'Reliability', false); | ||
|
||
constructor(private page: Page) {} | ||
|
||
getNameInput() { | ||
return this.page.getByLabel('Name'); | ||
} | ||
|
||
getPublicationDateInput() { | ||
return this.page.getByLabel('Publication date'); | ||
} | ||
|
||
getDescriptionInput() { | ||
return this.page.getByTestId('text-area'); | ||
} | ||
|
||
getContentInput() { | ||
return this.page.getByLabel('Editor editing area: main'); | ||
getTitle() { | ||
return this.page.getByRole('heading', { name: 'Create a report' }); | ||
} | ||
|
||
async fillNameInput(input: string) { | ||
await this.getNameInput().click(); | ||
return this.getNameInput().fill(input); | ||
} | ||
|
||
async clearPublicationDateInput() { | ||
await this.getPublicationDateInput().click(); | ||
await this.page.keyboard.press('Control+A'); | ||
return this.page.keyboard.press('Backspace'); | ||
} | ||
|
||
async fillPublicationDateInput(input: string) { | ||
await this.getPublicationDateInput().click(); | ||
return this.page.keyboard.type(input); | ||
} | ||
|
||
async fillDescriptionInput(input: string) { | ||
await this.getDescriptionInput().click(); | ||
return this.getDescriptionInput().fill(input); | ||
} | ||
|
||
async fillContentInput(input: string) { | ||
await this.getContentInput().click(); | ||
await this.getContentInput().clear(); | ||
return this.getContentInput().fill(input); | ||
getCreateButton() { | ||
return this.page.getByRole('button', { name: 'Create', exact: true }); | ||
} | ||
|
||
getCloseButton() { | ||
return this.page.getByRole('button', { name: 'Close' }); | ||
} | ||
|
||
getCancelButton() { | ||
return this.page.getByRole('button', { name: 'Cancel' }); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
opencti-platform/opencti-front/tests_e2e/report/assets/report.test.html
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,10 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Test report e2e</title> | ||
</head> | ||
<body> | ||
<h1>Test Report e2e</h1> | ||
</body> | ||
</html> |
1 change: 1 addition & 0 deletions
1
opencti-platform/opencti-front/tests_e2e/report/assets/report.test.md
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 @@ | ||
# Test report e2e |
Binary file added
BIN
+19.1 KB
opencti-platform/opencti-front/tests_e2e/report/assets/report.test.pdf
Binary file not shown.
1 change: 1 addition & 0 deletions
1
opencti-platform/opencti-front/tests_e2e/report/assets/report.test.txt
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 @@ | ||
Test report e2e |
Oops, something went wrong.