I am looking to make my automation tests a bit more flexible. I have a QA team that does not know much javascript and possibly have to design the tests for users with no or little programming skills.
I had a few scripts created using mocha test framework and spectron.js (for an app built with electrion.js) test a few features of the product I dont want to run every single test every time I run the script. My temporary solution is bundle the tests in to a function as a "suite". Like this -
function DiagnosticSuite(location, workstation, workflowName){
CreateWorkflow(location, workflowName);
SetWorkFlowToStation(location, workstation, workflowName);
DiagnosticTestFlow();
return;
}
function PowerflowSuite(imei, location, workstation, workflowName){
SetWorkFlowToStation(location, workstation, workflowName);
powerOffFlow(imei);
return;
}
I was thinking of using Inquirer and use a conditional based on input to run one of the tests above. Like this -
inquirer.prompt([
{
type: 'list',
name: 'Which workflow do you want to run?',
choices: ['Power Off', 'Diagnostic']
}
]).then((answers) => {
if(answers == 'Power Off'){
PowerflowSuite(imei, location, workstation, workflowName);
}
})
How ever when I test that Mocha seems to not wait for the user input from inquerior to run the tests and I get an output like this -
$ npm test
> metistests@1.0.0 test C:\Users\DPerez1\Desktop\metis-automation
> mocha
? Which workflow do you want to run?: (Use arrow keys)
> Power Off
Diagnostic
0 passing (0ms)
Seems like it runs and doesnt see a any tests and finishes and when I select the answer the program just closes.
I am wondering why Mocha does this and if its possible to run my existing mocha scripts with a library like inquirer.
Aucun commentaire:
Enregistrer un commentaire