angular_test 1.0.0-beta+2

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 89

angular_test

Testing infrastructure and runner for AngularDart.

Usage

angular_test is both a framework for writing tests for AngularDart components and a test runner that delegates to both pub serve and pub run test to run component tests using the AOT-compiler - angular_test does not function in reflective mode.

Example use:

@Tags(const ['aot'])
@TestOn('browser')
import 'dart:html';

import 'package:angular2/angular2.dart';
import 'package:angular_test/angular_test.dart';
import 'package:test/test.dart';

@AngularEntrypoint()
void main() {
  tearDown(disposeAnyRunningTest);

  test('should render "Hello World"', () async {
    final testBed = new NgTestBed<HelloWorldComponent>();
    final testFixture = await testBed.create();
    expect(testFixture.text, 'Hello World');
    await testFixture.update((c) => c.name = 'Universe');
    expect(testFixture.text, 'Hello Universe');
  });
}

@Component(selector: 'test', template: 'Hello {{name}}')
class HelloWorldComponent {
  String name = 'World';
}

You will need to also configure in pubspec.yaml to run code generation:

transformers:
  # Run the code generator on the entire package.
  - angular2/transform/codegen

  # Run the reflection remover on tests that have AoT enabled.
  - angular2/transform/reflection_remover:
      $include:
          - test/test_using_angular_test.dart

  # Allow test to proxy-load files so we can run AoT tests w/ pub serve.
  - test/pub_serve:
      $include: test/**_test.dart

Running

Use pub run angular_test - it will automatically run pub serve to run code generation (transformers) and pub run test to run browser tests on anything tagged with 'aot'.:

$ pub run angular_test

1.0.0-beta+2

  • Add support for setting a custom PageLoader factory:
testBed = testBed.setPageLoader(
  (element) => new CustomPageLoader(...),
);
  • Add support for query and queryAll to NgTestFixture. This works similar to the update command, but is called back with either a single or multiple child component instances to interact with or run expectations against:
// Assert we have 3 instances of <child>.
await fixture.queryAll(
  (el) => el.componentInstance is ChildComponent,
  (children) {
    expect(children, hasLength(3));
  },
);

1.0.0-beta+1

  • Properly fix support for windows by using pub.bat.

1.0.0-beta

  • Prepare to support angular2: 3.0.0-beta.
  • Replace all uses of generic comment with proper syntax.
  • Fixed a bug where activeTest was never set (and therefore disposed).
  • Fixed a bug where pub, not pub.bat, is run in windows.

1.0.0-alpha+6

  • Address breaking changes in angular2: 3.0.0-alpha+1.

1.0.0-alpha+5

  • Update pubspec.yaml to tighten the constraint on AngularDart

1.0.0-alpha+4

  • Update pubspec.yaml so it properly lists AngularDart 3.0.0-alpha

1.0.0-alpha+3

  • Fix the executable so pub run angular_test can be used

1.0.0-alpha+2

  • Add built-in support for package:pageloader:
final fixture = await new NgTestBed<TestComponent>().create();
final pageObject = await fixture.getPageObject/*<ClickCounterPO>*/(
  ClickCounterPO,
);
expect(await pageObject.button.visibleText, 'Click count: 0');
await pageObject.button.click();
expect(await pageObject.button.visibleText, 'Click count: 1');
  • Fix a serious generic type error when NgTestBed is forked

  • Fix a generic type error

  • Added compatibility.dart, a temporary API to some users migrate

Changes to compatibility.dart might not be considered in future semver updates, and it highly suggested you don't use these APIs for any new code.

1.0.0-alpha+1

  • Change NgTestFixture.update to have a single optional parameter

1.0.0-alpha

  • Initial commit with compatibility for AngularDart 2.2.0

Use this package as an executable

1. Install it

You can install the package from the command line:


$ pub global activate angular_test

2. Use it

The package has the following executables:


$ angular_test

Use this package as a library

1. Depend on it

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


dependencies:
  angular_test: "^1.0.0-beta+2"

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:angular_test/angular_test.dart';
  
Version Uploaded Documentation Archive
1.0.1 Sep 25, 2017 Go to the documentation of angular_test 1.0.1 Download angular_test 1.0.1 archive
1.0.0 Aug 30, 2017 Go to the documentation of angular_test 1.0.0 Download angular_test 1.0.0 archive
2.0.0-alpha+11 May 24, 2018 Go to the documentation of angular_test 2.0.0-alpha+11 Download angular_test 2.0.0-alpha+11 archive
2.0.0-alpha+10 May 17, 2018 Go to the documentation of angular_test 2.0.0-alpha+10 Download angular_test 2.0.0-alpha+10 archive
2.0.0-alpha+9 Apr 23, 2018 Go to the documentation of angular_test 2.0.0-alpha+9 Download angular_test 2.0.0-alpha+9 archive
2.0.0-alpha+8 Apr 10, 2018 Go to the documentation of angular_test 2.0.0-alpha+8 Download angular_test 2.0.0-alpha+8 archive
2.0.0-alpha+7 Mar 29, 2018 Go to the documentation of angular_test 2.0.0-alpha+7 Download angular_test 2.0.0-alpha+7 archive
2.0.0-alpha+6 Mar 16, 2018 Go to the documentation of angular_test 2.0.0-alpha+6 Download angular_test 2.0.0-alpha+6 archive
2.0.0-alpha+5 Mar 7, 2018 Go to the documentation of angular_test 2.0.0-alpha+5 Download angular_test 2.0.0-alpha+5 archive
2.0.0-alpha+4 Feb 27, 2018 Go to the documentation of angular_test 2.0.0-alpha+4 Download angular_test 2.0.0-alpha+4 archive

All 24 versions...

Analysis

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

  • Dart: 2.0.0-dev.54.0
  • pana: 0.11.1

Scores

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

Platforms

Detected platforms: unsure

Suggestions

  • Fix platform conflicts.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 1 error 5 hints.

    Make sure that the imported libraries are not in conflict. Detected components: html, io, isolate. null

    Strong-mode analysis of lib/src/bootstrap.dart gave the following hint:

    line: 10 col: 1
    'angular2' is deprecated and shouldn't be used.

    Similar analysis of the following files failed:

    • lib/src/frontend/bed.dart (hint)
    • lib/src/frontend/fixture.dart (hint)
    • lib/src/frontend/stabilizer.dart (hint)
  • Package is pre-release.

    Pre-release versions should be used with caution, their API may change in breaking ways.

  • 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.

  • 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 angular_test.dart.

  • Use analysis_options.yaml.

    Rename old .analysis_options file to analysis_options.yaml.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.22.0 <2.0.0
angular2 >=3.0.0-alpha+1 <4.0.0 3.1.0+1
ansicolor ^0.0.9 0.0.9 0.1.0
args ^0.13.7 0.13.7 1.4.3
logging ^0.11.3+1 0.11.3+1
matcher ^0.12.0+2 0.12.2+1
pageloader ^2.2.5 2.2.6 3.0.0-alpha
path ^1.4.1 1.5.1
test ^0.12.17 0.12.37 0.12.38+1
Transitive dependencies
analyzer 0.30.0+4 0.32.0
archive 1.0.33
async 2.0.7
barback 0.15.2+16
boolean_selector 1.0.3
build 0.9.3 0.12.6
build_barback 0.2.2 0.5.0+4
charcode 1.1.1
cli_util 0.1.3
code_builder 1.0.4 3.0.3
code_transformers 0.5.1+5
collection 1.14.9
convert 2.0.1
crypto 2.0.3
csslib 0.13.7+1 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.0
func 1.0.0
glob 1.1.5
html 0.13.3
http 0.11.3+16
http_multi_server 2.0.4
http_parser 3.1.2
intl 0.15.6
io 0.3.2+1
isolate 1.1.0 2.0.0
js 0.6.1
kernel 0.3.0-alpha.1.1 0.3.0
meta 1.1.5
mime 0.9.6+1
multi_server_socket 1.0.1
node_preamble 1.4.1
package_config 1.0.3
package_resolver 1.0.2
plugin 0.2.0+2
pool 1.3.5
protobuf 0.5.5 0.8.0
pub_semver 1.4.1
quiver 0.25.0 0.29.0+1
shelf 0.7.3 0.7.3+1
shelf_packages_handler 1.0.3
shelf_static 0.2.7 0.2.7+1
shelf_web_socket 0.2.2+1
source_gen 0.5.10+1 0.8.1+1
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.6
string_scanner 1.0.2
term_glyph 1.0.0
typed_data 1.1.5
unittest 0.11.7 0.12.4+1
utf 0.9.0+4
watcher 0.9.7+8
web_socket_channel 1.0.7
webdriver 1.2.3 2.0.0-beta
yaml 2.1.14