over_react_test 1.4.0

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 88

OverReact Test

Pub Build Status Test Coverage Documentation

A library for testing OverReact components.

Using it in your project

  1. Import it into your test files:

     import 'package:over_react_test/over_react_test.dart';
    
  2. Add the test/pub_serve transformer to your pubspec.yaml after the over_react transformer.

     transformers:
     - over_react
     - test/pub_serve:
         $include: test/**_test{.*,}.dart
     - $dart2js
    
  3. Use the --pub-serve option when running your tests:

     $ pub run test --pub-serve=8081 test/your_test_file.dart
    

    Note: 8081 is the default port used, but your project may use something different. Be sure to take note of the output when running pub serve to ensure you are using the correct port.

Naming Conventions

Variables and Types

UsageActual TypeSuggested Referencing
render and render helper functionsReactComponent |Elementinstance
Component classReactClasstype
VDOM Instance (invoked UiProps)ReactElement-ReactElement or not suffixed
findDomNode, queryByTestId, etc.Elementnode
The Dart componentreact.Component (backed by ReactComponent)dartInstance
Invoked UiFactoryUiPropsbuilder

Example:

test('my test' () {
  var sampleBuilder = Sample();
  var sampleReactElement = sampleBuilder(); // Or var sample = sampleBuilder();
  var instance = render(sampleInstance);
  SampleComponent sampleDartInstance = getDartComponent(instance);
  var sampleNode = findDomNode(instance);
});

Test IDs

When coming up with test ID strings:

  • DO NOT use spaces; space-delimited strings will be treated as separate test IDs

    Just like CSS class names, you can use multiple test IDs together, and use any one of them to target a given component/node.

  • PREFER following our naming scheme for consistency across projects:

    <library>.<Component>[.<subpart>...].<part>

    We recommend including a library abbreviation and component name within a test ID so that it's easy to track down where that ID came from.

    Namespacing (.<subpart>) can be added however it makes sense.

    Finally, test IDs should be descriptive and useful in the context of tests.

    Examples:

    • wsd.DatepickerPrimitive.goToSelectedButton
    • sox.AbstractDataLayoutGroup.headerBlock.title
  • CONSIDER adding multiple IDs to serve different purposes

    for (var i = 0; i < items.length; i++) {
      // ...
        ..addTestId('foo.Bar.menuItem')
        ..addTestId('foo.Bar.menuItem.$i')
        ..addTestId('foo.Bar.menuItem.${items[i].id}')
      // ...
    }
    

    With the output of above code, you can:

    • target all of the Bar component's menu items using foo.Bar.menuItem
    • target the 4th item using foo.Bar.menuItem.3
    • target the item corresponding to an item with id baz123 using foo.Bar.menuItem.baz123

    This won't always be needed, but it comes in handy in certain cases.

Documentation

You would never skip reading the docs for a new language you are asked to learn, so please don't skip over reading our API documentation either.

Contributing

Yes please! (Please read our contributor guidelines first)

Versioning

The over_react_test library adheres to Semantic Versioning:

  • Any API changes that are not backwards compatible will bump the major version (and reset the minor / patch).
  • Any new functionality that is added in a backwards-compatible manner will bump the minor version (and reset the patch).
  • Any backwards-compatible bug fixes that are added will bump the patch version.

OverReact Test Changelog

1.1.1

Bugs Fixed

  • Sync common component test src with the lib it originated from.

1.1.0

New Features

  • #11: Add some test utilities that were left in over_react when the library was first created.

1.0.1

Misc

  • #8: Update prop error message to make it more DDC friendly

1.0.0

Initial public release of library.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  over_react_test: "^1.4.0"

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


      import 'package:over_react_test/over_react_test.dart';
  
Version Uploaded Documentation Archive
1.4.0 May 15, 2018 Go to the documentation of over_react_test 1.4.0 Download over_react_test 1.4.0 archive
1.3.2 May 8, 2018 Go to the documentation of over_react_test 1.3.2 Download over_react_test 1.3.2 archive
1.3.1 Sep 25, 2017 Go to the documentation of over_react_test 1.3.1 Download over_react_test 1.3.1 archive
1.3.0 Sep 22, 2017 Go to the documentation of over_react_test 1.3.0 Download over_react_test 1.3.0 archive
1.2.1 Aug 14, 2017 Go to the documentation of over_react_test 1.2.1 Download over_react_test 1.2.1 archive
1.2.0 Aug 11, 2017 Go to the documentation of over_react_test 1.2.0 Download over_react_test 1.2.0 archive
1.1.1 Jul 27, 2017 Go to the documentation of over_react_test 1.1.1 Download over_react_test 1.1.1 archive
1.1.0 Jul 26, 2017 Go to the documentation of over_react_test 1.1.0 Download over_react_test 1.1.0 archive
1.0.1 Jul 5, 2017 Go to the documentation of over_react_test 1.0.1 Download over_react_test 1.0.1 archive
1.0.0 May 25, 2017 Go to the documentation of over_react_test 1.0.0 Download over_react_test 1.0.0 archive

Analysis

We analyzed this package on Jun 12, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.60.0
  • pana: 0.11.3

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
76 / 100
Health:
Code health derived from static analysis. [more]
99 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]
88
Learn more about scoring.

Platforms

Detected platforms: web

Primary library: package:over_react_test/over_react_test.dart with components: html, js, mirrors.

Suggestions

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 8 hints.

    Run dartfmt to format lib/src/over_react_test/common_component_util.dart.

    Run dartfmt to format lib/src/over_react_test/custom_matchers.dart.

    Similar analysis of the following files failed:

    • lib/src/over_react_test/dom_util.dart (hint)
    • lib/src/over_react_test/jacket.dart (hint)
    • lib/src/over_react_test/js_component.dart (hint)
    • lib/src/over_react_test/react_util.dart (hint)
    • lib/src/over_react_test/validation_util.dart (hint)
  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use over_react_test.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.24.2 <2.0.0
js ^0.6.1 0.6.1
matcher >=0.11.0 <0.13.0 0.12.2+1
over_react ^1.23.0 1.24.1
react >=3.7.0 <5.0.0 4.4.1
test ^0.12.32+1 0.12.40
Transitive dependencies
analyzer 0.30.0+4 0.32.1
args 1.4.3
async 2.0.7
barback 0.15.2+14 0.15.2+16
boolean_selector 1.0.3
browser 0.10.0+3
build 0.11.2 0.12.6
built_collection 3.1.1
built_redux 7.4.1
built_value 5.1.3 5.5.1
charcode 1.1.1
cli_util 0.1.3
collection 1.14.10
convert 2.0.1
crypto 2.0.3
csslib 0.14.4
dart_style 1.0.9+1 1.0.14
fixnum 0.10.7
front_end 0.1.0-alpha.4.1 0.1.1
glob 1.1.5
html 0.13.3+1
http 0.11.3+16
http_multi_server 2.0.5
http_parser 3.1.2
io 0.3.2+1
isolate 1.1.0 2.0.1
kernel 0.3.0-alpha.1.1 0.3.1
logging 0.11.3+1
meta 1.1.5
mime 0.9.6+1
multi_server_socket 1.0.1
node_preamble 1.4.2
package_config 1.0.3
package_resolver 1.0.3
path 1.6.0
platform_detect 1.3.3
plugin 0.2.0+2
pool 1.3.5
pub_semver 1.4.1
quiver 0.28.0 0.29.0+1
shelf 0.7.3+1
shelf_packages_handler 1.0.3
shelf_static 0.2.7+1
shelf_web_socket 0.2.2+2
source_gen 0.7.5+1 0.8.1+3
source_map_stack_trace 1.1.4
source_maps 0.10.5
source_span 1.4.0
stack_trace 1.9.2
stream_channel 1.6.7
string_scanner 1.0.2
term_glyph 1.0.0
transformer_utils 0.1.3
typed_data 1.1.5
utf 0.9.0+4
w_common 1.12.0
w_flux 2.9.5
watcher 0.9.7+8
web_socket_channel 1.0.8
yaml 2.1.14
Dev dependencies
coverage >=0.7.2 <0.11.0
dart_dev ^1.7.7
dependency_validator ^1.1.0