Skip to content

Commit

Permalink
fix: imporve port management for ios parallel execution (#1470)
Browse files Browse the repository at this point in the history
  • Loading branch information
sudharsan-selvaraj authored Dec 12, 2024
1 parent 3241411 commit a6992b5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion dashboard-frontend
4 changes: 2 additions & 2 deletions src/interfaces/ISessionCapability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export type CreateSessionResponseInternal = {
// session id
string,
// capabilities
ISessionCapability,
Record<string, any>,
// protocol
string?,
];
Expand All @@ -55,7 +55,7 @@ export type CreateSessionResponseInternal = {
export type W3CNewSessionResponse = {
value: {
sessionId: string;
capabilities: ISessionCapability;
capabilities: Record<string, any>;
};
};

Expand Down
2 changes: 1 addition & 1 deletion src/modules
21 changes: 14 additions & 7 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -477,17 +477,24 @@ class DevicePlugin extends BasePlugin {
caps: ISessionCapability,
): Promise<CreateSessionResponseInternal | Error> {
const remoteUrl = `${nodeUrl(device, DevicePlugin.nodeBasePath)}/session`;
let capabilitiesToCreateSession = { capabilities: caps };
const capabilitiesToCreateSession = { capabilities: caps };

if (device.hasOwnProperty('cloud') && device.cloud.toLowerCase() === Cloud.LAMBDATEST) {
if(capabilitiesToCreateSession.capabilities.alwaysMatch && Object.keys(capabilitiesToCreateSession.capabilities.alwaysMatch).length == 0) {
if (
capabilitiesToCreateSession.capabilities.alwaysMatch &&
Object.keys(capabilitiesToCreateSession.capabilities.alwaysMatch).length == 0
) {
delete capabilitiesToCreateSession.capabilities.alwaysMatch;
}
if(capabilitiesToCreateSession.capabilities.firstMatch &&
_.isArray(capabilitiesToCreateSession.capabilities.firstMatch) &&
(!capabilitiesToCreateSession.capabilities.firstMatch.length ||
capabilitiesToCreateSession.capabilities.firstMatch.every(m => Object.keys(m).length ==0 ))) {
//@ts-ignore
if (
capabilitiesToCreateSession.capabilities.firstMatch &&
_.isArray(capabilitiesToCreateSession.capabilities.firstMatch) &&
(!capabilitiesToCreateSession.capabilities.firstMatch.length ||
capabilitiesToCreateSession.capabilities.firstMatch.every(
(m) => Object.keys(m).length == 0,
))
) {
//@ts-ignore
delete capabilitiesToCreateSession.capabilities.firstMatch;
}
}
Expand Down

0 comments on commit a6992b5

Please sign in to comment.