Skip to content

Commit

Permalink
[backend] wip test
Browse files Browse the repository at this point in the history
  • Loading branch information
lndrtrbn committed Apr 19, 2024
1 parent 1cd3741 commit 09d3a9e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default class SelectFieldPageModel {
this.page = page;
this.multiple = multiple;
this.inputLocator = this.page.getByRole('combobox', { name: label });
this.parentLocator = this.page.locator('div').filter({ has: this.inputLocator });
this.parentLocator = this.inputLocator.locator('..');
}

async selectOption(option: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ test('Create a new report', async ({ page }) => {
await expect(page.getByText('The value must be a datetime (yyyy-MM-dd hh:mm (a|p)m)')).toBeHidden();

// Report type
await reportForm.selectReportTypeOption('malware');
await expect(reportForm.getReportTypeOption('malware')).toBeVisible();
await reportForm.selectReportTypeOption('threat-report');
await expect(reportForm.getReportTypeOption('threat-report')).toBeVisible();
await reportForm.reportTypesSelect.selectOption('malware');
await expect(reportForm.reportTypesSelect.getOption('malware')).toBeVisible();
await reportForm.reportTypesSelect.selectOption('threat-report');
await expect(reportForm.reportTypesSelect.getOption('threat-report')).toBeVisible();

// Reliability
await reportForm.selectReliabilityOption('C - Fairly reliable');
await expect(reportForm.getReliabilityOption('C - Fairly reliable')).toBeVisible();
await reportForm.reliabilitySelect.selectOption('C - Fairly reliable');
await expect(reportForm.reliabilitySelect.getOption('C - Fairly reliable')).toBeVisible();

// Confidence level
await reportForm.confidenceLevelField.fillInput('75');
Expand All @@ -71,32 +71,28 @@ test('Create a new report', async ({ page }) => {
await expect(page.getByText('This is a Test e2e content')).toBeVisible();

// Assignees
await reportForm.selectAssigneesOption('admin');
await expect(reportForm.getAssigneesOption('admin')).toBeVisible();
await reportForm.assigneesSelect.selectOption('admin');
await expect(reportForm.assigneesSelect.getOption('admin')).toBeVisible();

// Participants
// await reportForm.selectParticipantsOption('admin');
// await expect(reportForm.getParticipantsOption('admin')).toBeVisible();
await reportForm.participantsSelect.selectOption('admin');
await expect(reportForm.participantsSelect.getOption('admin')).toBeVisible();

// Author
await reportForm.selectAuthorOption('Allied Universal');
await expect(reportForm.getAuthorOption('Allied Universal')).toBeVisible();
await reportForm.authorSelect.selectOption('Allied Universal');
await expect(reportForm.authorSelect.getOption('Allied Universal')).toBeVisible();

// Labels
await reportForm.selectLabelsOption('campaign');
await expect(reportForm.getLabelsOption('campaign')).toBeVisible();
await reportForm.selectLabelsOption('report');
await expect(reportForm.getLabelsOption('report')).toBeVisible();
await reportForm.labelsSelect.selectOption('campaign');
await expect(reportForm.labelsSelect.getOption('campaign')).toBeVisible();
await reportForm.labelsSelect.selectOption('report');
await expect(reportForm.labelsSelect.getOption('report')).toBeVisible();

// Markings
await reportForm.selectMarkingsOption('PAP:CLEAR');
await expect(reportForm.getMarkingsOption('PAP:CLEAR')).toBeVisible();
await reportForm.selectMarkingsOption('TLP:GREEN');
await expect(reportForm.getMarkingsOption('TLP:GREEN')).toBeVisible();

/* // External references type
await reportForm.selectExternalReferencesOption('malware');
await expect(reportForm.getExternalReferencesOption('malware')).toBeVisible(); */
await reportForm.markingsSelect.selectOption('PAP:CLEAR');
await expect(reportForm.markingsSelect.getOption('PAP:CLEAR')).toBeVisible();
await reportForm.markingsSelect.selectOption('TLP:GREEN');
await expect(reportForm.markingsSelect.getOption('TLP:GREEN')).toBeVisible();

// ---------
// endregion
Expand Down

0 comments on commit 09d3a9e

Please sign in to comment.