0

I'm attempting to run cypress tests dynamically based on flag values from cloudbees' feature flags. something like this:

if (flags.foo.isEnabled()) {
  describe(`When 'foo' feature-flag is enabled`, () => {
    it(`Then foo element should exist`, () => {});
  });
} else {
  describe(`When 'foo' feature-flag is disabled`, () => {
    it(`Then foo element should not exist`, () => {});
  });
}

however, more often than not, all describes are compiled for the spec before the feature flag values are determined. when the its are finally run, those flag values have been determined, and so the test will fail (if the actual flag values are true).

I can't figure out how to get cypress to wait for the flag values to come back before it compiles the spec file into tests.

I get the impression that setting up requesting the flag values in a plug-in is the way to go, but i can't think of how to force the exports function to wait.

0 Answers0