testing

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

笑着哭i 提交于 2020-12-29 10:13:15
问题 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

How might I check if any mocha tests failed from within an after block?

时光毁灭记忆、已成空白 提交于 2020-12-29 05:41:29
问题 describe('some tests', function () { /* * Run some tests... */ }) after(function () { failures = ? // <--- what goes here? console.log(failures + " tests failed!") }) I'd use this to keep chromedriver's browser open if a test failed, and to report success or failure to sauce labs. Mocha's Runner and Reporters have the info I'm looking for as stats but I'm not sure how to get to them from within a test file. 回答1: I found answer to this question here afterEach(function() { if (this.currentTest

How might I check if any mocha tests failed from within an after block?

久未见 提交于 2020-12-29 05:39:02
问题 describe('some tests', function () { /* * Run some tests... */ }) after(function () { failures = ? // <--- what goes here? console.log(failures + " tests failed!") }) I'd use this to keep chromedriver's browser open if a test failed, and to report success or failure to sauce labs. Mocha's Runner and Reporters have the info I'm looking for as stats but I'm not sure how to get to them from within a test file. 回答1: I found answer to this question here afterEach(function() { if (this.currentTest

Flutter Firebase Authentication emulator enabling

余生长醉 提交于 2020-12-27 06:30:08
问题 I'm trying to hook the Firebase Authentication emulator to my Flutter mobile project to perform some local testing. Unfortunately it seems it is not possible to do with the FlutterFire plugin. There is no problem whatsoever to enable Firestore or Cloud Functions emulators, but I can not find a way for Authentication. Is there someone with ideas or best practices to follow? 回答1: It looks like the method to connect to the Authentication emulator hasn't made it to the FlutterFire libraries yet.

Flutter Firebase Authentication emulator enabling

守給你的承諾、 提交于 2020-12-27 06:27:32
问题 I'm trying to hook the Firebase Authentication emulator to my Flutter mobile project to perform some local testing. Unfortunately it seems it is not possible to do with the FlutterFire plugin. There is no problem whatsoever to enable Firestore or Cloud Functions emulators, but I can not find a way for Authentication. Is there someone with ideas or best practices to follow? 回答1: It looks like the method to connect to the Authentication emulator hasn't made it to the FlutterFire libraries yet.

Step Definition detection only works when project is configured as cucumber project.- Virtual Machine

假如想象 提交于 2020-12-16 04:50:26
问题 feature file and stepdefiniton file could not be connected. It happens only in eclipse installed in Win Server 2012R2 Virtual Machine. 回答1: This error will appear when you import any new cucumber project from git or directly from local system. Because you have not configured the project to cucumber and it is configured only to maven. This error can appear for both Selenium and appium testing for web and mobile automation testing. You can use below screenshot to convert to cucumber project.

Is there a way to fake DateTime.now() in a Flutter test?

夙愿已清 提交于 2020-12-15 06:57:41
问题 I can pass in a time to my widget, but my widget is supposed to be instantiating the time in itself, not receiving a DateTime from a parent widget. 回答1: extension CustomizableDateTime on DateTime { static DateTime customTime; static DateTime get current { if (customTime != null) return customTime; else return DateTime.now(); } } Just use CustomizableDateTime.current in the production code. You can modify the returned value in tests like that: CustomizableDateTime.customTime = DateTime.parse(

Mocking shelljs with Jest - [TypeError: shell.exec is not a function]

不羁的心 提交于 2020-12-15 06:46:11
问题 As mentioned in my previous question about mocking, I am new to Jest and testing and I seem to be getting some curveballs. This time around I am having trouble mocking shelljs in my CLI application. Automocking jest.mock('shelljs'); didn't work and errored as:[TypeError: shell.exec is not a function] So I went ahead and tried to use mockImplementation() jest.mock('shelljs', () => { return jest.fn().mockImplementation(() => { return { exec: () => {} }; }); }); To my surprise I am still getting

How to override standard testcafe errors?

末鹿安然 提交于 2020-12-15 03:26:39
问题 I need to override standard testcafe error messages by adding there Selector's input locator - this way I will know more about failure and can debug that manually at least by manually checking ability for selector to be found. When I try just to catch error by this code: try { const selector = Selector('basdf') await t.click(selector); } catch (e) { console.log(e); } I'm getting this object: { code: 'E24', isTestCafeError: true, callsite: CallsiteRecord { filename: '/Users/myPath/helper_test

Junit multiple results in one test

谁都会走 提交于 2020-12-13 19:27:59
问题 Ok, I know this is considered an anti-pattern, and I am certainly open to a better way of doing this. I have a map of enum values. I want to ensure that each of those enum values is assigned to something. My test looks like this. @Test public void eachRowRequiresCellCalc() { Model model = new Model(); EnumValues[] values = EnumValues.values(); for (EnumValues value : values) { Assert.assertTrue(String.format("%s must be assigned", value.name()), model.hasEnumValue(value)); } } This works and