Search code examples
meta-tagstestcafe

Multiple tags for testCafe test


Is it possibly configure tags for a test in TestCafe that one test will belong to more than one meta group. Example:

test  .meta('group', 'smoke-test')  .meta('group', 'main-functionality')
('test name', async t => {

CLI:

"smoke-test": "testcafe chrome:headless e2e/test  --test-meta group=smoke-test
"main-functionality": "testcafe chrome:headless e2e/test  --test-meta group=main-functionality",

Right now it runs only for the first group 'smoke-test' and ignore this test when I run group of tests for main-functionality

research on line resources but did not find a define answer yet


Solution

  • meta is an object and it can't contain two properties with the same key. It means you must come up with another key for another metadata. It will work in this way:

    test
      .meta('group', 'smoke-test')
      .meta('main-group', 'main-functionality')
      ('My first test', async t => {
        //...
      });
    
    {
      "smoke-test": "testcafe chrome:headless e2e/test  --test-meta group=smoke-test,
      "main-functionality": "testcafe chrome:headless e2e/test  --test-meta main-group=main-functionality",
    }