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

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

Open
penchef opened this issue Jan 10, 2022 · 0 comments
Open

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

penchef opened this issue Jan 10, 2022 · 0 comments

Comments

@penchef
Copy link

penchef commented Jan 10, 2022

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', () => {
            ...
          });
   });
});
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant