-
Notifications
You must be signed in to change notification settings - Fork 919
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[frontend] add eslint config to e2e tests
- Loading branch information
Showing
24 changed files
with
207 additions
and
189 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
25 changes: 12 additions & 13 deletions
25
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 |
---|---|---|
@@ -1,14 +1,13 @@ | ||
import { ArtifactPage} from "../model/Artifact.pageModel"; | ||
import { ArtifactImportPage} from "../model/ArtifactImport.pageModel"; | ||
import { expect, test } from "../fixtures/baseFixtures"; | ||
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(); | ||
}) | ||
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(); | ||
}); |
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
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
24 changes: 13 additions & 11 deletions
24
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 |
---|---|---|
@@ -1,12 +1,14 @@ | ||
import { Page } from "@playwright/test"; | ||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
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 }) | ||
} | ||
} | ||
export default class ArtifactPage { | ||
constructor(private page: Page) {} | ||
|
||
getPage() { | ||
return this.page.getByTestId('Artifact-page'); | ||
} | ||
|
||
addNewArtifactImport() { | ||
return this.page.getByLabel('Add', { exact: true }); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
opencti-platform/opencti-front/tests_e2e/model/ArtifactImport.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,18 @@ | ||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
import { Page } from '@playwright/test'; | ||
|
||
export default 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'); | ||
} | ||
} |
15 changes: 0 additions & 15 deletions
15
opencti-platform/opencti-front/tests_e2e/model/ArtifactImport.pageModel.tsx
This file was deleted.
Oops, something went wrong.
15 changes: 8 additions & 7 deletions
15
opencti-platform/opencti-front/tests_e2e/model/dashboard.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,9 +1,10 @@ | ||
import { Page } from "@playwright/test"; | ||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
import { Page } from '@playwright/test'; | ||
|
||
export class DashboardPage { | ||
constructor(private page: Page) { | ||
} | ||
getPage() { | ||
return this.page.getByTestId('dashboard-page'); | ||
} | ||
export default class DashboardPage { | ||
constructor(private page: Page) {} | ||
|
||
getPage() { | ||
return this.page.getByTestId('dashboard-page'); | ||
} | ||
} |
8 changes: 4 additions & 4 deletions
8
opencti-platform/opencti-front/tests_e2e/model/filters.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,14 +1,14 @@ | ||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
import { Page } from '@playwright/test'; | ||
|
||
export class FiltersUtils { | ||
constructor(private page: Page) { | ||
} | ||
export default class FiltersUtils { | ||
constructor(private page: Page) {} | ||
|
||
async addFilter(filterKey: string, filterLabel: string) { | ||
await this.page.getByLabel('Add filter').click(); | ||
await this.page.getByRole('option', { name: filterKey }).click(); | ||
await this.page.getByLabel(filterKey).click(); | ||
await this.page.getByLabel(filterLabel).getByRole('checkbox').check(); | ||
await this.page.locator('.MuiPopover-root > .MuiBackdrop-root').click(); | ||
} | ||
|
||
} |
71 changes: 38 additions & 33 deletions
71
opencti-platform/opencti-front/tests_e2e/model/login.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,34 +1,39 @@ | ||
import { Page } from "@playwright/test"; | ||
|
||
export class LoginPage { | ||
constructor(private page: Page) { | ||
} | ||
|
||
getPage() { | ||
return this.page.getByTestId('login-page'); | ||
} | ||
getLoginInput() { | ||
return this.page.getByLabel('Login') | ||
} | ||
async fillLoginInput(input: string) { | ||
await this.getLoginInput().click(); | ||
return this.getLoginInput().fill(input); | ||
} | ||
async fillPasswordInput(input: string) { | ||
await this.getPasswordInput().click(); | ||
return this.getPasswordInput().fill(input); | ||
} | ||
getPasswordInput() { | ||
return this.page.getByLabel('Password') | ||
} | ||
getSignInButton() { | ||
return this.page.getByRole('button', { name: 'Sign in' }) | ||
} | ||
|
||
async login() { | ||
await this.page.goto('/'); | ||
await this.fillLoginInput('[email protected]'); | ||
await this.fillPasswordInput('admin'); | ||
return this.getSignInButton().click(); | ||
} | ||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
import { Page } from '@playwright/test'; | ||
|
||
export default class LoginPage { | ||
constructor(private page: Page) {} | ||
|
||
getPage() { | ||
return this.page.getByTestId('login-page'); | ||
} | ||
|
||
getLoginInput() { | ||
return this.page.getByLabel('Login'); | ||
} | ||
|
||
async fillLoginInput(input: string) { | ||
await this.getLoginInput().click(); | ||
return this.getLoginInput().fill(input); | ||
} | ||
|
||
async fillPasswordInput(input: string) { | ||
await this.getPasswordInput().click(); | ||
return this.getPasswordInput().fill(input); | ||
} | ||
|
||
getPasswordInput() { | ||
return this.page.getByLabel('Password'); | ||
} | ||
|
||
getSignInButton() { | ||
return this.page.getByRole('button', { name: 'Sign in' }); | ||
} | ||
|
||
async login() { | ||
await this.page.goto('/'); | ||
await this.fillLoginInput('[email protected]'); | ||
await this.fillPasswordInput('admin'); | ||
return this.getSignInButton().click(); | ||
} | ||
} |
10 changes: 5 additions & 5 deletions
10
opencti-platform/opencti-front/tests_e2e/model/menu/leftBar.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
29 changes: 15 additions & 14 deletions
29
opencti-platform/opencti-front/tests_e2e/model/menu/topMenuProfile.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,18 +1,19 @@ | ||
import { Page } from "@playwright/test"; | ||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
import { Page } from '@playwright/test'; | ||
|
||
export class TopMenuProfilePage { | ||
constructor(private page:Page) { | ||
} | ||
export default class TopMenuProfilePage { | ||
constructor(private page:Page) {} | ||
|
||
getMenuProfile() { | ||
getMenuProfile() { | ||
return this.page.getByLabel('Profile'); | ||
} | ||
getLogoutButton() { | ||
return this.page.getByRole('menuitem', { name: 'Logout' }); | ||
} | ||
|
||
async logout() { | ||
await this.getMenuProfile().click(); | ||
return this.getLogoutButton().click(); | ||
} | ||
} | ||
|
||
getLogoutButton() { | ||
return this.page.getByRole('menuitem', { name: 'Logout' }); | ||
} | ||
|
||
async logout() { | ||
await this.getMenuProfile().click(); | ||
return this.getLogoutButton().click(); | ||
} | ||
} |
59 changes: 33 additions & 26 deletions
59
opencti-platform/opencti-front/tests_e2e/model/report.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,27 +1,34 @@ | ||
import { Page } from "@playwright/test"; | ||
|
||
export class ReportPage { | ||
constructor(private page: Page) { | ||
} | ||
getPage() { | ||
return this.page.getByTestId('report-page'); | ||
} | ||
goToPage() { | ||
return this.page.getByLabel('Analyses').click(); | ||
} | ||
addNewReport() { | ||
return this.page.getByLabel('Add', { exact: true }).click() | ||
} | ||
closeNewreport() { | ||
return this.page.getByLabel('Close', { exact: true }).click() | ||
} | ||
getReportNameInput() { | ||
return this.page.getByLabel('Name'); | ||
} | ||
getCreateReportButton() { | ||
return this.page.getByRole('button', { name: 'Create', exact: true }) | ||
} | ||
getItemFromList(name: string) { | ||
return this.page.getByRole('link', { name }).first() | ||
} | ||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
import { Page } from '@playwright/test'; | ||
|
||
export default class ReportPage { | ||
constructor(private page: Page) {} | ||
|
||
getPage() { | ||
return this.page.getByTestId('report-page'); | ||
} | ||
|
||
goToPage() { | ||
return this.page.getByLabel('Analyses').click(); | ||
} | ||
|
||
addNewReport() { | ||
return this.page.getByLabel('Add', { exact: true }).click(); | ||
} | ||
|
||
closeNewreport() { | ||
return this.page.getByLabel('Close', { exact: true }).click(); | ||
} | ||
|
||
getReportNameInput() { | ||
return this.page.getByLabel('Name'); | ||
} | ||
|
||
getCreateReportButton() { | ||
return this.page.getByRole('button', { name: 'Create', exact: true }); | ||
} | ||
|
||
getItemFromList(name: string) { | ||
return this.page.getByRole('link', { name }).first(); | ||
} | ||
} |
Oops, something went wrong.