mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 04:07:31 +00:00
test(e2e): test authorizations (#4342)
* add specs that cover the b2b demo * update cypress * test handling manager roles * use shared mocha contexts * use beforeEach instead of before * improve readability * improve application test * remove static waits * remove old awaitDesired * test owned project authorizations * simplify ensure.ts * test granted projects authz * disable prevSubject for shouldNotExist * await non-existence, then expect no error * update dependencies * fix tests from scratch * fix settings tests from scratch * Apply suggestions from code review Co-authored-by: Max Peintner <max@caos.ch> * Implement code review suggestions * use spread operator * settings properties must match * add check settings object * revert spread operator Co-authored-by: Max Peintner <max@caos.ch>
This commit is contained in:
30
e2e/cypress/support/api/orgs.ts
Normal file
30
e2e/cypress/support/api/orgs.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { ensureSomething } from './ensure';
|
||||
import { searchSomething } from './search';
|
||||
import { API } from './types';
|
||||
import { host } from '../login/users';
|
||||
|
||||
export function ensureOrgExists(api: API, name: string): Cypress.Chainable<number> {
|
||||
return ensureSomething(
|
||||
api,
|
||||
() =>
|
||||
searchSomething(
|
||||
api,
|
||||
encodeURI(`${api.mgmtBaseURL}/global/orgs/_by_domain?domain=${name}.${host(Cypress.config('baseUrl'))}`),
|
||||
'GET',
|
||||
(res) => {
|
||||
return { entity: res.org, id: res.org?.id, sequence: res.org?.details?.sequence };
|
||||
},
|
||||
),
|
||||
() => `${api.mgmtBaseURL}/orgs`,
|
||||
'POST',
|
||||
{ name: name },
|
||||
(org: any) => org?.name === name,
|
||||
(res) => res.id,
|
||||
);
|
||||
}
|
||||
|
||||
export function getOrgUnderTest(api: API): Cypress.Chainable<number> {
|
||||
return searchSomething(api, `${api.mgmtBaseURL}/orgs/me`, 'GET', (res) => {
|
||||
return { entity: res.org, id: res.org.id, sequence: res.org.details.sequence };
|
||||
}).then((res) => res.entity.id);
|
||||
}
|
Reference in New Issue
Block a user