Skip to content

Cannot addValue() in iOS simulator #103

Open
@lmendes21

Description

@lmendes21

I cannot add text to input fields using an iOS simulator. The action itself of .addValue() returns 200OK in the logs however this value is not being set on the UI, breaking my test case.

I tried adding the value to the element while finding it by:

Just wanted to note as well, that while using Appium inspector with the main app the "Send keys" works as expected, when using it with the appium app I send key, there is no error but they are not added to the UI.

My test:

async enterEmail(email) {
        const emailField = await browser.$("//XCUIElementTypeTextField[@name='Email address, required field']");
        await emailField.click();
        await emailField.clearValue();
        await emailField.addValue(email);
        browser.pause(1000);
        expect(await emailField.getValue()).toEqual(email);
    }

a Snippet of how I'm setting appium.dart

    initializeTest(
      app: MultiProvider(
        providers: ExampleApp.provider.providers,
        child: const MyApp(),
      ),
    );

My iOS capabilities:

export const config = {
  ...baseCapabilities,
  capabilities: [
    {
      platformName: "iOS",
      "appium:deviceName": "iPhone 16 Pro",
      "appium:automationName": "FlutterIntegration",
      "appium:platformVersion": "18.1",
      "appium:appiumFlutterDriver": 120000,
      "appium:app": '../build/ios/iphonesimulator/Runner.app',
      maxInstances: 5,
    },
  ],
  connectionRetryTimeout: 180000, // 3 minutes
  connectionRetryCount: 3
}

When the the test is running and the addValue is happening this is what I can see in the screen, then the test fails because the text was not added in the UI.
image

Appium version: 2.12.1
devDependencies: 
      appium_flutter_server: ^0.0.27

The snippet where the test fails:

2024-11-18T12:21:02.269Z DEBUG @wdio/appium-service: [f7c33aa9][AppiumFlutterDriver@fba9] Calling AppiumDriver.setValue() with args: ["[email protected]","14000000-0000-0000-1D6F-000000000000","f7c33aa9-247a-4f70-8f42-ede9d5ac4be6"]

2024-11-18T12:21:02.270Z DEBUG @wdio/appium-service: [f7c33aa9][XCUITestDriver@509d] Matched '/element/14000000-0000-0000-1D6F-000000000000/value' to command name 'setValue'

2024-11-18T12:21:02.270Z DEBUG @wdio/appium-service: [f7c33aa9][XCUITestDriver@509d] Proxying [POST /element/14000000-0000-0000-1D6F-000000000000/value] to [POST http://127.0.0.1:8100/session/442EE3C3-56D7-4F52-BCC9-5C9A711A8D40/element/14000000-0000-0000-1D6F-000000000000/value] with body: {"text":"[email protected]","value":["t","e","s","t","@","g","m","a","i","l",".","c","o","m"]}

2024-11-18T12:21:03.334Z DEBUG @wdio/appium-service: [f7c33aa9][XCUITestDriver@509d] Got response with status 200: {"value":null,"sessionId":"442EE3C3-56D7-4F52-BCC9-5C9A711A8D40"}

2024-11-18T12:21:03.335Z DEBUG @wdio/appium-service: [f7c33aa9][AppiumFlutterDriver@fba9] Responding to client with driver.setValue() result: null

2024-11-18T12:21:03.335Z DEBUG @wdio/appium-service: [f7c33aa9][HTTP] <-- POST /session/f7c33aa9-247a-4f70-8f42-ede9d5ac4be6/element/14000000-0000-0000-1D6F-000000000000/value 200 1066 ms - 14 

[0-0] 2024-11-18T12:21:03.336Z INFO webdriver: RESULT null
[0-0] 2024-11-18T12:21:03.337Z INFO webdriver: COMMAND getElementAttribute("14000000-0000-0000-1D6F-000000000000", "value")
[0-0] 2024-11-18T12:21:03.337Z INFO webdriver: [GET] http://127.0.0.1:4723/session/f7c33aa9-247a-4f70-8f42-ede9d5ac4be6/element/14000000-0000-0000-1D6F-000000000000/attribute/value
2024-11-18T12:21:03.340Z DEBUG @wdio/appium-service: [f7c33aa9][HTTP] --> GET /session/f7c33aa9-247a-4f70-8f42-ede9d5ac4be6/element/14000000-0000-0000-1D6F-000000000000/attribute/value {}

2024-11-18T12:21:03.340Z DEBUG @wdio/appium-service: [f7c33aa9][AppiumFlutterDriver@fba9] Calling AppiumDriver.getAttribute() with args: ["value","14000000-0000-0000-1D6F-000000000000","f7c33aa9-247a-4f70-8f42-ede9d5ac4be6"]

2024-11-18T12:21:03.342Z DEBUG @wdio/appium-service: [f7c33aa9][XCUITestDriver@509d] Matched '/element/14000000-0000-0000-1D6F-000000000000/attribute/value' to command name 'getAttribute'

2024-11-18T12:21:03.343Z DEBUG @wdio/appium-service: [f7c33aa9][XCUITestDriver@509d] Proxying [GET /element/14000000-0000-0000-1D6F-000000000000/attribute/value] to [GET http://127.0.0.1:8100/session/442EE3C3-56D7-4F52-BCC9-5C9A711A8D40/element/14000000-0000-0000-1D6F-000000000000/attribute/value] with no body

2024-11-18T12:21:03.372Z DEBUG @wdio/appium-service: [f7c33aa9][XCUITestDriver@509d] Got response with status 200: {"value":null,"sessionId":"442EE3C3-56D7-4F52-BCC9-5C9A711A8D40"}

2024-11-18T12:21:03.372Z DEBUG @wdio/appium-service: [f7c33aa9][AppiumFlutterDriver@fba9] Responding to client with driver.getAttribute() result: null

2024-11-18T12:21:03.373Z DEBUG @wdio/appium-service: [f7c33aa9][HTTP] <-- GET /session/f7c33aa9-247a-4f70-8f42-ede9d5ac4be6/element/14000000-0000-0000-1D6F-000000000000/attribute/value 200 33 ms - 14 

[0-0] 2024-11-18T12:21:03.374Z INFO webdriver: RESULT null
[0-0] Error in "Login Test.should login successfully with valid credentials"
Error: expect(received).toEqual(expected) // deep equality

Expected: "[email protected]"
Received: null
[0-0] 2024-11-18T12:21:03.385Z DEBUG @wdio/utils:shim: Finished to run "after" hook in 0ms
[0-0] 2024-11-18T12:21:03.385Z INFO webdriver: COMMAND deleteSession()
[0-0] 2024-11-18T12:21:03.385Z INFO webdriver: [DELETE] http://127.0.0.1:4723/session/f7c33aa9-247a-4f70-8f42-ede9d5ac4be6
2024-11-18T12:21:03.386Z DEBUG @wdio/appium-service: [f7c33aa9][HTTP] --> DELETE /session/f7c33aa9-247a-4f70-8f42-ede9d5ac4be6 {}

2024-11-18T12:21:03.386Z DEBUG @wdio/appium-service: [f7c33aa9][AppiumFlutterDriver@fba9] Calling AppiumDriver.deleteSession() with args: ["f7c33aa9-247a-4f70-8f42-ede9d5ac4be6"]

2024-11-18T12:21:03.386Z DEBUG @wdio/appium-service: [f7c33aa9][AppiumDriver@b722] Event 'quitSessionRequested' logged at 1731932463386 (12:21:03 GMT+0000 (Western European Standard Time))

2024-11-18T12:21:03.387Z DEBUG @wdio/appium-service: [f7c33aa9][AppiumDriver@b722] Removing session f7c33aa9-247a-4f70-8f42-ede9d5ac4be6 from our master session list

2024-11-18T12:21:03.388Z DEBUG @wdio/appium-service: [f7c33aa9][XCUITestDriver@509d] Matched '/session/e7d90dc7-0b5a-4a82-a718-53f797c5d584' to command name 'deleteSession'

2024-11-18T12:21:03.388Z DEBUG @wdio/appium-service: [f7c33aa9][XCUITestDriver@509d] Proxying [DELETE /session/e7d90dc7-0b5a-4a82-a718-53f797c5d584] to [DELETE http://127.0.0.1:8100/session/442EE3C3-56D7-4F52-BCC9-5C9A711A8D40] with no body

2024-11-18T12:21:04.492Z DEBUG @wdio/appium-service: [f7c33aa9][XCUITestDriver@509d] Got response with status 200: {"value":null,"sessionId":null}

2024-11-18T12:21:04.492Z DEBUG @wdio/appium-service: [f7c33aa9][DevCon Factory] Releasing connections for 9A9C5ADC-DB02-476E-A6F1-E6223D77AFC9 device on any port number

2024-11-18T12:21:04.492Z DEBUG @wdio/appium-service: [f7c33aa9][DevCon Factory] Found cached connections to release: ["9A9C5ADC-DB02-476E-A6F1-E6223D77AFC9:8100"]

2024-11-18T12:21:04.493Z DEBUG @wdio/appium-service: [f7c33aa9][DevCon Factory] Cached connections count: 0

2024-11-18T12:21:04.493Z DEBUG @wdio/appium-service: [f7c33aa9][XCUITestDriver@509d] Not clearing log files. Use `clearSystemFiles` capability to turn on.

2024-11-18T12:21:04.493Z DEBUG @wdio/appium-service: [f7c33aa9][XCUITestDriver@509d] Stopping iOS log capture

2024-11-18T12:21:04.508Z DEBUG @wdio/appium-service: [f7c33aa9][AppiumDriver@b722] Event 'quitSessionFinished' logged at 1731932464507 (12:21:04 GMT+0000 (Western European Standard Time))

2024-11-18T12:21:04.508Z DEBUG @wdio/appium-service: [f7c33aa9][AppiumDriver@b722] Received response: null
[f7c33aa9][AppiumDriver@b722] But deleting session, so not returning

2024-11-18T12:21:04.508Z DEBUG @wdio/appium-service: [f7c33aa9][AppiumDriver@b722] Responding to client with driver.deleteSession() result: null

2024-11-18T12:21:04.509Z DEBUG @wdio/appium-service: [f7c33aa9][HTTP] <-- DELETE /session/f7c33aa9-247a-4f70-8f42-ede9d5ac4be6 200 1122 ms - 14 

[0-0] 2024-11-18T12:21:04.510Z INFO webdriver: RESULT null
2024-11-18T12:21:04.622Z DEBUG @wdio/local-runner: Runner 0-0 finished with exit code 1
[0-0] FAILED in iOS - file:///test/specs/login.spec.js
2024-11-18T12:21:04.622Z INFO @wdio/cli:launcher: Run onWorkerEnd hook
2024-11-18T12:21:04.623Z DEBUG @wdio/cli:utils: Finished to run "onWorkerEnd" hook in 0ms
2024-11-18T12:21:04.623Z INFO @wdio/cli:launcher: Run onComplete hook
2024-11-18T12:21:04.623Z INFO @wdio/appium-service: Killing entire Appium tree
2024-11-18T12:21:04.625Z DEBUG @wdio/cli:utils: Finished to run "onComplete" hook in 2ms

 "spec" Reporter:
------------------------------------------------------------------
[Runner.app iOS #0-0] Running: Runner.app on iOS
[Runner.app iOS #0-0] Session ID: f7c33aa9-247a-4f70-8f42-ede9d5ac4be6
[Runner.app iOS #0-0]
[Runner.app iOS #0-0] » /test/specs/login.spec.js
[Runner.app iOS #0-0] Login Test
[Runner.app iOS #0-0]    ✖ should login successfully with valid credentials
[Runner.app iOS #0-0]
[Runner.app iOS #0-0] 1 failing (9.7s)
[Runner.app iOS #0-0]
[Runner.app iOS #0-0] 1) Login Test should login successfully with valid credentials
[Runner.app iOS #0-0] expect(received).toEqual(expected) // deep equality

Expected: "[email protected]"
Received: null
[Runner.app iOS #0-0] Error: expect(received).toEqual(expected) // deep equality
[Runner.app iOS #0-0]
[Runner.app iOS #0-0] Expected: "[email protected]"
[Runner.app iOS #0-0] Received: null

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions