-
-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MRG] Merge pull request #603 from dfir-iris/api_v2_regression_fixes
Api v2 regression fixes
- Loading branch information
Showing
28 changed files
with
1,053 additions
and
854 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import crypto from 'node:crypto'; | ||
|
||
test.beforeEach(async({ page }) => { | ||
await page.goto('/case/assets?cid=1'); | ||
}); | ||
|
||
test('should not be able to create an asset with the same type and value', async ({ page }) => { | ||
const assetValue = `Asset value - ${crypto.randomUUID()}`; | ||
|
||
await page.getByRole('button', { name: 'Add assets' }).click(); | ||
await page.getByRole('button', { name: 'None' }).click(); | ||
await page.getByRole('listbox').getByRole('option', { name: 'Account', exact: true }).click(); | ||
await page.getByPlaceholder('One asset per line').fill(assetValue); | ||
await page.getByRole('button', { name: 'Save' }).click(); | ||
|
||
await page.getByRole('button', { name: 'Add assets' }).click(); | ||
await page.getByRole('button', { name: 'None' }).click(); | ||
await page.getByRole('listbox').getByRole('option', { name: 'Account', exact: true }).click(); | ||
await page.getByPlaceholder('One asset per line').fill(assetValue); | ||
await page.getByRole('button', { name: 'Save' }).click(); | ||
|
||
await expect(page.getByText('Asset with same value and type already exists')).toBeVisible(); | ||
await expect(page.getByRole('button', { name: 'Save' })).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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { test as base } from '@playwright/test'; | ||
import fs from 'node:fs'; | ||
import dotenv from 'dotenv'; | ||
|
||
const _API_URL = 'http://127.0.0.1:8000'; | ||
|
||
export const test = base.extend({ | ||
rest: async ({ playwright }, use) => { | ||
// Set up the fixture. | ||
const envFile = fs.readFileSync('../.env'); | ||
const env = dotenv.parse(envFile); | ||
|
||
const apiContext = await playwright.request.newContext({ | ||
baseURL: _API_URL, | ||
extraHTTPHeaders: { | ||
'Authorization': `Bearer ${env.IRIS_ADM_API_KEY}`, | ||
'Content-Type': 'application/json' | ||
}, | ||
}); | ||
|
||
// Use the fixture value in the test. | ||
await use(apiContext); | ||
|
||
// Clean up the fixture. | ||
await apiContext.dispose(); | ||
}, | ||
}); |
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
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
Oops, something went wrong.