diff --git a/packages/shorebird_cli/integration_test/shorebird_cli_integration_test.dart b/packages/shorebird_cli/integration_test/shorebird_cli_integration_test.dart index 4a871c4f..670e92f0 100644 --- a/packages/shorebird_cli/integration_test/shorebird_cli_integration_test.dart +++ b/packages/shorebird_cli/integration_test/shorebird_cli_integration_test.dart @@ -54,145 +54,149 @@ void main() { expect(result.exitCode, equals(0)); }); - test('create an app with a release and patch', () async { - final authToken = Platform.environment['SHOREBIRD_TOKEN']; - if (authToken == null || authToken.isEmpty) { - throw Exception('SHOREBIRD_TOKEN environment variable is not set.'); - } + test( + 'create an app with a release and patch', + () async { + final authToken = Platform.environment['SHOREBIRD_TOKEN']; + if (authToken == null || authToken.isEmpty) { + throw Exception('SHOREBIRD_TOKEN environment variable is not set.'); + } - final uuid = const Uuid().v4().replaceAll('-', '_'); - final testAppName = 'test_app_$uuid'; - final tempDir = Directory.systemTemp.createTempSync(); - final subDirWithSpace = Directory(p.join(tempDir.path, 'flutter directory')) - ..createSync(); - var cwd = subDirWithSpace.path; + final uuid = const Uuid().v4().replaceAll('-', '_'); + final testAppName = 'test_app_$uuid'; + final tempDir = Directory.systemTemp.createTempSync(); + final subDirWithSpace = + Directory(p.join(tempDir.path, 'flutter directory'))..createSync(); + var cwd = subDirWithSpace.path; - // Create the default flutter counter app - logger.info('running `flutter create $testAppName` in $cwd'); - final createAppResult = runCommand( - 'flutter create $testAppName', - workingDirectory: cwd, - ); - expect(createAppResult.stderr, isEmpty); - expect(createAppResult.exitCode, equals(0)); + // Create the default flutter counter app + logger.info('running `flutter create $testAppName` in $cwd'); + final createAppResult = runCommand( + 'flutter create $testAppName', + workingDirectory: cwd, + ); + expect(createAppResult.stderr, isEmpty); + expect(createAppResult.exitCode, equals(0)); - cwd = p.join(cwd, testAppName); + cwd = p.join(cwd, testAppName); - // Initialize Shorebird - final initShorebirdResult = runCommand( - 'shorebird init', - workingDirectory: cwd, - ); - expect(initShorebirdResult.stderr, isEmpty); - expect(initShorebirdResult.exitCode, equals(0)); + // Initialize Shorebird + final initShorebirdResult = runCommand( + 'shorebird init', + workingDirectory: cwd, + ); + expect(initShorebirdResult.stderr, isEmpty); + expect(initShorebirdResult.exitCode, equals(0)); - final shorebirdYamlPath = p.join(cwd, 'shorebird.yaml'); - final shorebirdYamlText = File(shorebirdYamlPath).readAsStringSync(); - final shorebirdYaml = checkedYamlDecode( - shorebirdYamlText, - (m) => ShorebirdYaml.fromJson(m!), - ); + final shorebirdYamlPath = p.join(cwd, 'shorebird.yaml'); + final shorebirdYamlText = File(shorebirdYamlPath).readAsStringSync(); + final shorebirdYaml = checkedYamlDecode( + shorebirdYamlText, + (m) => ShorebirdYaml.fromJson(m!), + ); - // Verify that we have no releases for this app - await expectLater( - runWithOverrides(client.getApps), - completion( - equals([ - isA() - .having( - (a) => a.appId, - 'appId', - shorebirdYaml.appId, - ) - .having( - (a) => a.latestReleaseVersion, - 'latestReleaseVersion', - null, - ) - .having( - (a) => a.latestPatchNumber, - 'latestPatchNumber', - null, - ), - ]), - ), - ); + // Verify that we have no releases for this app + await expectLater( + runWithOverrides(client.getApps), + completion( + equals([ + isA() + .having( + (a) => a.appId, + 'appId', + shorebirdYaml.appId, + ) + .having( + (a) => a.latestReleaseVersion, + 'latestReleaseVersion', + null, + ) + .having( + (a) => a.latestPatchNumber, + 'latestPatchNumber', + null, + ), + ]), + ), + ); - // Create an Android release. - final shorebirdReleaseResult = runCommand( - 'shorebird release android --force', - workingDirectory: cwd, - ); - expect(shorebirdReleaseResult.stderr, isEmpty); - expect(shorebirdReleaseResult.stdout, contains('Published Release!')); - expect(shorebirdReleaseResult.exitCode, equals(0)); + // Create an Android release. + final shorebirdReleaseResult = runCommand( + 'shorebird release android --force', + workingDirectory: cwd, + ); + expect(shorebirdReleaseResult.stderr, isEmpty); + expect(shorebirdReleaseResult.stdout, contains('Published Release!')); + expect(shorebirdReleaseResult.exitCode, equals(0)); - // Verify that the release was created. - await expectLater( - runWithOverrides(client.getApps), - completion( - equals([ - isA() - .having( - (a) => a.appId, - 'appId', - shorebirdYaml.appId, - ) - .having( - (a) => a.latestReleaseVersion, - 'latestReleaseVersion', - '1.0.0+1', - ) - .having( - (a) => a.latestPatchNumber, - 'latestPatchNumber', - null, - ), - ]), - ), - ); + // Verify that the release was created. + await expectLater( + runWithOverrides(client.getApps), + completion( + equals([ + isA() + .having( + (a) => a.appId, + 'appId', + shorebirdYaml.appId, + ) + .having( + (a) => a.latestReleaseVersion, + 'latestReleaseVersion', + '1.0.0+1', + ) + .having( + (a) => a.latestPatchNumber, + 'latestPatchNumber', + null, + ), + ]), + ), + ); - // Create an Android patch. - final shorebirdPatchResult = runCommand( - 'shorebird patch android --force', - workingDirectory: cwd, - ); - expect(shorebirdPatchResult.stderr, isEmpty); - expect(shorebirdPatchResult.stdout, contains('Published Patch!')); - expect(shorebirdPatchResult.exitCode, equals(0)); + // Create an Android patch. + final shorebirdPatchResult = runCommand( + 'shorebird patch android --force', + workingDirectory: cwd, + ); + expect(shorebirdPatchResult.stderr, isEmpty); + expect(shorebirdPatchResult.stdout, contains('Published Patch!')); + expect(shorebirdPatchResult.exitCode, equals(0)); - // Verify that the patch was created. - await expectLater( - runWithOverrides(client.getApps), - completion( - equals([ - isA() - .having( - (a) => a.appId, - 'appId', - shorebirdYaml.appId, - ) - .having( - (a) => a.latestReleaseVersion, - 'latestReleaseVersion', - '1.0.0+1', - ) - .having( - (a) => a.latestPatchNumber, - 'latestPatchNumber', - 1, - ), - ]), - ), - ); + // Verify that the patch was created. + await expectLater( + runWithOverrides(client.getApps), + completion( + equals([ + isA() + .having( + (a) => a.appId, + 'appId', + shorebirdYaml.appId, + ) + .having( + (a) => a.latestReleaseVersion, + 'latestReleaseVersion', + '1.0.0+1', + ) + .having( + (a) => a.latestPatchNumber, + 'latestPatchNumber', + 1, + ), + ]), + ), + ); - // Delete the app to clean up after ourselves. - await expectLater( - runWithOverrides(() => client.deleteApp(appId: shorebirdYaml.appId)), - completes, - ); + // Delete the app to clean up after ourselves. + await expectLater( + runWithOverrides(() => client.deleteApp(appId: shorebirdYaml.appId)), + completes, + ); - // Verify that the app was deleted. - await expectLater(runWithOverrides(client.getApps), completion(isEmpty)); - }); + // Verify that the app was deleted. + await expectLater(runWithOverrides(client.getApps), completion(isEmpty)); + }, + timeout: const Timeout(Duration(minutes: 5)), + ); }