Skip to content

Commit 913f99f

Browse files
committed
test for overrideDNS() - not passed yet
1 parent 80e8a01 commit 913f99f

File tree

1 file changed

+43
-1
lines changed

1 file changed

+43
-1
lines changed

tests/main.js

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ describe('BrowserMob Proxy Client general test', () => {
726726
});
727727
});
728728

729-
describe('Limit the bandwidth through the proxy - setLimits(), getLimits()', () => {
729+
describe.skip('Limit the bandwidth through the proxy - setLimits(), getLimits()', () => {
730730

731731
describe('setLimits()', () => {
732732

@@ -1026,6 +1026,48 @@ describe('BrowserMob Proxy Client general test', () => {
10261026
});
10271027
});
10281028

1029+
describe('Overrides normal DNS lookups and remaps the given hosts with the associated IP address - overrideDNS()', () => {
1030+
1031+
it('should overrides normal DNS lookups ', (done) => {
1032+
1033+
const overrideDNS = {};
1034+
const url = 'www.httpbin.org';
1035+
const wellFormedUrl = 'http://www.httpbin.org/';
1036+
1037+
let browserMobProxyClient = undefined;
1038+
let seleniumInstance = undefined;
1039+
1040+
overrideDNS[url] = `http://localhost`;
1041+
1042+
(new bmpClient(bmpHost, bmpPort)).create()
1043+
.then((client) => {
1044+
browserMobProxyClient = client;
1045+
return browserMobProxyClient.overrideDNS(overrideDNS);
1046+
})
1047+
.then(() => {
1048+
return browserMobProxyClient.newHar();
1049+
})
1050+
.then(() => {
1051+
//Create new selenium session
1052+
seleniumInstance = seleniumHelper.initWithProxy(seleniumPort, bmpHost, browserMobProxyClient.port);
1053+
return seleniumInstance.url(url);
1054+
})
1055+
.then(() => {
1056+
return browserMobProxyClient.getHar();
1057+
})
1058+
.then((har) => {
1059+
const status = har.log.entries.find((entry) => {
1060+
return entry.request.url === wellFormedUrl;
1061+
}).response;
1062+
1063+
console.log(status);
1064+
})
1065+
.catch((value) => {
1066+
console.log(value);
1067+
done(new Error(value));});
1068+
});
1069+
});
1070+
10291071
});
10301072

10311073
after((done) => {

0 commit comments

Comments
 (0)