[go: nahoru, domu]

Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Enable testing on both master and stable #2197

Merged
merged 14 commits into from
Oct 16, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add back in a line that shouldn't have been deleted
  • Loading branch information
collinjackson committed Oct 16, 2019
commit 534aa6d2c758e0a7173f6a1ea6cccea9e57b3b95
1 change: 1 addition & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ task:
upgrade_script:
- flutter channel $CHANNEL
- flutter upgrade
- git fetch origin master
activate_script:
- pub global activate flutter_plugin_tools
create_simulator_script:
Expand Down
76 changes: 76 additions & 0 deletions packages/path_provider/test/path_provider_e2e.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// Copyright 2019, the Chromium project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'dart:async';

import 'dart:io';
import 'package:flutter_driver/driver_extension.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:path_provider/path_provider.dart';
import 'package:uuid/uuid.dart';
import 'package:e2e/e2e.dart';

void main() {
E2ETestWidgetsFlutterBinding.ensureInitialized();

test('getTemporaryDirectory', () async {
final Directory result = await getTemporaryDirectory();
final String uuid = Uuid().v1();
final File file = File('${result.path}/$uuid.txt');
file.writeAsStringSync('Hello world!');
expect(file.readAsStringSync(), 'Hello world!');
expect(result.listSync(), isNotEmpty);
file.deleteSync();
});

test('getApplicationDocumentsDirectory', () async {
final Directory result = await getApplicationDocumentsDirectory();
final String uuid = Uuid().v1();
final File file = File('${result.path}/$uuid.txt');
file.writeAsStringSync('Hello world!');
expect(file.readAsStringSync(), 'Hello world!');
expect(result.listSync(), isNotEmpty);
file.deleteSync();
});

test('getApplicationSupportDirectory', () async {
final Directory result = await getApplicationSupportDirectory();
final String uuid = Uuid().v1();
final File file = File('${result.path}/$uuid.txt');
file.writeAsStringSync('Hello world!');
expect(file.readAsStringSync(), 'Hello world!');
expect(result.listSync(), isNotEmpty);
file.deleteSync();
});

test('getLibraryDirectory', () async {
if (Platform.isIOS) {
final Directory result = await getLibraryDirectory();
final String uuid = Uuid().v1();
final File file = File('${result.path}/$uuid.txt');
file.writeAsStringSync('Hello world!');
expect(file.readAsStringSync(), 'Hello world!');
expect(result.listSync(), isNotEmpty);
file.deleteSync();
} else if (Platform.isAndroid) {
final Future<Directory> result = getLibraryDirectory();
expect(result, throwsA(isInstanceOf<UnsupportedError>()));
}
});

test('getExternalStorageDirectory', () async {
if (Platform.isIOS) {
final Future<Directory> result = getExternalStorageDirectory();
expect(result, throwsA(isInstanceOf<UnsupportedError>()));
} else if (Platform.isAndroid) {
final Directory result = await getExternalStorageDirectory();
final String uuid = Uuid().v1();
final File file = File('${result.path}/$uuid.txt');
file.writeAsStringSync('Hello world!');
expect(file.readAsStringSync(), 'Hello world!');
expect(result.listSync(), isNotEmpty);
file.deleteSync();
}
});
}