Skip to content

Commit

Permalink
fix: emulators were failing some double-agent tests
Browse files Browse the repository at this point in the history
  • Loading branch information
calebjclark committed Nov 19, 2020
1 parent 240bea6 commit 5ae4f55
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion client/interfaces/ISecretAgentClass.ts
Expand Up @@ -4,7 +4,7 @@ import IUserProfile from "@secret-agent/core-interfaces/IUserProfile";
import ICreateSecretAgentOptions from "./ICreateSecretAgentOptions";
import ISecretAgent from "./ISecretAgent";

export interface ISecretAgentConfigureOptions extends Pick<ICoreConfigureOptions, 'browserEmulatorIds'> {
export interface ISecretAgentConfigureOptions extends ICoreConfigureOptions {
defaultRenderingOptions: IRenderingOption[];
defaultUserProfile: IUserProfile;
}
Expand Down
@@ -1,7 +1,7 @@
const { supportedCodecs } = args;

if ((window as any).MediaRecorder) {
proxyFunction((window as any).MediaRecorder, 'isTypeSupported', (func, thisArg, type) => {
proxyFunction((window as any).MediaRecorder, 'isTypeSupported', (func, thisArg, [type]) => {
if (type === undefined) return ProxyOverride.callOriginal;
return supportedCodecs.includes(type);
});
Expand Down
2 changes: 1 addition & 1 deletion emulate-browsers/chrome-80/index.ts
Expand Up @@ -46,7 +46,7 @@ export default class Chrome80 {

public readonly userAgent: IUserAgent;
public readonly networkInterceptorDelegate: INetworkInterceptorDelegate;
public locale = 'en-US,en;0.9';
public locale = 'en-US,en';
public userProfile: IUserProfile;

protected domOverrides = new DomOverridesBuilder();
Expand Down
9 changes: 5 additions & 4 deletions emulate-browsers/chrome-83/index.ts
Expand Up @@ -47,7 +47,7 @@ export default class Chrome83 {
public readonly userAgent: IUserAgent;
public readonly networkInterceptorDelegate: INetworkInterceptorDelegate;

public locale = 'en-US,en;0.9';
public locale = 'en-US,en';
public userProfile: IUserProfile;

protected domOverrides = new DomOverridesBuilder();
Expand Down Expand Up @@ -152,9 +152,10 @@ export default class Chrome83 {
videoCodecs: agentCodecs.videoSupport,
});
domOverrides.add('MediaRecorder.isTypeSupported', {
supportedCodecs: agentCodecs.audioSupport.recordingFormats.concat(
agentCodecs.videoSupport.recordingFormats,
),
supportedCodecs: [
...agentCodecs.audioSupport.recordingFormats,
...agentCodecs.videoSupport.recordingFormats
],
});
domOverrides.add('RTCRtpSender.getCapabilities', {
videoCodecs: agentCodecs.webRtcVideoCodecs,
Expand Down

0 comments on commit 5ae4f55

Please sign in to comment.