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
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
"clean:dist": "yarn workspaces foreach --all --topological --parallel run clean:dist",
"test:unit": "yarn run test:tooling && yarn run test:cc-widgets && yarn run test:meetings-widget",
"test:e2e": "yarn playwright test",
"test:e2e:cc": "yarn workspace @webex/cc-widgets run test:e2e",
"test:e2e:meetings": "yarn workspace @webex/widgets run test:e2e",
"test:styles": "yarn workspaces foreach --all --exclude webex-widgets run test:styles",
"test:tooling": "NODE_ENV=test jest --coverage",
"test:cc-widgets": "yarn workspaces foreach --all --exclude webex-widgets --exclude samples-cc-wc-app --exclude samples-cc-react-app run test:unit",
Expand Down
1 change: 1 addition & 0 deletions packages/contact-center/cc-widgets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"build:src": "yarn run clean:dist && webpack",
"build:watch": "webpack --watch",
"test:unit": "NODE_ENV=test jest --coverage",
"test:e2e": "yarn run -T playwright test --config ../../../playwright.config.ts",
"test:styles": "eslint",
"deploy:npm": "yarn npm publish"
},
Expand Down
4 changes: 3 additions & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ export default defineConfig({
},
retries: 0,
fullyParallel: true,
workers: Object.keys(USER_SETS).length, // Dynamic worker count based on USER_SETS
// Match CI concurrency to the runner's available resources while preserving
// one worker per user set for local runs.
workers: process.env.CI ? 4 : Object.keys(USER_SETS).length,
reporter: 'html',
use: {
baseURL: 'http://localhost:3000',
Expand Down
24 changes: 3 additions & 21 deletions playwright/global.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const path = require('path');

const ENV_PATH = path.resolve(__dirname, '../.env');
const OAUTH_BATCH_SIZE = 4;
const OAUTH_SET_GROUP_SIZE = 2;

type EnvUpdateMap = Record<string, string>;

Expand Down Expand Up @@ -65,18 +64,6 @@ const buildOAuthTasksForSetGroup = (setKeys: UserSetKey[]): OAuthTask[] => {
return setKeys.flatMap((setKey) => buildOAuthTasksForSet(setKey));
};

const buildSetGroups = (setKeys: UserSetKey[], groupSize: number): UserSetKey[][] => {
if (groupSize <= 0) {
throw new Error('groupSize must be greater than 0');
}

const groups: UserSetKey[][] = [];
for (let index = 0; index < setKeys.length; index += groupSize) {
groups.push(setKeys.slice(index, index + groupSize));
}
return groups;
};

const buildDialNumberTask = (): OAuthTask | null => {
const dialNumberUsername = process.env.PW_DIAL_NUMBER_LOGIN_USERNAME;
const dialNumberPassword = process.env.PW_DIAL_NUMBER_LOGIN_PASSWORD;
Expand Down Expand Up @@ -149,19 +136,14 @@ export const UpdateENVWithUserSets = () => {
return updates;
};

const runOAuthSetGroup = async (browser: Browser, setGroup: UserSetKey[]) => {
const tasks = buildOAuthTasksForSetGroup(setGroup);
return collectTokensInBatches(browser, tasks);
};

setup('OAuth', async ({browser}) => {
const userSetKeys = Object.keys(USER_SETS) as UserSetKey[];
const oauthSetGroups = buildSetGroups(userSetKeys, OAUTH_SET_GROUP_SIZE);

// Collect all environment updates
const userSetUpdates = UpdateENVWithUserSets();
const groupedTokenUpdates = await Promise.all(oauthSetGroups.map((setGroup) => runOAuthSetGroup(browser, setGroup)));
const tokenUpdates = groupedTokenUpdates.reduce<EnvUpdateMap>((acc, groupTokens) => ({...acc, ...groupTokens}), {});
const oauthTasks = buildOAuthTasksForSetGroup(userSetKeys);
// Use one batch loop so OAUTH_BATCH_SIZE is the global browser-context limit.
const tokenUpdates = await collectTokensInBatches(browser, oauthTasks);

// Fetch dial number token (if configured)
const dialNumberTask = buildDialNumberTask();
Expand Down
Loading