Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(runner): add env overrides for safari and ff #2042

Merged
merged 6 commits into from
Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions pkgs/test/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
`TestOn`, `Timeout`.
* Fix the `root_` fields in the JSON reporter when running a test on Windows
with an absolute path.
* Add support for `SAFARI_EXECUTABLE`, `FIREFOX_EXECUTABLE` and
`MS_EDGE_EXECUTABLE` for custom browser installations.
* Allow the latest analyzer (6.x.x).

## 1.24.3
Expand Down
6 changes: 4 additions & 2 deletions pkgs/test/lib/src/runner/browser/default_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ final defaultSettings = UnmodifiableMapView({
Runtime.firefox: ExecutableSettings(
linuxExecutable: 'firefox',
macOSExecutable: '/Applications/Firefox.app/Contents/MacOS/firefox-bin',
windowsExecutable: r'Mozilla Firefox\firefox.exe'),
windowsExecutable: r'Mozilla Firefox\firefox.exe',
environmentOverride: 'FIREFOX_EXECUTABLE'),
Runtime.internetExplorer:
ExecutableSettings(windowsExecutable: r'Internet Explorer\iexplore.exe'),
Runtime.safari: ExecutableSettings(
macOSExecutable: '/Applications/Safari.app/Contents/MacOS/Safari'),
macOSExecutable: '/Applications/Safari.app/Contents/MacOS/Safari',
environmentOverride: 'SAFARI_EXECUTABLE'),
});
14 changes: 14 additions & 0 deletions pkgs/test/test/runner/browser/firefox_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,20 @@ void main() {
await test.shouldExit(1);
});

test('can override firefox location with FIREFOX_EXECUTABLE var', () async {
await d.file('test.dart', '''
import 'package:test/test.dart';

void main() {
test("success", () {});
}
''').create();
var test = await runTest(['-p', 'firefox', 'test.dart'],
environment: {'FIREFOX_EXECUTABLE': '/some/bad/path'});
expect(test.stdout, emitsThrough(contains('Failed to run Firefox:')));
await test.shouldExit(1);
});

test('not impacted by CHROME_EXECUTABLE var', () async {
await d.file('test.dart', '''
import 'dart:html';
Expand Down
14 changes: 14 additions & 0 deletions pkgs/test/test/runner/browser/microsoft_edge_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,18 @@ void main() {
expect(test.stdout, emitsThrough(contains('-1: Some tests failed.')));
await test.shouldExit(1);
});

test('can override edge location with MS_EDGE_EXECUTABLE var', () async {
await d.file('test.dart', '''
import 'package:test/test.dart';

void main() {
test("success", () {});
}
''').create();
var test = await runTest(['-p', 'edge', 'test.dart'],
environment: {'MS_EDGE_EXECUTABLE': '/some/bad/path'});
expect(test.stdout, emitsThrough(contains('Failed to run Edge:')));
await test.shouldExit(1);
});
}
14 changes: 14 additions & 0 deletions pkgs/test/test/runner/browser/safari_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,18 @@ void main() {
expect(test.stdout, emitsThrough(contains('-1: Some tests failed.')));
await test.shouldExit(1);
});

test('can override safari location with SAFARI_EXECUTABLE var', () async {
await d.file('test.dart', '''
import 'package:test/test.dart';

void main() {
test("success", () {});
}
''').create();
var test = await runTest(['-p', 'safari', 'test.dart'],
environment: {'SAFARI_EXECUTABLE': '/some/bad/path'});
expect(test.stdout, emitsThrough(contains('Failed to run Safari:')));
await test.shouldExit(1);
});
}