Comments (7)
Hi, I cannot reproduce the errors you describe and tests are passing. Could you elaborate more on how you get this?
from devkit.
System info
Angular CLI: 12.0.5
Node: 14.17.0
Package Manager: npm 7.16.0
OS: darwin x64
Steps to reproduce
This is what I'm doing:
$ ng new cypress-test --routing=true --style=scss
$ cd cypress-test
$ ng add @angular/material --theme="Indigo/Pink" --typography=false --animations=true
> install 12.0.5 : Yes
$ ng add @cypress/schematic --e2eUpdate=true
> install 1.3.1 : Yes
$ npm install -D @jscutlery/cypress-harness cypress-pipe
Then:
- Add
import '@jscutlery/cypress-harness/support';
incypress/support/index.ts
- Copy/replace datepicker example in
cypress/integration/spec.ts
import { getHarness, getAllHarnesses } from '@jscutlery/cypress-harness'; import { MatDatepickerInputHarness, MatCalendarHarness } from '@angular/material/datepicker/testing'; describe('datepicker', () => { /* getHarness & getAllHarnesses are lazy so you can * initialize them wherever you want and reuse them. */ const datepicker = getHarness(MatDatepickerInputHarness); const calendars = getAllHarnesses(MatCalendarHarness); it('should set date', () => { datepicker.setValue('1/1/2010'); datepicker.openCalendar(); datepicker.getCalendar().invoke('next'); // next method is already used datepicker.getCalendar().selectCell({ text: '10' }); datepicker.getValue().should('equal', '2/10/2010'); calendars.should('be.empty'); }); });
Issue
When opening the project in vscode
I got the compiler errors in the screenshot above.
from devkit.
@edbzn, you are right on one point though:
Even if vscode
is complaining, if you try running the tests anyway through cypress, they are executing fine..
from devkit.
When running @cypress/schematic
it will create a ./cypress/tsconfig.json
which extends from ./tsconfig.json
(ie. the one from angular). And angular has compilerOptions.strict
turned on by default. This is what's causing my issues.
So I guess you should enable strict mode on your side too.
from devkit.
@edbzn, any chance you could look into this any time soon ?
Thanks 🙂
from devkit.
Hi @Badisi, I published a fix for this issue, thanks for reporting!
from devkit.
Hello @edbzn, thanks for the fix !
I can confirm that all the typing issues related to "getHarness" are fixed.
However, the one related to "getAllHarnesses" still exists :
describe('datepicker', () => {
const calendars = getAllHarnesses(MatCalendarHarness);
it('should set date', () => {
calendars.should('be.empty'); <-- Property 'should' does not exist on type 'Promise<MatCalendarHarness[]>'.
});
});
To fix this : get-all-harnesses.ts#L8 -> replace Promise<HARNESS[]>
with ChainableHarness<HARNESS[]>
from devkit.
Related Issues (20)
- Release Microwave 0.1.4 on npm?
- it.skip is not a function
- cypress-harness ist not compatible to cypress 12 HOT 2
- Simplify `suspensify()` operator by removing the projector function
- suspensify() should provide a strict mode allowing type narrowing
- Hot can I add playwright-ct-angular to new nx angular project? HOT 1
- Add support for loading (a) harness(es) on a component
- Availability ChainableHarness type
- `import '@jscutlery/cypress-harness/support';` causes Webpack Compilation Error with Angular 17 HOT 1
- [Feature] can you create a HarnessEnvironment for Playwright HOT 2
- swc-angular-preset: Expression expected/syntax error because of decorator in angular HOT 7
- swc-angular-preset: fakeAsync support HOT 5
- [swc-plugin-angular] Functional APIs (e.g. `input()`) are broken if a property is declared in the constructor
- [swc-plugin-angular] Add vitest support HOT 2
- @jscutlery/operators 2.1.4 doesn't export functions anymore HOT 2
- swc-angular-preset in nx monorepo: RuntimeError: out of bounds memory access HOT 1
- [swc-angular-plugin] Issue with Dexie package HOT 2
- [playwright-ct-angular] align with the suggested official implementation HOT 1
- [swc-angular-plugin] Issue with inherited classes
- [swc-angular-plugin] coverage is reported differently, leads to failures
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from devkit.