-
Notifications
You must be signed in to change notification settings - Fork 39
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
1 parent
7d7f779
commit fa3ccf3
Showing
15 changed files
with
167 additions
and
12,423 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,5 @@ stats.json | |
/blob-report/ | ||
/playwright/.cache/ | ||
/playwright/.auth/ | ||
package-lock.json | ||
tests/playwright |
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 |
---|---|---|
@@ -1,15 +1,4 @@ | ||
{ | ||
"cookies": [ | ||
{ | ||
"name": "otoroshi-session", | ||
"value": "eyJhbGciOiJIUzI1NiJ9.eyJkYXRhIjp7ImJvdXNyIjoiTnRuN3U0ZzVkT0lMQ3V0T0dZN0xiQmVZZnhZMG1MeDQ5dUNMUGFjS3ZKdFRpVmF3OXpEdDU1cUxMU2g0Y255MiJ9LCJleHAiOjE3MzQzNjA2MjAsIm5iZiI6MTczNDEwMTQyMCwiaWF0IjoxNzM0MTAxNDIwfQ.zNLQdWjxCpAconS36kmiOKdJ9pP4E3X8fQawctv5Nog", | ||
"domain": ".oto.tools", | ||
"path": "/", | ||
"expires": 1734360620.163286, | ||
"httpOnly": true, | ||
"secure": false, | ||
"sameSite": "Lax" | ||
} | ||
], | ||
"cookies": [], | ||
"origins": [] | ||
} |
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 |
---|---|---|
@@ -1,13 +1,28 @@ | ||
import { test as setup, expect } from '@playwright/test'; | ||
import path from 'path'; | ||
|
||
const authFile = path.join(__dirname, '../playwright/.auth/user.json'); | ||
const userAuthFile = path.join(__dirname, '../playwright/.auth/user.json'); | ||
const adminAuthFile = path.join(__dirname, '../playwright/.auth/admin.json'); | ||
|
||
setup('authenticate', async ({ page }) => { | ||
// Perform authentication steps. Replace these actions with your own. | ||
await page.goto('/'); | ||
await page.getByRole('button', { name: 'Login', exact: true }).click(); | ||
await page.locator('input[name="email"]').click(); | ||
await page.locator('input[name="email"]').fill('[email protected]'); | ||
await page.locator('input[name="email"]').press('Tab'); | ||
await page.locator('input[name="password"]').fill('password'); | ||
await page.getByRole('button', { name: 'Login' }).click(); | ||
|
||
await page.waitForURL('/bo/dashboard'); | ||
|
||
await expect(page.locator('#content-scroll-container img')).toBeVisible(); | ||
|
||
await page.context().storageState({ path: userAuthFile }); | ||
|
||
// await page.goto('/backoffice/auth0/logout'); | ||
await page.goto('/bo/simple/login'); | ||
await page.getByRole('button', { name: 'Login', exact: true }).click(); | ||
await page.locator('input[name="email"]').click(); | ||
await page.locator('input[name="email"]').fill('[email protected]'); | ||
await page.locator('input[name="email"]').press('Tab'); | ||
await page.locator('input[name="password"]').fill('password'); | ||
|
@@ -17,5 +32,5 @@ setup('authenticate', async ({ page }) => { | |
|
||
await expect(page.locator('#content-scroll-container img')).toBeVisible(); | ||
|
||
await page.context().storageState({ path: authFile }); | ||
await page.context().storageState({ path: adminAuthFile }); | ||
}); |
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,38 @@ | ||
const { test, expect, describe } = require('@playwright/test'); | ||
const { SECTIONS } = require('../../utils'); | ||
|
||
|
||
let context; | ||
|
||
test.beforeAll(async ({ browser }) => { | ||
context = await browser.newContext({ storageState: 'tests/playwright/.auth/admin.json' }); | ||
}); | ||
|
||
test.afterAll(async () => { | ||
await context.close(); | ||
}); | ||
|
||
async function showTableOfEntity(section, tab, expected) { | ||
const page = await context.newPage(); | ||
await page.goto('/'); | ||
|
||
await page.getByText(section).click(); | ||
await page | ||
.locator(`div[title^="${tab}"]`).click(); | ||
|
||
await expect(page.locator('#content-scroll-container')).toContainText(expected ? expected : tab); | ||
} | ||
|
||
test('Show Cluster members', async () => showTableOfEntity(SECTIONS.NETWORKING, 'Cluster members', undefined, { admin: true })); | ||
test('Show Connected tunnels', async () => showTableOfEntity(SECTIONS.NETWORKING, 'Connected tunnels')); | ||
test('Show Eureka servers', async () => showTableOfEntity(SECTIONS.NETWORKING, 'Eureka servers')); | ||
|
||
test('Show Resources loader', async () => showTableOfEntity(SECTIONS.TOOLING, 'Resources loader')); | ||
|
||
test('Show Danger zone', async () => showTableOfEntity(SECTIONS.CONFIGURATION, 'Danger zone')); | ||
|
||
test('Show Alerts log', async () => showTableOfEntity(SECTIONS.ANALYTICS, 'Alerts log')); | ||
test('Show Analytics', async () => showTableOfEntity(SECTIONS.ANALYTICS, 'Analytics')); | ||
test('Show Audit log', async () => showTableOfEntity(SECTIONS.ANALYTICS, 'Audit log')); | ||
test('Show Events log', async () => showTableOfEntity(SECTIONS.ANALYTICS, 'Events log')); | ||
test('Show Global Status', async () => showTableOfEntity(SECTIONS.ANALYTICS, 'Global Status', 'Global status')); |
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,23 @@ | ||
const { test, expect } = require('@playwright/test'); | ||
|
||
let context; | ||
|
||
test.beforeAll(async ({ browser }) => { | ||
context = await browser.newContext({ storageState: 'tests/playwright/.auth/admin.json' }); | ||
}); | ||
|
||
test.afterAll(async () => { | ||
await context.close(); | ||
}); | ||
|
||
test('access to the admin api', async () => { | ||
const page = await context.newPage() | ||
await page.goto('/'); | ||
|
||
await page.locator('#navbar').click(); | ||
|
||
await page.locator('#react-select-2-input').fill(' admin'); | ||
await page.getByText('rout.otoroshi-admin-api').click(); | ||
|
||
expect(page).toHaveURL('/bo/dashboard/routes/admin-api-service?tab=flow'); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,16 @@ | ||
const { test, expect } = require('@playwright/test'); | ||
|
||
test('search bar must return entity', async ({ browser }) => { | ||
const context = await browser.newContext({ storageState: 'tests/playwright/.auth/user.json' }); | ||
const page = await context.newPage(); | ||
|
||
await page.goto('/'); | ||
await page.locator('#navbar').click(); | ||
|
||
await page.locator('#react-select-2-input').fill(' routes'); | ||
await page.locator('#react-select-2-option-0').getByText('Routes').click(); | ||
|
||
expect(page).toHaveURL(/bo\/dashboard\/routes/); | ||
|
||
await context.close() | ||
}); |
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,39 @@ | ||
const { test, expect, describe } = require('@playwright/test'); | ||
const { SECTIONS } = require('../../utils'); | ||
|
||
|
||
let context; | ||
|
||
test.beforeAll(async ({ browser }) => { | ||
context = await browser.newContext({ storageState: 'tests/playwright/.auth/admin.json' }); | ||
}); | ||
|
||
test.afterAll(async () => { | ||
await context.close(); | ||
}); | ||
|
||
async function showTableOfEntity(section, tab, expected) { | ||
const page = await context.newPage() | ||
await page.goto('/'); | ||
|
||
await page.getByText(section).click(); | ||
await page | ||
.locator(`div[title^="${tab}"]`).click(); | ||
|
||
await expect(page.locator('#content-scroll-container')).toContainText(expected ? expected : tab); | ||
} | ||
|
||
test('Show Routes', async () => showTableOfEntity(SECTIONS.MANAGE_RESOURCES, 'Routes')); | ||
test('Show Services', async () => showTableOfEntity(SECTIONS.MANAGE_RESOURCES, 'Services')); | ||
test('Show Admins', async () => showTableOfEntity(SECTIONS.MANAGE_RESOURCES, 'Administrator', 'All administrators')); | ||
test('Show Data Exporters', async () => showTableOfEntity(SECTIONS.MANAGE_RESOURCES, 'Data exporters')); | ||
test('Show Apikeys', async () => showTableOfEntity(SECTIONS.MANAGE_RESOURCES, 'Apikeys')); | ||
test('Show Auth. modules', async () => showTableOfEntity(SECTIONS.MANAGE_RESOURCES, 'Auth. modules', 'Authentication modules')); | ||
test('Show Backends', async () => showTableOfEntity(SECTIONS.MANAGE_RESOURCES, 'Backends')); | ||
test('Show Drafts', async () => showTableOfEntity(SECTIONS.MANAGE_RESOURCES, 'Drafts')); | ||
test('Show Error Templates', async () => showTableOfEntity(SECTIONS.MANAGE_RESOURCES, 'Error Templates', 'Error templates')); | ||
test('Show JWT verifiers', async () => showTableOfEntity(SECTIONS.MANAGE_RESOURCES, 'JWT verifiers', 'Jwt verifiers')); | ||
test('Show Service Groups', async () => showTableOfEntity(SECTIONS.MANAGE_RESOURCES, 'Service groups', 'Groups')); | ||
test('Show TCP Services', async () => showTableOfEntity(SECTIONS.MANAGE_RESOURCES, 'TCP services', 'Tcp services')); | ||
test('Show Teams', async () => showTableOfEntity(SECTIONS.MANAGE_RESOURCES, 'Teams')); | ||
test('Show Wasm Plugins', async () => showTableOfEntity(SECTIONS.MANAGE_RESOURCES, 'Wasm Plugins', 'Wasm plugins')); |
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.