Return a W3C driver which is generated by a mock response for Flutter Returns: `webdriver.webdriver.WebDriver`: An instance of WebDriver
()
| 151 | |
| 152 | |
| 153 | def flutter_w3c_driver() -> 'WebDriver': |
| 154 | """Return a W3C driver which is generated by a mock response for Flutter |
| 155 | |
| 156 | Returns: |
| 157 | `webdriver.webdriver.WebDriver`: An instance of WebDriver |
| 158 | """ |
| 159 | |
| 160 | response_body_json = json.dumps( |
| 161 | { |
| 162 | 'sessionId': '1234567890', |
| 163 | 'capabilities': { |
| 164 | 'platform': 'LINUX', |
| 165 | 'desired': { |
| 166 | 'platformName': 'Android', |
| 167 | 'autoGrantPermissions': True, |
| 168 | 'flutterSystemPort': 9999, |
| 169 | 'flutterElementWaitTimeout': 10000, |
| 170 | 'flutterEnableMockCamera': True, |
| 171 | 'flutterServerLaunchTimeout': 120000, |
| 172 | 'automationName': 'FlutterIntegration', |
| 173 | 'platformVersion': '7.1.1', |
| 174 | 'deviceName': 'Android Emulator', |
| 175 | 'app': '/test/apps/ApiDemos-debug.apk', |
| 176 | }, |
| 177 | 'platformName': 'Android', |
| 178 | 'automationName': 'FlutterIntegration', |
| 179 | 'platformVersion': '7.1.1', |
| 180 | 'deviceName': 'emulator-5554', |
| 181 | 'app': '/test/apps/ApiDemos-debug.apk', |
| 182 | 'deviceUDID': 'emulator-5554', |
| 183 | 'appPackage': 'io.appium.android.apis', |
| 184 | 'appWaitPackage': 'io.appium.android.apis', |
| 185 | }, |
| 186 | } |
| 187 | ) |
| 188 | |
| 189 | httpretty.register_uri(httpretty.POST, appium_command('/session'), body=response_body_json) |
| 190 | |
| 191 | desired_caps = { |
| 192 | 'platformName': 'Android', |
| 193 | 'deviceName': 'Android Emulator', |
| 194 | 'app': 'path/to/app', |
| 195 | 'automationName': 'FlutterIntegration', |
| 196 | } |
| 197 | |
| 198 | driver = webdriver.Remote(SERVER_URL_BASE, options=UiAutomator2Options().load_capabilities(desired_caps)) |
| 199 | return driver |
| 200 | |
| 201 | |
| 202 | def get_httpretty_request_body(request: 'HTTPrettyRequestEmpty') -> Dict[str, Any]: |
no test coverage detected