spot icon indicating copy to clipboard operation
spot copied to clipboard

Cannot generate timeline in integration_test

Open MaxLap opened this issue 1 year ago • 3 comments

I didn't find much information about integration tests on this package other than "full compatibility", so maybe I'm doing something wrong.

(I'm on Windows, testing on android emulator)

When I have an error during the tests, the timeline generation fails with:

FileSystemException: Creation failed, path = '/build' (OS Error: Read-only file system, errno = 30)
  dart:io                                                                                                      _Directory.createSync
  package:spot/src/timeline/html/print_html.dart 50:17                                                         HtmlTimelinePrinter.printHTML
  package:spot/src/timeline/timeline.dart 321:15                                                               _Timeline._onPostTest.reportOnError

The command I use is flutter test integration_test --flavor=integration.

Putting some prints, what I can notice is that when running integration_tests, the current working directory not the same as during regular tests. It's only "/" (and the error mention being read-only). I guess this makes sense since the code is running on an emulator. Is there a way to make the timeline work in integration tests? I feel that's where it is most important since those tests are usually more complex. If it's not possible, I would suggest mentionning it somewhere in the readme.

MaxLap avatar Apr 27 '25 13:04 MaxLap

I disabled timeline generation when executed on a device. All other spot features are available.

I don't see a clear path how to transfer the timeline back to the host system. AFAIK there is now code running on the host system which could receive it.

passsy avatar May 06 '25 14:05 passsy

I recently learned that the host can be reached via 10.0.2.2 for android emulators. I would guess there is something similar for iOS.

If there is no way to run code on the host as part of integration tests (I haven't looked into it), then spot could have a command to run the tests, and that command to launch a server to receive the data via an http request and then dump it where it make sense.

MaxLap avatar May 10 '25 12:05 MaxLap

I just realized that widget testing can test most things. I thought that since I wanted to test using the app, I needed integration tests but since the app is just a widget... I don't actually know when integration testing is needed...

Basically, I don't need this anymore.

MaxLap avatar May 10 '25 18:05 MaxLap

Not crashing anymore in 0.18.0

passsy avatar May 28 '25 00:05 passsy