Running python script and nightwatch script hand on hand.

67 views
Skip to first unread message

Bhavesh Sharma

unread,
Apr 22, 2021, 7:47:00 AM4/22/21
to NightwatchJs
Hi All,

I appreciate all the help that i got here.

I am in a very different situation right now and not sure how to get this working.

issue is :

1.  I want to run a python script, which when run fires few API requests and at last create a machine.  this API request returns a message which contains a machine IP at last.
2.  Then I need to run the nightwatch script by using the above machine IP  (created in #1).
3. Later when the nightwatch script is completed, run another python script to delete this machine, using the same machine IP as provided by #1.

Now the issue is I dont know how can I achieve this.  im not sure how can I run the python script from  Nighwtach only, grab the output containing machine IP, and then set it global so that when second #2 runs, then that nightwatch command has this machine IP passed as parameter.

Does anyone encounter this?  any other way i can run python script, grab machine IP, then  run nightwatch script with this machie IP passed as param?

Any help is appreciated.

Thanks
bhavesh

John Kretschmann

unread,
Apr 22, 2021, 9:03:29 PM4/22/21
to NightwatchJs
Sounds like you need to take a look at AWS CodePipeline job.  We're in the process of setting this up now and it does exactly what you want.  You create a config file in the Nightwatch project that contains the specs for your AWS instance.  When you run the code pipeline job it will spin up a machine matching those specs, run the Nightwatch test, then spin down the machine.

--
You received this message because you are subscribed to the Google Groups "NightwatchJs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nightwatchjs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nightwatchjs/c08d3e36-6f5e-4029-b737-1a4bceb02dean%40googlegroups.com.

Zachary Betz

unread,
Apr 22, 2021, 9:11:04 PM4/22/21
to nightw...@googlegroups.com
You could solve this with some "glue code". 

1. Have a wrapper script. This script can be written in Bash, Python, NodeJS, or something else. Pick your poison. 
2. The wrapper script will call your Python script. Then write the result to a file or save it to a variable. 
3. Read this result in, either by reading the file in, or using the variable. 
4. Set an environment variable with this result. 
5. In your Nightwatch config, use this environment variable value as the "base url". 
6. When the tests complete, call the teardown Python script. 

Good luck. 

Bhavesh Sharma

unread,
Apr 23, 2021, 12:13:09 AM4/23/21
to NightwatchJs
Sure i will take a look at this.  any link available for  AWS CodePipeline job  ? or let me google it.

Bhavesh Sharma

unread,
Apr 23, 2021, 12:13:26 AM4/23/21
to NightwatchJs
Sure this make sense, let me try to do it
Reply all
Reply to author
Forward
0 new messages