Skip to content
This repository was archived by the owner on Jan 31, 2023. It is now read-only.
This repository was archived by the owner on Jan 31, 2023. It is now read-only.

boolean flag not working when flag is not an expression #172

@penchef

Description

@penchef

Ran into this little issue:

When:

const testUsers = [
  {
    username: 'Foo',
    testFeatureFoo: true,
  },
  {
    username: 'Bar',
  },
];

testUsers.forEach( (user) => { 
  onlyOn(user.testFeatureFoo, () => {                      // <<<<<<<<<<<<<<<<<<<<<<<
          it('testingFoo', () => {
            ...
          });
   });
});

Then: it results into

The following error originated from your test code, not from Cypress.

  > Invalid syntax: cy.onlyOn(<name>), for example cy.onlyOn("linux")
  

However this works:

const testUsers = [
  {
    username: 'Foo',
    testFeatureFoo: true,
  },
  {
    username: 'Bar',
  },
];

testUsers.forEach( (user) => { 
  onlyOn(user.testFeatureFoo === true, () => {                   // <<<<<<<<<<<<<<<<<<<<< alternativly: !!user.testFeatureFoo 
          it('testingFoo', () => {
            ...
          });
   });
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions