lex82
lex82

Reputation: 11317

How to execute a shell command from a protractor end-to-end test?

I am writing protractor end-to-end tests and I have to reset the database before each test. In order to do that, I need to call a shell script. Is that possible? If yes, how?

Upvotes: 2

Views: 2242

Answers (1)

Jagannath
Jagannath

Reputation: 78

This is not exactly a protractor related issue , but with jasmine. I am assuming you are jasmine bdd + protractor . You need to invoke a method , which executes the cmd or shell script file , in the beforeEach block .

one can use the unix-cmd nodejs package. OR One can take it a step further , by saving the commands to b executed in a utilities method and invoking the speific utilities method in the before each block. You can check the jasmine documentation for it.

Hope this helps.

Upvotes: 2

Related Questions