Git Product home page Git Product logo

screenshots_test's Introduction

screenshots_test

Testing taking screenshots in GitHub Actions.

See Notion > Integration Testing

Step 1

Following these articles

And running flutter drive --driver=integration_test/screenshot_test_driver.dart --target=integration_test/screenshot_test.dart -d <iphone_emulator_id>

gives:

flutter: 'package:flutter/src/foundation/binding.dart':
Failed assertion: line 55 pos 12:
flutter: '!_debugInitialized': is not true.

Step 2

Importing flutter_driver

flutter_driver:
    sdk: flutter

And adding enableFlutterDriverExtension(); as the first line of main() in screenshot_test_driver.dart

gives:

../../SDKs/flutter/packages/flutter/lib/src/cupertino/bottom_tab_bar.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show ImageFilter;
       ^
../../SDKs/flutter/packages/flutter/lib/src/cupertino/colors.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show Color, Brightness;
       ^
...

Step 3

Updating code to match the latest instructions at: https://github.com/flutter/flutter/tree/master/packages/integration_test

Gives the error described in: flutter/flutter#91668

Using the workaround described in the issue, ie.

updating flutter/packages/integration_test/ios/Classes/IntegrationTestPlugin.m

by adding a body to:

+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar {

to make it:

+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar {
    [[IntegrationTestPlugin instance] setupChannels:registrar.messenger];
}

And screenshots now work.

Use with flutter drive

flutter drive \                                   
  --driver=test_driver/integration_test.dart \
  --target=integration_test/screenshot_test.dart

Step 4

Use with flutter test

Saving the image data in the integration test allows us to use:

flutter test integration_test/screenshot_test.dart

And remove the driver code.

screenshots_test's People

Contributors

nickmeinhold avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.