Created
April 23, 2020 13:10
-
-
Save CITGuru/b86d3d18c858599d37e60148ff63a1d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const webdriver = require('selenium-webdriver'), | |
By = webdriver.By, | |
until = webdriver.until; | |
const driver = new webdriver.Builder() | |
.forBrowser('chrome') | |
.build(); | |
const URL ='http://svelte3-todo.surge.sh/' | |
const URL ='http://localhost:5000/' | |
driver.get(URL).then(function(){ | |
driver.findElement(webdriver.By.className('js-todo-input')).sendKeys('Build App\n').then(function(){ | |
console.log("Adding A Task: ") | |
driver.getPageSource().then(source=>{ | |
// console.log(source) | |
if(source.includes("Build App")){ | |
console.log("Test Passed!") | |
}else{ | |
console.log("Test Failed!") | |
}; | |
}); | |
driver.findElement(webdriver.By.className("tick")).click().then(function(){ | |
console.log("Marking Task Complete: "); | |
driver.findElement(webdriver.By.className("todo-item")).getAttribute("class").then(function(className){ | |
if(className.includes("done")){ | |
console.log("Test Passed!"); | |
}else{ | |
console.log("Test Failed!"); | |
} | |
driver.findElement(webdriver.By.className("delete-todo")).click().then(function(){ | |
console.log("Deleting A Task: "); | |
driver.getPageSource().then(source=>{ | |
// console.log(source) | |
if(source.includes("Build App")){ | |
console.log("Test Failed!"); | |
}else{ | |
console.log("Test Passed!"); | |
}; | |
}); | |
}); | |
}); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment