lundi 30 novembre 2020

Only run tests if a variable is larger than a value Cypress

I am trying to only run a set of tests if the version is a certain number or higher in cypress, however I can't seem to make it work correctly. The code below is a bit of an abstraction but shows the overall structure:

if (version < 8203) {
  context('Testing Feature', () => {
    it('Test 1', () => {

    });
    it('Test 2', () => {

    });
    it('Test 3', () => {

    });
  });
else {
  context('Skipping Tests', () => {
    it('Feature Not Available', () => {
      cy.task('log', "Skipping test. Feature not available in this version");
    });
  });
}

I am not sure if this is the correct way to go about this and I have tried several different ways to structure this including putting the if statement in the context but it looks like cypress ignores the if statement or just moves on to the last context and it function.

Aucun commentaire:

Enregistrer un commentaire