Skip to content

Method of harness not always working #178

Description

@Heines1983

I'm starting to use Cypress and the harness devkit because of the deprecation of Protractor. I'm currently facing the following issue when invoking methods on a harness.

This is my test:

`describe('Test with harness', () => {

before(() => {
    cy.login()
  });
  
it('should go to the properties page', () => {
    cy.visit('/admin/content-properties').then(() => {
        cy.wait(6000);
    });
})

it('should click a menu item but fails', () => {
    const list = getHarness(ItemMenuComponentHarness);
    list.getItems({label: 'Category'})[0].clickOnItem();
})

it('should click a menu item and succeeds', () => {
    const item = getHarness(ItemMenuItemComponentHarness.with({label: 'Category'}));
    item.clickOnItem();
})

it('should select a tab but fails', () => {

    const tab = getHarness(MatTabHarness.with({label: 'Type specific settings'}));
    tab.select();
})

it('should select a tab and succeeds with the use of pipe', () => {
    const tab = getHarness(MatTabHarness.with({label: 'Type specific settings'}));
    tab.pipe(t => t.select());
})

})`

There are 2 cases in which the method is not working the way I would expect.

The first case is when i'm getting a harness, invoke a method on it (getItems) and on that result I also invoke a method. This throws an error:

image

If I use the same method directly on the harness (2nd test case) it works as expected.

The second case is when the method is also a cypress method like click or select. I get this error:

image

In both cases I can use pipe to make it work, but I would be better if it just works without also.

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions