GithubHelp home page GithubHelp logo

Comments (7)

edbzn avatar edbzn commented on August 18, 2024

Hi, I cannot reproduce the errors you describe and tests are passing. Could you elaborate more on how you get this?

from devkit.

Badisi avatar Badisi commented on August 18, 2024

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'; in cypress/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.

Badisi avatar Badisi commented on August 18, 2024

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

Badisi avatar Badisi commented on August 18, 2024

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.

Badisi avatar Badisi commented on August 18, 2024

@edbzn, any chance you could look into this any time soon ?
Thanks 🙂

from devkit.

edbzn avatar edbzn commented on August 18, 2024

Hi @Badisi, I published a fix for this issue, thanks for reporting!

from devkit.

Badisi avatar Badisi commented on August 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

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

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.