I am using a cucumber protractor framework to run feature files.
In my config.js, i have:
specs: [
"../../features/XXX1.feature",
"../../features/XXX2.feature",
...
"../../features/XXXn.feature",
],
cucumberOpts: {
tags: "@mytag",
},
And in my feature file XXX1.feature, i have this tag '@mytag' set:
@mytag
Scenario Outline: my Flow
Given I am running test case one
....
but not in any other feature files like XXX2.feature, XXX3.feature etc.
I am expecting protractor to run XXX1.feature only, and not running XXX2.feature. It kind of does, when comes to XXX2.feature, it starts the browser, doing nothing, and then output following:
[14:35:53] I/testLogger - [chrome #01-2] PID: 14272
[chrome #01-2] Specs: D:\ptfbc\ui\features\XXX2.feature
[chrome #01-2]
[chrome #01-2] [14:35:44] I/hosted - Using the selenium server at http://127.0.0.1:4444/wd/hub
[chrome #01-2]
[chrome #01-2]
[chrome #01-2] 0 scenarios
[chrome #01-2] 0 steps
[chrome #01-2] 0m00.000s
but it's still not good enough. Since there's no tag '@mytag' in XXX2.feature. Shouldn't it skip the feature file XXX2.feature and NOT START THE BROWSER at all?
Starting browser for every ineligible feature file that does not have '@mytag' is also time consuming.
Is there a way of configuration that can avoid this?
Edit
capabilities and hook.ts
capabilities: {
browserName: "chrome",
shardTestFiles: true,
maxInstances: 1,
'chromeOptions': {
'args': [
'disable-infobars'//,'headless=true','disable-gpu=true',
],
'prefs': {
'credentials_enable_service': false,
'download': {
'prompt_for_download': false,
'directory_upgrade': true,
}
}
}
},
const { BeforeAll, After, Status } = require("cucumber");
import * as fs from "fs";
import { browser } from "protractor";
import { config } from "../config/config";
BeforeAll({timeout: 300 * 1000}, async () => {
await browser.get(config.baseUrl);
});
After(async function(scenario) {
// screenShot is a base-64 encoded PNG
const screenShot = await browser.takeScreenshot();
this.attach(screenShot, "image/png");
});