-
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
fa3ccf3
commit ba499c7
Showing
8 changed files
with
129 additions
and
37 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Requierements | ||
|
||
- You must create a `[email protected]` admin with the following rights | ||
``` | ||
[ | ||
{ | ||
"tenant": "tester:rw", | ||
"teams": [ | ||
"tester-team:rw" | ||
] | ||
} | ||
] | ||
``` | ||
|
||
- You must create a `Tester Organization` with the `tester` id. | ||
- You must create a `Tester Team` with the `tester-team` id inside the `Tester Organization` |
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
60 changes: 60 additions & 0 deletions
60
otoroshi/javascript/tests/spec/entity-location/index.spec.js
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,60 @@ | ||
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(); | ||
}); | ||
|
||
async function shouldDefaultTeamsAndTenant(path, action = 'add item') { | ||
const page = await context.newPage(); | ||
await page.goto(`/bo/dashboard/${path}`); | ||
|
||
await page.getByRole('button', { name: action, exact: false }).click(); | ||
|
||
await expect(page.locator('#content-scroll-container')).toContainText('Default organization - The default organization'); | ||
await expect(page.locator('#content-scroll-container')).toContainText('Default team - Default team created for any otoroshi instance'); | ||
} | ||
|
||
async function shouldDefaultTenantOnTeam() { | ||
const page = await context.newPage(); | ||
await page.goto(`/bo/dashboard/teams`); | ||
|
||
await page.getByRole('button', { name: 'add item', exact: false }).click(); | ||
|
||
await expect(page.locator('#content-scroll-container')).toContainText('Default organization - The default organization'); | ||
} | ||
|
||
async function shouldDefaultTeamsAndTenantOnRoutes() { | ||
const page = await context.newPage(); | ||
await page.goto('/'); | ||
|
||
await page.locator('#navbar').click(); | ||
|
||
await page.locator('#react-select-2-input').fill('Routes'); | ||
await page.getByRole('option', { name: ` Routes` }).locator('div').click(); | ||
// await page.getByRole('button', { name: ' Add item' }).click(); | ||
|
||
await page.getByRole('link', { name: ' Create new route' }).click(); | ||
await page.locator('div').filter({ hasText: /^Location$/ }).nth(1).click(); | ||
|
||
await expect(page.locator('#content-scroll-container')).toContainText('Default organization - The default organization'); | ||
await expect(page.locator('#content-scroll-container')).toContainText('Default team - Default team created for any otoroshi instance'); | ||
} | ||
|
||
test('New Routes got the right entity location', async () => shouldDefaultTeamsAndTenantOnRoutes()); | ||
test('New Services got the right entity location', async () => shouldDefaultTeamsAndTenant('services', 'new')); | ||
test('New Data Exporters got the right entity location', async () => shouldDefaultTeamsAndTenant('exporters')); | ||
test('New Apikeys got the right entity location', async () => shouldDefaultTeamsAndTenant('apikeys')); | ||
test('New Auth. modules got the right entity location', async () => shouldDefaultTeamsAndTenant('auth-configs')); | ||
test('New Backends got the right entity location', async () => shouldDefaultTeamsAndTenant('backends')); | ||
test('New Error Templates got the right entity location', async () => shouldDefaultTeamsAndTenant('error-templates')); | ||
test('New JWT verifiers got the right entity location', async () => shouldDefaultTeamsAndTenant('jwt-verifiers')); | ||
test('New Service Groups got the right entity location', async () => shouldDefaultTeamsAndTenant('groups')); | ||
test('New TCP Services got the right entity location', async () => shouldDefaultTeamsAndTenant('tcp/services')); | ||
test('New Teams got the right entity location', async () => shouldDefaultTenantOnTeam()); | ||
test('New Wasm Plugins got the right entity location', async () => shouldDefaultTeamsAndTenant('wasm-plugins')); |
49 changes: 49 additions & 0 deletions
49
otoroshi/javascript/tests/spec/entity-location/user.spec.js
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,49 @@ | ||
const { test, expect } = require('@playwright/test'); | ||
|
||
let context; | ||
|
||
test.beforeAll(async ({ browser }) => { | ||
context = await browser.newContext({ storageState: 'tests/playwright/.auth/tester.json' }); | ||
}); | ||
|
||
test.afterAll(async () => { | ||
await context.close(); | ||
}); | ||
|
||
async function shouldDefaultTeamsAndTenant(path, action = 'add item') { | ||
const page = await context.newPage(); | ||
|
||
await page.goto(`/bo/dashboard/${path}`); | ||
|
||
await page.getByRole('button', { name: action, exact: false }).click(); | ||
|
||
await expect(page.locator('#content-scroll-container')).toContainText('tester-team'); | ||
} | ||
|
||
async function shouldDefaultTeamsAndTenantOnRoutes() { | ||
const page = await context.newPage(); | ||
await page.goto('/'); | ||
|
||
await page.locator('#navbar').click(); | ||
|
||
await page.locator('#react-select-2-input').fill('Routes'); | ||
await page.getByRole('option', { name: ` Routes` }).locator('div').click(); | ||
// await page.getByRole('button', { name: ' Add item' }).click(); | ||
|
||
await page.getByRole('link', { name: ' Create new route' }).click(); | ||
await page.locator('div').filter({ hasText: /^Location$/ }).nth(1).click(); | ||
|
||
|
||
await expect(page.locator('#content-scroll-container')).toContainText('tester-team'); | ||
} | ||
|
||
test('New Routes got the right entity location', async () => shouldDefaultTeamsAndTenantOnRoutes()); | ||
test('New Services got the right entity location', async () => shouldDefaultTeamsAndTenant('services', 'new')); | ||
test('New Data Exporters got the right entity location', async () => shouldDefaultTeamsAndTenant('exporters')); | ||
test('New Apikeys got the right entity location', async () => shouldDefaultTeamsAndTenant('apikeys')); | ||
test('New Auth. modules got the right entity location', async () => shouldDefaultTeamsAndTenant('auth-configs')); | ||
test('New Backends got the right entity location', async () => shouldDefaultTeamsAndTenant('backends')) | ||
test('New JWT verifiers got the right entity location', async () => shouldDefaultTeamsAndTenant('jwt-verifiers')); | ||
test('New Service Groups got the right entity location', async () => shouldDefaultTeamsAndTenant('groups')); | ||
test('New TCP Services got the right entity location', async () => shouldDefaultTeamsAndTenant('tcp/services')); | ||
test('New Wasm Plugins got the right entity location', async () => shouldDefaultTeamsAndTenant('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
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