mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2025-12-30 03:12:29 +00:00
feat(tests): Fixes the checks when to use token. (#15706)
* feat(tests): Fixes the checks when to use token. We have few options: - iframeAPI tests generating tokens via jwtPrivateKeyPath - tests that just use provided JWT_ACCESS_TOKEN for the first participant to avoid deployments where initial authentication is required - tests that does not use iframeAPI, but want to use the jwtPrivateKeyPath for a meeting (invite test as JWT_ACCESS_TOKEN does not satisfy some services) * squash: Bump hangup wait, redirects may take a little bit more. * squash: Rename forceGenerateToken to preferGenerateToken and fix logic when private key is missing.
This commit is contained in:
@@ -234,7 +234,7 @@ export class Participant {
|
||||
|
||||
let urlToLoad = url.startsWith('/') ? url.substring(1) : url;
|
||||
|
||||
if (options.forceGenerateToken && !ctx.iframeAPI && ctx.isJaasAvailable() && process.env.IFRAME_TENANT) {
|
||||
if (options.preferGenerateToken && !ctx.iframeAPI && ctx.isJaasAvailable() && process.env.IFRAME_TENANT) {
|
||||
// This to enables tests like invite, which can force using the jaas auth instead of the provided token
|
||||
urlToLoad = `/${process.env.IFRAME_TENANT}/${urlToLoad}`;
|
||||
}
|
||||
@@ -619,8 +619,8 @@ export class Participant {
|
||||
await this.driver.waitUntil(
|
||||
async () => current !== await this.driver.getUrl(),
|
||||
{
|
||||
timeout: 5000,
|
||||
timeoutMsg: `${this.name} did not leave the muc in 5s`
|
||||
timeout: 8000,
|
||||
timeoutMsg: `${this.name} did not leave the muc in 8s`
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -168,8 +168,9 @@ async function joinTheModeratorAsP1(ctx: IContext, options?: IJoinOptions) {
|
||||
if (!options?.skipFirstModerator) {
|
||||
// we prioritize the access token when iframe is not used and private key is set,
|
||||
// otherwise if private key is not specified we use the access token if set
|
||||
if (process.env.JWT_ACCESS_TOKEN && (!ctx.jwtPrivateKeyPath || !ctx.iframeAPI
|
||||
|| !options?.forceGenerateToken)) {
|
||||
if (process.env.JWT_ACCESS_TOKEN
|
||||
&& ((ctx.jwtPrivateKeyPath && !ctx.iframeAPI && !options?.preferGenerateToken)
|
||||
|| !ctx.jwtPrivateKeyPath)) {
|
||||
token = process.env.JWT_ACCESS_TOKEN;
|
||||
} else if (ctx.jwtPrivateKeyPath) {
|
||||
token = getModeratorToken(p1DisplayName);
|
||||
|
||||
@@ -38,7 +38,7 @@ export type IJoinOptions = {
|
||||
* When joining the first participant and jwt singing material is available and a provided token
|
||||
* is available, prefer generating a new token for the first participant.
|
||||
*/
|
||||
forceGenerateToken?: boolean;
|
||||
preferGenerateToken?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to skip setting display name.
|
||||
|
||||
@@ -2,7 +2,7 @@ import { ensureOneParticipant } from '../../helpers/participants';
|
||||
import { isDialInEnabled } from '../helpers/DialIn';
|
||||
|
||||
describe('Invite', () => {
|
||||
it('join participant', () => ensureOneParticipant(ctx, { forceGenerateToken: true }));
|
||||
it('join participant', () => ensureOneParticipant(ctx, { preferGenerateToken: true }));
|
||||
|
||||
it('url displayed', async () => {
|
||||
const { p1 } = ctx;
|
||||
|
||||
Reference in New Issue
Block a user