flutter_flutter/lib/web_ui/dev/firefox_installer_test.dart
Nurhan Turgut 3b97d3a329
[web] [test] Adding firefox install functionality to the test platform (#13272)
* Add Firefox installing functionality to test platform. For Linux only. Refactor test platform code

* remove download.dart. Not complete for now

* uncomment firefox.dart. Adding new CL parameters.

* Licence headers added.

* adding more comments to firefox_installer

* adding test for firefox download

* address pr comments. change directory for test in .cirrus.yml

* change directory for test_web_engine_firefox_script

* removing the system test.
2019-10-23 14:41:49 -07:00

46 lines
1.2 KiB
Dart

// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@TestOn('vm && linux')
import 'dart:io' as io;
import 'package:path/path.dart' as path;
import 'package:test/test.dart';
import 'common.dart';
import 'environment.dart';
import 'firefox_installer.dart';
void main() async {
void deleteFirefoxInstallIfExists() {
final io.Directory firefoxInstallationDir = io.Directory(
path.join(environment.webUiDartToolDir.path, 'firefox'),
);
if (firefoxInstallationDir.existsSync()) {
firefoxInstallationDir.deleteSync(recursive: true);
}
}
setUpAll(() {
deleteFirefoxInstallIfExists();
});
tearDown(() {
deleteFirefoxInstallIfExists();
});
test('installs a given version of Firefox', () async {
FirefoxInstaller installer = FirefoxInstaller(version: '69.0.2');
expect(installer.isInstalled, isFalse);
BrowserInstallation installation = await getOrInstallFirefox('69.0.2');
expect(installation.version, '69.0.2');
expect(installer.isInstalled, isTrue);
expect(io.File(installation.executable).existsSync(), isTrue);
});
}