mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-14 11:58:02 +00:00
0530f19d94
* feat: allow usernames without @ when UserMustBeDomain false * e2e * test(e2e): table driven tests for humans and machines * cleanup * fix(e2e): ensure there are no username conflicts * e2e: make awaitDesired async * rm settings mapping * e2e: make awaitDesired async * e2e: parse sequence as int * e2e: ensure test fails if awaitDesired fails Co-authored-by: Max Peintner <max@caos.ch>
31 lines
1023 B
TypeScript
31 lines
1023 B
TypeScript
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: parseInt(<string>res.org?.details?.sequence) };
|
|
},
|
|
),
|
|
() => `${api.mgmtBaseURL}/orgs`,
|
|
'POST',
|
|
{ name: name },
|
|
(org) => 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: parseInt(<string>res.org.details.sequence) };
|
|
}).then((res) => res.entity.id);
|
|
}
|