@@ -6,8 +6,10 @@ import { validateConfig } from '@wdio/config'
66
77import detectBackend from '../src/utils/detectBackend.js'
88import { remote , multiremote , attach , Key , SevereServiceError } from '../src/index.js'
9+ import { registerSessionManager } from '../src/session/index.js'
910
1011vi . mock ( '../src/utils/detectBackend' , ( ) => ( { default : vi . fn ( ) } ) )
12+ vi . mock ( '../src/session/index.js' , ( ) => ( { registerSessionManager : vi . fn ( ) } ) )
1113vi . mock ( '@wdio/logger' , ( ) => import ( path . join ( process . cwd ( ) , '__mocks__' , '@wdio/logger' ) ) )
1214vi . mock ( 'webdriver' , ( ) => {
1315 const client = {
@@ -68,6 +70,7 @@ describe('WebdriverIO module interface', () => {
6870 vi . mocked ( WebDriver . newSession ) . mockClear ( )
6971 vi . mocked ( WebDriver . attachToSession ) . mockClear ( )
7072 vi . mocked ( detectBackend ) . mockClear ( )
73+ vi . mocked ( registerSessionManager ) . mockClear ( )
7174 } )
7275
7376 it ( 'should provide all exports' , ( ) => {
@@ -87,6 +90,7 @@ describe('WebdriverIO module interface', () => {
8790 const browser = await remote ( options )
8891 expect ( browser . sessionId ) . toBe ( 'foobar-123' )
8992 expect ( logger . setLogLevelsConfig ) . toBeCalledWith ( undefined , 'trace' )
93+ expect ( registerSessionManager ) . toBeCalledTimes ( 1 )
9094 } )
9195
9296 it ( 'allows to propagate a modifier' , async ( ) => {
@@ -170,6 +174,21 @@ describe('WebdriverIO module interface', () => {
170174 isWindowsApp : false ,
171175 isMacApp : false ,
172176 } )
177+ expect ( registerSessionManager ) . not . toBeCalled ( )
178+ } )
179+
180+ it ( 'should not initialize session managers for protocol stub sessions' , async ( ) => {
181+ const browser = await remote ( {
182+ automationProtocol : './protocol-stub.js' ,
183+ capabilities : {
184+ browserName : 'Safari' ,
185+ platformName : 'iOS' ,
186+ 'appium:options' : { automationName : 'XCUITest' }
187+ }
188+ } )
189+
190+ expect ( browser . isMobile ) . toBe ( true )
191+ expect ( registerSessionManager ) . not . toBeCalled ( )
173192 } )
174193
175194 it ( 'should use the element disable implicitWait exclusion list' , async ( ) => {
0 commit comments