0

I want my Integration Test to run whenever the Bitbucket Pipeline is triggered.

This is my bitbucket-pipelines.yaml file:

definitions:
  services:
    docker:
      memory: 4096
  steps:
  - step: &generate_code
      name: 'generate_code'
      script:
        - flutter clean
        - flutter pub get
        - flutter pub run build_runner build
        - bash <(curl -s https://raw.githubusercontent.com/objectbox/objectbox-dart/main/install.sh)
        - flutter test
        - git clone git@bitbucket.org:connfair/${CI_PROJECT_NAMESPACE}.git .signing
        - flutter drive \
          --driver=test_driver/integration_test.dart \
          --target=test_driver/run_all_test.dart
      artifacts:
        - lib/**.g.dart
        - lib/**.i18n.dart

This is my folder structure:

enter image description here

This is my integration_test.dart file:

Future<void> main() => integrationDriver();

In the run_all_test.dart file im keeping all my tests:

void main() {
  IntegrationTestWidgetsFlutterBinding.ensureInitialized();
  initAppWithMockConfig(config: MockConfig1());
  loginFailureTest();
  loginSuccessTest();
  eventSearchTest(); 
  eventStatisticsAuthorizationTest();
  ticketScannerAuthorizationTest();
}

This is how one of these tests looks like for example:

void eventSearchTest() {
  testWidgets("After choosing an event from the event search delegate, "
      "the event's name gets displayed 2 times: in the event dashbaord and in the appbar.",
          (WidgetTester tester) async {

        await tester.pumpWidget(
          wrapWithUser(wrapWithProviders(wrapWithApp(MainframeContent()))),
        );
        await tester.pumpAndSettle();

        await selectEventFromDashboard(tester, getValidEventId());

        expect(find.text(getValidEventName()), findsWidgets);
      });
}

When I run

  • flutter drive
    --driver=test_driver/integration_test.dart
    --target=test_driver/run_all_test.dart

in the Terminal while an emulator is open everything works fine. But when I let the pipeline run with the same comment Im getting an Error. I also tried adding build apk before my flutter drive command. This is the error im getting:

enter image description here

Yuki
  • 255
  • 1
  • 2
  • 9
  • You could try running `pwd` or `ls` first to verify that you are in the correct place since the error here is that the file is not found. Once you know where you script is running you can adjust your command to point at the dart file properly. – M B Apr 04 '23 at 03:43
  • I did that. The integration_test.dart file is there. – Yuki Apr 04 '23 at 10:41

0 Answers0