Skip to content

Fix support for running multiple web flows #2270

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jkronborg
Copy link

@jkronborg jkronborg commented Jan 24, 2025

Proposed changes

Support running multiple web flows in one test command. This used to work when using the --device=chromium option, but broke in version 1.39.0 (commit).

Testing

# Workspace containing web flows
maestro test path/to/web-workspace

# Multiple web flows in a directory
maestro test some/directory/web-*.yaml

# Single web flow
maestro test some/directory/web-flow1.yaml

# Workspace containing iOS flows
maestro test path/to/ios-workspace

# Multiple iOS flows in a directory
maestro test some/directory/ios-*.yaml

# Single web flow
maestro test some/directory/ios-flow1.yaml

# A mix of web flows and iOS flows (fails)
maestro test path/to/mixed-workspace

I'm not really familiar with the codebase, so I don't know if this change has any unintended consequences not caught by the tests above.

Automated test coverage of this could be added in #2195.

Issues fixed

#2269

@jkronborg
Copy link
Author

Hi @proksh, thanks for the review. Can I do anything to move this fix forward? This bug has prevented us from updating Maestro since version 1.39.0 which is now more than 5 months old.

@Fishbowler Fishbowler force-pushed the fix-web-workspaces branch from 2b87295 to 568c732 Compare April 8, 2025 13:33
@Fishbowler
Copy link
Contributor

Rebased.

Comment on lines +178 to +198
private fun includesWebFlow(): Boolean {
return flowFiles.any { it.isWebFlow() }
Copy link
Contributor

Choose a reason for hiding this comment

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

When you say the mixed test fails, does it fail because of this check?

Copy link
Author

Choose a reason for hiding this comment

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

The iOS flow seems to fail because ChromeDriver tries to launch the app:

[Failed] iOS flow (2s) (Unable to launch app dk.monsenso.green: invalid argument
(Session info: chrome=135.0.7049.84)
Build info: version: '4.26.0', revision: '8ccf0219d7'
System info: os.name: 'Mac OS X', os.arch: 'aarch64', os.version: '15.4', java.version: '17.0.12'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [53aba667c9efd35da55aab0bc57c99b5, get {url=dk.monsenso.green}]

@jkronborg
Copy link
Author

Thanks for the review @Fishbowler! After the rebase, running a workspace of web flows is broken again due to fa3eb42.

My sample workspace looks like this:

  • 📁 web-workspace
    • 📄 config.yaml
    • 📁 feature1
      • 📄 flow1.yaml
      • 📄 flow2.yaml
    • 📁 feature2
      • 📄 flow3.yaml
      • 📄 flow4.yaml

And config.yaml like this:

flows:
  - '*/*'

The change in the commit I linked above does not traverse further than 1 level and thus never finds the flow files. Do you want me to push a fix for that?

@Fishbowler
Copy link
Contributor

Do you want me to push a fix for that?

That'd be ace!

Moving the extra checks out of the recursion loop, and above the readConfig would solve your problem whilst maintaining the bugfix.

@jkronborg jkronborg requested a review from Fishbowler April 9, 2025 12:20
@jkronborg
Copy link
Author

Do you want me to push a fix for that?

That'd be ace!

Moving the extra checks out of the recursion loop, and above the readConfig would solve your problem whilst maintaining the bugfix.

Alright, done. Feel free to change the code for style reasons or otherwise.

@jkronborg jkronborg force-pushed the fix-web-workspaces branch from 0dfcc9d to 24ec29b Compare April 24, 2025 13:31
@jkronborg
Copy link
Author

Rebased.

@smnatale
Copy link

Has this been merged in?

@jkronborg
Copy link
Author

Has this been merged in?

Nope. Don't know what's holding it up.

Copy link
Contributor

@proksh proksh left a comment

Choose a reason for hiding this comment

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

Hey, quick question — what problem is this change intended to solve?

Right now, web flows aren't running, and iOS flows are picked up by default.

With this change, only web flows will be picked up (if any exist), and iOS flows will be skipped.

Is this the desired behavior? If so, can you clarify the reasoning behind it?

@jkronborg
Copy link
Author

Thanks for getting back to me @proksh.

Hey, quick question — what problem is this change intended to solve?

The problem of maestro test not being able to execute a workspace of web flows or just multiple web flows. This used to work before version 1.39.0, and your documentation states that it's supported.

Right now, web flows aren't running, and iOS flows are picked up by default.

Not sure what you exactly mean, can you elaborate? In my testing using the latest from main, when you execute a workspace consisting of a mix of web flows and Android/iOS flows, no tests are run, unless an Android emulator or iOS simulator is running, in which case the Android/iOS flows are run while the web flows fail.

With this change, only web flows will be picked up (if any exist), and iOS flows will be skipped. Is this the desired behavior? If so, can you clarify the reasoning behind it?

It's true that the behavior of executing a mixed workspace while having an emulator/simulator running changes from "Android/iOS flows are executed, web flows fail" to "web flows are executed, Android/iOS flows fail". But the scenario is already broken today (the overall test run is guaranteed to fail).

My thinking was that it would be a net win to fix the bug, the behavior change mentioned above being a small trade-off.

Copy link
Contributor

@proksh proksh left a comment

Choose a reason for hiding this comment

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

Got it. I think there are a few issues here.

Currently, if someone is working with iOS/Android flows and adds a web flow, the system stops picking up any iOS/Android flows unless the user explicitly specifies a deviceId. That’s definitely inconvenient.

The existing approach checks only for a single web flow. If none is found, it defaults to iOS/Android flows, which is a better fallback and avoids blocking mobile flows.

What might work better is extending this logic: just like we check for web flows, we could also check for iOS and Android flows and automatically include those in the deviceIds.

Hey @dmitry-zaitsev , could you take a look and suggest any improvements here? You probably have more context around this.

@jkronborg
Copy link
Author

Yeah, it would definitely be ideal to add support for mixed workspaces. Alternatively you could add chromium as a device id (like you had in older versions), and support web workspaces when that's set.

@proksh
Copy link
Contributor

proksh commented May 14, 2025

Yeah, it would definitely be ideal to add support for mixed workspaces. Alternatively you could add chromium as a device id (like you had in older versions), and support web workspaces when that's set.

Agree, I will wait for @dmitry-zaitsev response on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants