title: TestCafe 'dynamic' tests cases
body: <p>I created a few e2e sanity tests for my current project using TestCafe. These tests are standard TestCafe tests: </p>
  
  <pre><code>fixture(`Basic checkout flow`)
  
  test('Main Flow', async (t) =&gt; {
  
  });
  </code></pre>
  
  <p>I would like to execute this test for multiple site locales and for multiple channels. i.e. I need this test to run for nl_nl, nl_be, en_gb, .. and also for channels like b2c, b2b, ... </p>
  
  <p>The easiest way is to create a loop in the test itself to loop over the locales and channels, but I want to run these test concurrently. </p>
  
  <p>I tried to create a function to dynamically generate these tests, but TestCafe can't seem to detect the tests then.</p>
  
  <pre><code>dynamicTest('Main Flow', async (t) =&gt; {
  
  });
  
  function dynamicTest(testName, testFn) =&gt; {
    const channels = ['b2c']
  
    channels.forEach((channel) =&gt; {
      test(`[Channel] ${channel}] ${testName}`, testFn);
    });
  };
  </code></pre>
  
  <p>Is there a better way of doing this? The only solution I see is running the test script multiple times from Jenkins to have concurrency.</p>
  
  <p>more detailed code:</p>
  
  <pre><code>import HomePage from '../../page/HomePage/HomePage';
  import EnvUtil from '../../util/EnvUtil';
  
  const wrapper = (config, testFn) =&gt; {
    config.locales.forEach(async locale =&gt;
      config.channels.forEach(async channel =&gt; {
        const tstConfig = {
          locale,
          channel
        };
  
        tstConfig.env = EnvUtil.parse(tstConfig, config.args.env);
        testConfig.foo = await EnvUtil.get() // If I remove this line it works!
  
        testFn(config, locale, channel)
      })
    );
  };
  
  fixture(`[Feature] Feature 1`)
    .beforeEach(async t =&gt; {
      t.ctx.pages = {
        home: new HomePage(),
        ... more pages here
      };
    });
  
  wrapper(global.config, (testConfig, locale, channel) =&gt; {
    test
      .before(async (t) =&gt; {
        t.ctx.config = testConfig;
      })
      .page(`foo.bar.com`)
      (`[Feature] [Locale: ${locale.key}] [Channel: ${channel.key}] Feature 1`, async (t) =&gt; {
        await t.ctx.pages.home.header.search(t, '3301');
  
        .. more test code here
      });
  });
  </code></pre>
  
  <p>If I run it like this I get a "test is undefined" error. Is there something wrong in the way I'm wrapping "test"?</p>