Is there a way where I can Run a script to run a website and perform log in etc. and before running a test suite using Nightwatch JS? I have tried to use beforeeach hook in global.js, but so far failed to make it work. If there is a solution for this? I will appreciate if you can respond with examples.
Asked
Active
Viewed 768 times
-1
-
Hi Jeff, I believe the question is self explanatory. I could post a lot of garbage scripts here which would add zero value to the question. I asked the question because I am stuck, so it would be more appropriate if I could get an answer to my problem. Thanks – nhrcpt Sep 10 '18 at 21:40
-
1Then don't post a bunch of garbage scripts. You are describing existing attempts and that they failed but given us no details. We aren't going to guess what you did because that's a waste of our time. Post a [mcve] and a description of how it failed, including any error messages, etc. if you want help. – JeffC Sep 10 '18 at 21:48
1 Answers
0
Finally we figured out a solution. In the below snippet the Globals.js file is the common login module that we need to run before running each test script.
const loginPage = require("../../Globals.js");
// START ------> Import Login Module from Globals.js
module.exports = {
beforeEach: function (client) {
loginPage.login(client);
},

nhrcpt
- 862
- 3
- 21
- 51