jasmine

Angular How to test a Component which requires a Location

岁酱吖の 提交于 2021-01-27 04:06:58
问题 Hello and thank you for your time! I am learning how to use Angular and I am interested in learning how to test its Components. Currently I am struggling because I have done the Tour of Heroes tutorial of the Angular page and I am testing the code to understand it better. The point is that I am testing hero-details component which code is: import {Component, OnInit, Input} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import {MyHeroService} from '../hero-service/my

Angular How to test a Component which requires a Location

风格不统一 提交于 2021-01-27 04:06:54
问题 Hello and thank you for your time! I am learning how to use Angular and I am interested in learning how to test its Components. Currently I am struggling because I have done the Tour of Heroes tutorial of the Angular page and I am testing the code to understand it better. The point is that I am testing hero-details component which code is: import {Component, OnInit, Input} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import {MyHeroService} from '../hero-service/my

Mocking MatSnackBar in Angular 8 & Jasmine

你。 提交于 2021-01-24 18:58:36
问题 I have an Angular 8 application that uses the Angular Material MatSnackBar and I am trying to test that the open() method of the class is called. The call to the open() method is within the body of an NgRx store selector, like this: ngOnInit() { this.store.dispatch(fromStore.getFeaturedPlaylists()); this.subscription = this.store.pipe( select(fromStore.selectError), filter(err => !!err), switchMap((err) => this.snackBar.open( `Error: ${err.message}`, 'Try again', {duration: 5000})

Mocking MatSnackBar in Angular 8 & Jasmine

安稳与你 提交于 2021-01-24 18:56:34
问题 I have an Angular 8 application that uses the Angular Material MatSnackBar and I am trying to test that the open() method of the class is called. The call to the open() method is within the body of an NgRx store selector, like this: ngOnInit() { this.store.dispatch(fromStore.getFeaturedPlaylists()); this.subscription = this.store.pipe( select(fromStore.selectError), filter(err => !!err), switchMap((err) => this.snackBar.open( `Error: ${err.message}`, 'Try again', {duration: 5000})

史上最全软件开发|程序员必备的工具集

瘦欲@ 提交于 2021-01-11 15:23:38
史上最全软件开发|程序员必备的工具集 软件开发程序员在整个产品研发的过程中起着很重要的作用, 由于经常研究各种技术,他不会精确记得所有语言代码的语法和API,他觉得没有Google和百度,几乎没法工作。他记的只是一个Key,一个如何找寻答案的索引,而不是全部 。正所谓 “工欲善其事必先利其器”我们程序员也是一样,选择一个好工具可以大大提升开发效率,下面是我使用的一些并且觉得很不错的软件,和大家分享下。 最后还会给大家介绍一款我最近在 测试全流程一站式的测试神器。 一、办公类: 软件开发工程师常用工具: 1.1、OneNote: https://www.onenote.com/download/ 微软office自带的一款类似笔记本的软件,我一般所有的学习笔记都是放在上面的,跟有道云笔记类似,推荐使用,华为研发人员大多都是用这个,谁用谁知道 1.2、Teamviewer:这是一款非常好用的多人回忆演示等集一体的软件,类似于华为内部使用的Espace软件 1.3、腾讯文档: https://docs.qq.com/desktop 1.4、Processon免费作图: https://www.processon.com/ 二、研发类: 2.1、Github: https://github.com/ 适合团队开发人员之间共同开发时使用 2.2、SVN: https:/

Is it possible to run Protractor Test Suites in Parallel?

此生再无相见时 提交于 2021-01-07 03:18:31
问题 I have protractor config file : exports.config = { suites: { BVT : 'e2e/TestSuites/_BVT/*.js', Full : 'e2e/TestSuites/Full/**/*.js', Smoke : 'e2e/TestSuites/Smoke/*.js', Login1 : 'e2e/TestSuites/Login/*.js' }; capabilities: { 'browserName': 'chrome', shardTestFiles: true, maxInstances: 3 }; }; I have tried above but my Test Suite doe not run in parallel, is it possible to run BVT, Full and Smoke Test suites in parallel on chrome browser. 回答1: Yes possible for sure. Take a look how i am

Angular test with `async` causing Jasmine timeout?

自闭症网瘾萝莉.ら 提交于 2021-01-05 07:35:11
问题 I recently upgraded a project to Angular 6, and now tests that were working fine before are now failing. Here's an example of one of those tests: beforeEach( async(() => { TestBed.configureTestingModule({ declarations: [CampaignsDetailScheduleComponent], imports: [ SomeModule, ReactiveFormsModule, TranslateModule.forRoot({ loader: { provide: TranslateLoader, useClass: TranslateFakeLoader } }), StoreModule.forRoot({}) ], providers: [{ provide: ConfigService, useValue: ConfigServiceMock }],

Angular 2 / 4 - How to test Directive @Input values?

耗尽温柔 提交于 2020-12-29 10:15:38
问题 So I have a Directive that takes an input: @Directive({ selector: '[my-directive]' }) export class MyDirective { @Input('some-input') public someInput: string; } As you can see, the input should be a string value. Now, I want to write a test for this Directive, and I want to test if the input satisfies the string type: describe('MyDirective', () => { let fixture: ComponentFixture<DummyComponent>; let dummy: DummyComponent; let directive: DebugElement; beforeEach(async(() => { TestBed

Angular 2 / 4 - How to test Directive @Input values?

半世苍凉 提交于 2020-12-29 10:15:18
问题 So I have a Directive that takes an input: @Directive({ selector: '[my-directive]' }) export class MyDirective { @Input('some-input') public someInput: string; } As you can see, the input should be a string value. Now, I want to write a test for this Directive, and I want to test if the input satisfies the string type: describe('MyDirective', () => { let fixture: ComponentFixture<DummyComponent>; let dummy: DummyComponent; let directive: DebugElement; beforeEach(async(() => { TestBed

Angular 2 / 4 - How to test Directive @Input values?

烈酒焚心 提交于 2020-12-29 10:14:09
问题 So I have a Directive that takes an input: @Directive({ selector: '[my-directive]' }) export class MyDirective { @Input('some-input') public someInput: string; } As you can see, the input should be a string value. Now, I want to write a test for this Directive, and I want to test if the input satisfies the string type: describe('MyDirective', () => { let fixture: ComponentFixture<DummyComponent>; let dummy: DummyComponent; let directive: DebugElement; beforeEach(async(() => { TestBed