Skip to content
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

spike: investigate if Fluttium can run on CI #185

Open
2 tasks
wolfenrain opened this issue Feb 24, 2023 · 19 comments
Open
2 tasks

spike: investigate if Fluttium can run on CI #185

wolfenrain opened this issue Feb 24, 2023 · 19 comments
Labels
question Further information is requested

Comments

@wolfenrain
Copy link
Owner

Description

I haven't actively explored if Fluttium can run on CI, in theory it should but it might need some minor code changes on the CLI side to make that a more streamlined experience.

Requirements

  • Test Fluttium on the CI
  • Make the visual experience useful on the CI
@wolfenrain wolfenrain added the question Further information is requested label Feb 24, 2023
@github-project-automation github-project-automation bot moved this to Triage in Overview Mar 11, 2023
@wolfenrain wolfenrain moved this from Triage to Todo in Overview Mar 11, 2023
@wolfenrain wolfenrain moved this from Todo to In Progress in Overview Mar 11, 2023
@matthiasn
Copy link

@wolfenrain I'm using Fluttium in CI, in Buildkite and it's working well, even when other tests are running in parallel. This is the pipeline step running Fluttium.

My only wish at the moment would be to get higher resolution screenshots, as they are pixelated and low-resolution now. Or even better, capture in the same way that Shift-Command-4 and then space on a Mac would give me, with a pleasing shadow and space around the window, and with an alpha channel.

@matthiasn
Copy link

Thanks for the library, super helpful.

@wolfenrain
Copy link
Owner Author

@wolfenrain I'm using Fluttium in CI, in Buildkite and it's working well, even when other tests are running in parallel. This is the pipeline step running Fluttium.

My only wish at the moment would be to get higher resolution screenshots, as they are pixelated and low-resolution now. Or even better, capture in the same way that Shift-Command-4 and then space on a Mac would give me, with a pleasing shadow and space around the window, and with an alpha channel.

Oh that is interesting! Glad to know it is running in some CI situations already!!

The screenshots are being taken directly from the device (using the RepaintBoundary) so I am not sure why the resolution would be lower? Can you show some examples related to it?

@matthiasn
Copy link

Sure, here's an example:

habits

I think I found a fix, see this commit in the fork I just created. Came across that in this Flutter issue. Testing now, will know in a few if working.

@wolfenrain
Copy link
Owner Author

Ah yes! We should probably use https://api.flutter.dev/flutter/widgets/MediaQueryData/devicePixelRatio.html if we can access it somehow!

@matthiasn
Copy link

I can confirm that it works fine after just editing the respective file in .pub-cache, as I didn't want to learn how to assemble the fluttium-cli right now.

habits

It also works fine when setting to pixelRatio: 3, with the images larger, as expected. Maybe use 2 as a sensible default and make it configurable? Or 3 as a default, as long as the quality is good enough. Would you accept a PR just changing the default? Didn't figure out at a quick glance how parameters are passed to actions.

@wolfenrain
Copy link
Owner Author

I would opt to default to the pixel ratio of the device and then have people pass it as a parameter if they want to override it.

Parameters are automatically passed to actions, so if you add it to the constructor it will be automatically available in the yaml.

We can access the pixel ratio if we expose media query data on the Tester:

class Tester {
  ...

  MediaQueryData get mediaQuery => MediaQueryData.fromWindow(_bindings.instance.window); 

  ...
}

@matthiasn
Copy link

Thanks, where would I add that in my project?

@wolfenrain
Copy link
Owner Author

That is meant to go into Fluttium itself haha, to expose information about the device, so we can access the devicePixelRatio in the screenshot action

@matthiasn
Copy link

Hehe cool, yeah once that lands the pixel ratio from the device will probably suffice anyway. Until then my hack editing the file directly on my CI is fine, thanks 🙏

@wolfenrain
Copy link
Owner Author

wolfenrain commented Apr 11, 2023

Will be available once #229 lands!

@matthiasn
Copy link

Wow, that was fast, thanks a lot!

@matthiasn
Copy link

@wolfenrain there's a potential improvement that could be made for running in CI. Currently, my test flow running in CI (Buildkite) results in roughly 142K lines of log output, which is a bit excessive (and might also slow things down noticeably). Buildkite deals rather gracefully by only showing the last 1MB of logs in the UI and still allowing to download the entire log file.

Could the excessive logging be reduced? I did try the --no-verbose switch suggested by the CLI but that's already used in the scenario reported above.

@wolfenrain
Copy link
Owner Author

@wolfenrain there's a potential improvement that could be made for running in CI. Currently, my test flow running in CI (Buildkite) results in roughly 142K lines of log output, which is a bit excessive (and might also slow things down noticeably). Buildkite deals rather gracefully by only showing the last 1MB of logs in the UI and still allowing to download the entire log file.

Could the excessive logging be reduced? I did try the --no-verbose switch suggested by the CLI but that's already used in the scenario reported above.

Are you running with the expanded reporter? fluttium test --reporter expanded (which on a old-school CI would be the default. That reporter is pretty non-verbose as it only prints for each new step and an additional one if it fails:
image

@matthiasn
Copy link

@wolfenrain great thanks, that works well, now I only have just over 200 lines of logs for the same test flow.

@matthiasn
Copy link

@wolfenrain when I use --reporter expanded, screenshots are no longer being taken though.

@wolfenrain
Copy link
Owner Author

@wolfenrain when I use --reporter expanded, screenshots are no longer being taken though.

Can you open a new issue for that with a reproducible example? The reporter should not influence that

@matthiasn
Copy link

@wolfenrain done, thanks 🤓

@iam-shanmichael
Copy link

hi @wolfenrain,

i have question this might be out of conversation topic, Can Fluttium mock an authentication process
example your integration testing will start on login screen and otp is required for this process, my question is how i can mock an otp in fluttium that authentication api will accept hope you get my point looking forward for your positive response thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
Status: In Progress
Development

No branches or pull requests

3 participants