Skip to content

Commit

Permalink
Adding Tests for TLSv1.2 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Amit3200 committed Oct 19, 2023
1 parent e301f22 commit a4a0ddb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
1 change: 0 additions & 1 deletion packages/webdriver-utils/src/util/utils.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import https from 'https';

export function httpsAgent() {
// return {};
return new https.Agent({
minVersion: 'TLSv1.2',
maxVersion: 'TLSv1.2'
Expand Down
24 changes: 16 additions & 8 deletions packages/webdriver-utils/test/driver.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ describe('Driver', () => {
describe('getCapabilities', () => {
it('calls requests', async () => {
let res = await driver.getCapabilites();
expect(requestSpy).toHaveBeenCalledOnceWith(`${executorUrl}/session/${sessionId}`, Object({}));
expect(requestSpy).toHaveBeenCalledWith(
`${executorUrl}/session/${sessionId}`,
{ agent: jasmine.any(Object) }
);
expect(res).toBe('mockVal');
});
});
Expand All @@ -56,7 +59,9 @@ describe('Driver', () => {

it('falls back to passed capabilites', async () => {
let res = await newDriver.getCapabilites();
expect(requestFailedSpy).toHaveBeenCalledOnceWith(`${executorUrl}/session/${sessionId}`, Object({}));
expect(requestFailedSpy).toHaveBeenCalledOnceWith(`${executorUrl}/session/${sessionId}`,
{ agent: jasmine.any(Object) }
);
expect(res).toBe(passedCapabilities);
});
});
Expand All @@ -66,7 +71,7 @@ describe('Driver', () => {
let res = await driver.getWindowSize();
expect(requestSpy).toHaveBeenCalledOnceWith(
`${executorUrl}/session/${sessionId}/window/current/size`,
Object({}));
{ agent: jasmine.any(Object) });
expect(res).toEqual({ value: 'mockVal' });
});
});
Expand All @@ -83,7 +88,8 @@ describe('Driver', () => {
headers: {
'Content-Type': 'application/json;charset=utf-8'
},
body: JSON.stringify(command)
body: JSON.stringify(command),
agent: jasmine.any(Object)
}
);
expect(res).toEqual({ value: 'mockVal' });
Expand All @@ -100,7 +106,8 @@ describe('Driver', () => {
headers: {
'Content-Type': 'application/json;charset=utf-8'
},
body: JSON.stringify(command)
body: JSON.stringify(command),
agent: jasmine.any(Object)
}
);
expect(res).toEqual({ value: 'mockVal' });
Expand All @@ -119,7 +126,7 @@ describe('Driver', () => {
let res = await driver.takeScreenshot();
expect(requestSpy).toHaveBeenCalledOnceWith(
`${executorUrl}/session/${sessionId}/screenshot`,
Object({}));
{ agent: jasmine.any(Object) });
expect(res).toEqual('mockVal');
});
});
Expand All @@ -136,7 +143,8 @@ describe('Driver', () => {
headers: {
'Content-Type': 'application/json;charset=utf-8'
},
body: JSON.stringify({ using, value: value })
body: JSON.stringify({ using, value: value }),
agent: jasmine.any(Object)
}
);
expect(res).toEqual('mockVal');
Expand All @@ -157,7 +165,7 @@ describe('Driver', () => {
let res = await driver.rect(elementId);
expect(requestSpy).toHaveBeenCalledOnceWith(
`${executorUrl}/session/${sessionId}/element/${elementId}/rect`,
Object({}));
{ agent: jasmine.any(Object) });
expect(res).toEqual('mockVal');
});
});
Expand Down

0 comments on commit a4a0ddb

Please sign in to comment.