@@ -726,7 +726,7 @@ describe('BrowserMob Proxy Client general test', () => {
726
726
} ) ;
727
727
} ) ;
728
728
729
- describe ( 'Limit the bandwidth through the proxy - setLimits(), getLimits()' , ( ) => {
729
+ describe . skip ( 'Limit the bandwidth through the proxy - setLimits(), getLimits()' , ( ) => {
730
730
731
731
describe ( 'setLimits()' , ( ) => {
732
732
@@ -1026,6 +1026,48 @@ describe('BrowserMob Proxy Client general test', () => {
1026
1026
} ) ;
1027
1027
} ) ;
1028
1028
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
+
1029
1071
} ) ;
1030
1072
1031
1073
after ( ( done ) => {
0 commit comments