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:
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: