Repository: flutter
Issue: [proposal] make flutter compatible with Appium Tests
Labels: a: tests,framework,c: proposal,P2,team-framework,triaged-framework

Hi,

we are writing a new flutter app and want it to be acceptance-tested by a bunch of Appium Tests.
As first we want to test on an iPhone, so we are not sure if the same problem also exsits for Android.

The flutter app cannot be tested because the PageSource always returns the one of the LaunchImage. Although the screenshot in Appium Desktop shows the correct view of the app. We verified it with other flutter apps from the AppStore, they have the same behavior. Means whatever view is open on the app, we always see the same page source.
The page source looks like
```xml
<?xml version="1.0" encoding="UTF-8"?>
<XCUIElementTypeApplication type="XCUIElementTypeApplication" name="test_app" label="test_app" enabled="true" visible="true" x="0" y="0" width="375" height="667">
	<XCUIElementTypeWindow type="XCUIElementTypeWindow" enabled="true" visible="true" x="0" y="0" width="375" height="667">
		<XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="true" x="0" y="0" width="375" height="667"/>
	</XCUIElementTypeWindow>
	<XCUIElementTypeWindow type="XCUIElementTypeWindow" enabled="true" visible="false" x="0" y="0" width="375" height="667">
		<XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" x="0" y="0" width="375" height="667">
			<XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" x="0" y="667" width="375" height="216"/>
		</XCUIElementTypeOther>
	</XCUIElementTypeWindow>
	<XCUIElementTypeWindow type="XCUIElementTypeWindow" enabled="true" visible="true" x="0" y="0" width="375" height="667">
		<XCUIElementTypeStatusBar type="XCUIElementTypeStatusBar" enabled="true" visible="true" x="0" y="0" width="375" height="20">
			<XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" x="0" y="0" width="375" height="20"/>
			<XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="true" x="0" y="0" width="375" height="20">
				<XCUIElementTypeButton type="XCUIElementTypeButton" name="Return to flutter_flat_app" label="Return to flutter_flat_app" enabled="true" visible="true" x="4" y="0" width="101" height="20"/>
				<XCUIElementTypeOther type="XCUIElementTypeOther" value="SSID" name="3 of 3 Wi-Fi bars" label="3 of 3 Wi-Fi bars" enabled="true" visible="true" x="112" y="0" width="15" height="20"/>
				<XCUIElementTypeOther type="XCUIElementTypeOther" name="10:49" label="10:49" enabled="true" visible="true" x="172" y="0" width="34" height="20"/>
				<XCUIElementTypeOther type="XCUIElementTypeOther" name="100% battery power, On AC Power" label="100% battery power, On AC Power" enabled="true" visible="true" x="335" y="0" width="35" height="20"/>
			</XCUIElementTypeOther>
		</XCUIElementTypeStatusBar>
	</XCUIElementTypeWindow>
</XCUIElementTypeApplication>
```
The problem then is that Appium always tells that the elements are not found what is understandable than they are not within the page source.
The app itself is working without any problems when used by hand.

To reproduce:
- Install a flutter app on an attached iPhone.
- Start the Appium Server.
- Start an Appium Session with the capabilities matching the previously installed app.
- Use Appium Desktop to inspect the elements. The app source always looks the same, irrelevant what screen is opened on the app.

We assume, but are not sure, that the WebDriverAgent cannot see correct page source. Appium consumes it to retrieve the page source.

Further, the problem only exists on a real device. When attaching an iOS-simulator the page source is correct and the tests can run.

Could you help us out?
Is this a bug? What is to be done that the page source is correct?

Would be great the get a response because we are stuck here.

Best regards,
Florian