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: add support for skipping tests based on the enforced target platform #25

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Cteq3132
Copy link
Collaborator

Add support for skipping tests instead of failing them based on the enforced target platform defined in the AdaptiveTestConfiguration class.

Future<void> testExecutable(FutureOr<void> Function() testMain) async {
  TestWidgetsFlutterBinding.ensureInitialized();
  AdaptiveTestConfiguration.instance
    ..setSkippedTestPlatform(TargetPlatform.macOS)
    ..setFailTestOnWrontPlatform(false) <-- Adding this will skip the `testAdaptiveWidgets` tests if you are not running the tests on a macOS platform.
    ..setDeviceVariants(defaultDeviceConfigs);
  await loadFonts();
  setupFileComparatorWithThreshold();
  await testMain();
}

///
/// Setting [failTestOnWrongPlatform] to false will skip the test instead of
/// failing it.
void setFailTestOnWrontPlatform(bool failTestOnWrongPlatform) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
void setFailTestOnWrontPlatform(bool failTestOnWrongPlatform) {
void setFailTestOnWrongPlatform(bool failTestOnWrongPlatform) {

TestWidgetsFlutterBinding.ensureInitialized();
AdaptiveTestConfiguration.instance
..setSkippedTestPlatform(TargetPlatform.macOS)
..setFailTestOnWrontPlatform(false) <-- Adding this will skip the `testAdaptiveWidgets` tests if you are not running the tests on a macOS platform.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
..setFailTestOnWrontPlatform(false) <-- Adding this will skip the `testAdaptiveWidgets` tests if you are not running the tests on a macOS platform.
..setFailTestOnWrongPlatform(false) <-- Adding this will skip the `testAdaptiveWidgets` tests if you are not running the tests on a macOS platform.

Future<void> testExecutable(FutureOr<void> Function() testMain) async {
TestWidgetsFlutterBinding.ensureInitialized();
AdaptiveTestConfiguration.instance
..setSkippedTestPlatform(TargetPlatform.macOS)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setSkippedTestPlatform function doesn't seem to exist in this PR.
do you mean ..setEnforcedTestPlatform(TargetPlatform.macOS)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants