Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/calling/playwright/constants/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const CALLING_SELECTORS = {
AUTH_STATUS: '#access-token-status',
SERVICE_INDICATOR: '#ServiceIndicator',
SERVICE_DOMAIN: '#ServiceDomain',
MOBIUS_WSS: '#mobius-wss',
REGION_INPUT: '#region',
COUNTRY_INPUT: '#country',
FEDRAMP_CHECKBOX: '#fedramp',
Expand Down
29 changes: 27 additions & 2 deletions packages/calling/playwright/test-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export interface UserSet {
testSuite: string;
}

export type MobiusMode = 'http' | 'ws';

/**
* Roles that must have credentials/tokens available for the currently enabled
* Playwright projects.
Expand All @@ -36,6 +38,24 @@ export const REQUIRED_OAUTH_ROLES: AccountRole[] = [
/** Separator between set name and environment in project names (e.g. "SET_REGISTRATION_1 - PROD"). */
const ENV_SEPARATOR = ' - ';

/**
* Mobius transport mode for Playwright suites.
*
* MOBIUS=ws forces the sample app WebSocket override before SDK initialization.
* MOBIUS=http keeps the default HTTP transport.
*/
export const getMobiusMode = (): MobiusMode => {
const mode = process.env.MOBIUS?.toLowerCase();

if (mode === 'ws') {
return 'ws';
}

return 'http';
};

export const isMobiusWsMode = (): boolean => getMobiusMode() === 'ws';

/**
* Whether a Playwright project targets the Integration environment.
*/
Expand Down Expand Up @@ -71,11 +91,16 @@ export const getToken = (role: AccountRole, isInt = false): string => {
return token;
};

/** Env var for E.164 (or test) phone number, production vs integration Playwright projects. */
export const phoneEnvVar = (role: AccountRole, isInt = false): string =>
Comment thread
eigengravy marked this conversation as resolved.
isInt ? `${role}_INT_PHONE_NUMBER` : `${role}_PHONE_NUMBER`;

/**
* Read phone number for an account role. Throws if not set.
* Integration projects use `USER_N_INT_PHONE_NUMBER`; production uses `USER_N_PHONE_NUMBER`.
*/
export const getPhoneNumber = (role: AccountRole): string => {
const envVar = `${role}_PHONE_NUMBER`;
export const getPhoneNumber = (role: AccountRole, isInt = false): string => {
const envVar = phoneEnvVar(role, isInt);
const number = process.env[envVar];
if (!number) {
throw new Error(`${envVar} not set.`);
Expand Down
Loading
Loading