Repository navigation
fix: guard after_session hook and avoid duplicate newCommandTimeout capability - #270
hoanle0126 wants to merge 2 commits into
Conversation
| end | ||
| output = StringIO.new | ||
| Pry.hooks.exec_hook(:after_session, output, binding, Pry.new) | ||
| assert_includes output.string, 'Closing appium session...' |
There was a problem hiding this comment.
[P2] Assert that the release hook completes without an error
Pry.hooks.exec_hook catches hook exceptions and stores them in Pry.hooks.errors, so this assertion still passes if the new respond_to?(:x, true) guard is removed: the closing message is printed before x raises NameError. I reproduced this behavior with Pry 0.14.2's hook implementation. Please invoke the registered hook directly with Pry.hooks.get_hook(:after_session, 'Release session hook').call(output, binding, Pry.new), or assert that executing it adds no hook errors, so the test detects the missing-driver regression.
There was a problem hiding this comment.
Updated test_after_session_hook_handles_missing_driver_and_repeated_start to invoke Pry.hooks.get_hook(:after_session, 'Release session hook').call(output, binding, Pry.new) directly and assert Pry.hooks.errors is empty. Thanks @KazuCocoa!
Proposed changes
pry_load_appium_txtandreloadsingleton methods onPrybefore redefining them inAppium::Console.setupto avoidmethod redefinedwarnings.'Release session hook':after_sessionhook before registering it inAppium::Console.start, and guardxwithrespond_to?(:x, true)so the:after_sessionhook does not raiseNameErrorif a session failed to start or promote driver methods.:newCommandTimeoutand:'appium:newCommandTimeout'inlib/start.rbbefore injecting the defaultnewCommandTimeout: 999_999capability.Types of changes