Nightwatch

In the file App test.js add the below code

module.exports= {
	"Grocery Store": function(browser)
	{
		browser
			.url("https://localhost:8000")
			.assert.urlContains(http://localhost:8000")
			.assert.titleContains("Grocery Store")
			.elements("xpath","//figcaption/button",function(result)
			{
				console.log(result.value.length)
				for (var i=1; i<=result.value.length;i++0
				{
					browser.useXpath()
					browser.click("(//figcaption/button)["+i+"]")
					browser.setAlertText("1")
					browser.acceptAlert()
				}
					browser.getText("//*[@id='total']".function(result){
						console.log(result)
					})
			
			})
	

	}
}	

In the file nightwatch.conf.js add the below code

src_folders: ["test"]
output_folder: "report"
launch_url: "http://localhost:8000"

Leave a Reply