1- import { async , ComponentFixture , TestBed } from '@angular/core/testing' ;
2- import { getNativeElement , load } from '../testbed' ;
1+ import { ComponentFixture , TestBed } from '@angular/core/testing' ;
2+ import { TestbedHarnessEnvironment } from '../testbed' ;
33import { MainComponentHarness } from './harnesses/main-component-harness' ;
44
55import { TestComponentsModule } from './test-components-module' ;
@@ -8,17 +8,11 @@ import {TestMainComponent} from './test-main-component';
88describe ( 'Testbed Helper Test' , ( ) => {
99 let harness : MainComponentHarness ;
1010 let fixture : ComponentFixture < { } > ;
11- beforeEach ( async ( ( ) => {
12- TestBed
13- . configureTestingModule ( {
14- imports : [ TestComponentsModule ] ,
15- } )
16- . compileComponents ( )
17- . then ( ( ) => {
18- fixture = TestBed . createComponent ( TestMainComponent ) ;
19- harness = load ( MainComponentHarness , fixture ) ;
20- } ) ;
21- } ) ) ;
11+ beforeEach ( async ( ) => {
12+ await TestBed . configureTestingModule ( { imports : [ TestComponentsModule ] } ) . compileComponents ( ) ;
13+ fixture = TestBed . createComponent ( TestMainComponent ) ;
14+ harness = await TestbedHarnessEnvironment . harnessForFixtureRoot ( fixture , MainComponentHarness ) ;
15+ } ) ;
2216
2317 describe ( 'Locator' , ( ) => {
2418 it ( 'should be able to locate a element based on CSS selector' , async ( ) => {
@@ -143,14 +137,8 @@ describe('Testbed Helper Test', () => {
143137 } catch ( err ) {
144138 expect ( err . message )
145139 . toBe (
146- 'Cannot find element based on the CSS selector: wrong locator' ) ;
140+ 'Expected to find element matching selector: " wrong locator", but none was found ' ) ;
147141 }
148142 } ) ;
149143 } ) ;
150-
151- describe ( 'getNativeElement' , ( ) => {
152- it ( 'should return the native element' , async ( ) => {
153- expect ( getNativeElement ( harness . host ( ) ) ) . toBe ( fixture . nativeElement ) ;
154- } ) ;
155- } ) ;
156144} ) ;
0 commit comments