Skip to content

Commit a2f6f78

Browse files
committed
support or logic for meta keys
1 parent b3ad241 commit a2f6f78

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

frontend/e2e/index.cafe.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const path = require('path');
44
const { fork } = require('child_process');
55
const _options = require("../.testcaferc.js")
66
const upload = require('../bin/upload-file');
7+
const minimist = require('minimist');
78
const options = {
89
..._options,
910
browsers: process.env.E2E_DEV ? ['firefox'] : ['firefox:headless'],
@@ -16,6 +17,15 @@ if (fs.existsSync(dir)) {
1617
fs.rmdirSync(dir, { recursive: true });
1718
}
1819
const start = Date.now().valueOf();
20+
// Parse CLI arg --meta-filter
21+
const args = minimist(process.argv.slice(2));
22+
const filterString = args['meta-filter']; // "type=smoke,priority=high"
23+
const metaConditions = (filterString || '')
24+
.split(',')
25+
.map(pair => {
26+
const [key, value] = pair.split('=');
27+
return { key, value };
28+
});
1929
createTestCafe()
2030
.then(async (tc) => {
2131
testcafe = tc;
@@ -40,6 +50,13 @@ createTestCafe()
4050
.clientScripts('e2e/add-error-logs.js')
4151
.src(['./e2e/init.cafe.js'])
4252
.concurrency(parseInt(concurrentInstances))
53+
.filter((_testName, _fixtureName, _fixturePath, testMeta, fixtureMeta) => {
54+
return metaConditions.some(({ key, value }) => {
55+
return (
56+
testMeta[key] === value || fixtureMeta[key] === value
57+
);
58+
});
59+
})
4360
.run(options)
4461
})
4562
.then(async (v) => {

frontend/package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@
175175
"eslint-plugin-react-hooks": "4.3.0",
176176
"eslint-plugin-sort-destructure-keys": "^1.4.0",
177177
"eslint-plugin-sort-keys-fix": "^1.1.2",
178+
"minimist": "^1.2.8",
178179
"nodemon": "^3.0.1",
179180
"raw-loader": "0.5.1",
180181
"react-refresh": "^0.14.2",

0 commit comments

Comments
 (0)