Skip to content

How to run each test several times ?  #321

@arichard-info

Description

@arichard-info

Hello !

We're writing our tests mobile-first with cypress-cucumber-preprocessor. By default, all the tests are run with a mobile viewport. But on some specific cases, we want to run them on desktop viewport.

This is possible since this PR : #216.
We're just using the Before to adapt the viewport depending on tags :

Before({ tags: '@desktop' }, () => {
  cy.viewport(desktopWidth, desktopHeight);
});

This is doing the job, but now we would like to enable the tests on both desktop and mobile viewports. Some tests are not mobile or desktop only, we want to run them on both viewports. So we will have three cases of tests :

  • Mobile only => the test is not tagged
  • Desktop only => the test is tagged with @desktop
  • Mobile AND Desktop => the test is tagged with @all-viewport

We could implement this duplicating the tests by ourself (writing the wanted tests two times, with a different tag on each), but we're looking for a better way (and easier to maintain).

Do someone know if it's possible to implement this with the plugin ? Or natively with Cypress ?
@jcundill any idea ? 😏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions