vendredi 21 février 2020

Is it possible to ignore a cucumber hook if a specific tag is being used

Is it possible to ignore a hook if a specific tag is being used?

If @someTag is used then I need the beforeAll to refer to an import with the alias, 's2'.
Otherwise I need the beforeAll to refer to scope without the alias, 's'.

If I run a test with @someTag, then I would expect to only see 'In BeforeAll @someTag - hooks.js' printed in the console - but instead, they both run.

import s from "../location1/s";
import * as s2 from "../location2/s";

BeforeAll("not @someTag", async () => {
  console.log("In BeforeAll - hooks.js");
  s.driver = puppeteer;
})
BeforeAll("@someTag", async () => {
  console.log("In BeforeAll @someTag - hooks.js");
  s2.driver = puppeteer;
});



Aucun commentaire:

Enregistrer un commentaire