Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

nturgut
Copy link
Contributor

@nturgut nturgut commented May 28, 2020

This only works if the simulator is already created/booted.
(1) For this to work in local, I'll edit web_installers and add code to create/boot simulators.
(2) For this to work on LUCI, I'll change the recipe and the bot configurations.

Usage

felt test --browser=ios-safari

felt test --browser=ios-safari test/alarm_clock_test.dart

note: I closed the previous PR:#17454 since this approach is better.

@nturgut nturgut requested a review from yjbanov May 28, 2020 18:29
]);

return process;
if (mobileBrowser) { // iOS-Safari
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's worth documenting that we are launching the mobile Safari in a simulator, not a physical device.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this line:

Uses `xcrun simctl`. It is a command line utility to control the
Simulator. For more details on interacting with the simulator

// TODO(nurhan): https://github.com/flutter/flutter/issues/50809
var process = await Process.start(installation.executable, [
'-F', // Open a fresh application with no persistant state.
'-W', // Open to wait until the applications it opens.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...it opens exits.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually the comment is true. may be not very informative. It means open tool to wait until the application opens. let me add more details.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated all the comments, I hope they look ok now.

// a popup which halts the test.
// The following list of arguments needs to be provided to the `open` command
// to open Safari for a given URL. In summary they provide a new instance
// to open, that instance to wait for opening the url until Safari launches,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is an "instance"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it means a new Safari process. From the the man tool for open command line tool:

 -n, --new         Open a new instance of the application even if one is already running.

throw Exception('${runtime.name} exited before connecting.');
// For the cases where we use a delegator such as `adb` (for Android) or
// `xcrun` (for IOS), these delegator processes can shut down before the
// websocket is available.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should remove onExit from Browser's interface. If the Browser object does not actually represent the browser process, and its onExit may or may not indicate the browser exiting it becomes unreliable, and the warning messages misleading. Timeouts like this only lead to flakiness.

Instead, a concrete implementation of the Browser can internally perform these checks and handshakes as appropriate. Those implementations that launch the browser process directly will use the current method, and those using adb or xcrun will use something else.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done (removed the on exit, just left comments there. I can also remove them if you think it's better)
Browser currently run checks on the exitCode and fails if it exists with non-zero code. I think that check should be enough. Since regardless of Chrome Browser of xcrun, nothing should
exit with a non-zero code.


browser.onExit.then((_) {
throw Exception('${runtime.name} exited before connecting.');
// For the cases where we use a delegator such as `adb` (for Android) or
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The closure passed to .then() is empty (except the comment). Let's remove it and move the comment outside.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done. thanks

@nturgut nturgut force-pushed the ios_unit_tests_another_approach branch from 388589d to 46c36e9 Compare June 1, 2020 21:37
@nturgut
Copy link
Contributor Author

nturgut commented Jun 1, 2020

Looks like there is an infra failure on Mac iOS Engine . This PR is about test tools about Flutter Web engine, does not change the engine codes. Merging the PR.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants