`set_context` is not available on an example group error


#1

Appium : 1.12.1
appium_lib : 10.3.0, 9.15.1, 9.7.2, 9.4.9
simulator : Version 10.2 (SimulatorApp-880.5 CoreSimulator-587.35)

My script use to work before i updated my Xcode and able to switch contexts in the hybrid app that i am testing. After the updates it stop working.

Upon checking the hybrid apps have the following contexts:
NATIVE_APP
WEBVIEW_6438.5
WEBVIEW_6438.6
WEBVIEW_6438.7
WEBVIEW_6438.8
WEBVIEW_6438.9
WEBVIEW_6438.10

I have tried using the set_context(available_contexts[2]) within and individual or group example but i still get the error. When i run the group script i get the following error. If i run individual error i get the opposite error where it

Individual codes example:
Config::COUNTRY.each do |ctry|
describe “FaveDeal with credit cards” do
it “bla” do
User.login_phone_number(‘20190531162452’, “Malaysia”)
sleep(5)
puts available_contexts
set_context(available_contexts[2])
end
end

Error:
UnknownError: An unknown server-side error occurred while processing the command. Original error: Remote debugger error with code ‘-32601’: ‘Page’ domain was not found
# at getResponseForW3CError (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:826:9)
# at asyncHandler (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:447:37)
# at
# ./test.rb:15:in block (3 levels) in <top (required)>' # ------------------ # --- Caused by: --- #set_contextis not available from within an example (e.g. anitblock) or from constructs that run in the scope of an example (e.g.before,let, etc). It is only available on an example group (e.g. adescribeorcontextblock). # ./test.rb:15:inblock (3 levels) in <top (required)>’

Group codes example:
Config::COUNTRY.each do |ctry|
describe “FaveDeal with credit cards” do
User.login_phone_number(‘20190531162452’, “Malaysia”)
sleep(5)
puts available_contexts
set_context(available_contexts[2])
end

Error:
UnknownError: An unknown server-side error occurred while processing the command. Original error: Remote debugger error with code ‘-32601’: ‘Page’ domain was not found
# at getResponseForW3CError (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:826:9)
# at asyncHandler (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:447:37)
# at
# ./test.rb:15:in block (2 levels) in <top (required)>'** **# ./test.rb:5:inblock in <top (required)>'
# ./test.rb:4:in each'** **# ./test.rb:4:in<top (required)>'
# ------------------
# — Caused by: —
** # set_context is not available on an example group (e.g. a describe or context block). It is only available from within individual examples (e.g. it blocks) or from constructs that run in the scope of an example (e.g. before, let, etc).**
** # ./test.rb:15:in `block (2 levels) in <top (required)>’**