Closed serhatgemici closed 3 months ago
@serhatgemici You could add a condition on your playwright config as such and then add the environment variable called USE_TESTRAIL
to false
const config: PlaywrightTestConfig = {
reporter: (process.env.USE_TESTRAIL === "true") ? [
["playwright-testrail-reporter"]
]
// ...
};
I'm sure there is a better way to implement it and I could add this to the package at a later stage but for now this is a workaround
@denisha thank you very much. Just as a reference if anyone else is seeking for a solution, here's how I managed to do it with multiple reporters, using your suggestion:
// List of reporters
const reporters = [
['playwright-testrail-reporter'], // Initially include the TestRail reporter
["allure-playwright",
{
detail: false,
outputFolder: "pw-allure-report",
suiteTitle: true,
environmentInfo: {
os_platform: os.platform(),
os_release: os.release(),
os_version: os.version(),
node_version: process.version,
},
},
],
];
// Conditionally remove the Playwright TestRail reporter if USE_TESTRAIL is "false"
if (process.env.USE_TESTRAIL === "false") {
// Find the index of the TestRail reporter in the reporters array
const testRailReporterIndex = reporters.findIndex(reporter => reporter[0] === 'playwright-testrail-reporter');
// If found, remove it from the array
if (testRailReporterIndex !== -1) {
reporters.splice(testRailReporterIndex, 1);
}
}
export default defineConfig({
testDir,
reporter: reporters,
...
USE_TESTRAIL=false npx playwright test --debug
Hi @niche-tester , thank you for the awesome reporter,
I have a question;
Is there a way that I can avoid creation of test runs when I'm just debugging my tests? as in
TIA