-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
123 additions
and
78 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
_ = require("jasmine-node"); | ||
var tester = require("./selenium-init.js"); | ||
var webdriver = require('selenium-webdriver'); | ||
|
||
var contains = tester.contains; | ||
var waitThenClick = tester.waitThenClick; | ||
var googleLogin = tester.googleLogin; | ||
var googleLogout = tester.googleLogout; | ||
|
||
describe("Saving programs", function() { | ||
tester.start(function(maybeServer, baseUrl, driver) { | ||
tester.webbit("should open up the editor and save a new program", function(done) { | ||
var name = "test-program" + String(Math.floor(Math.random() * 10000)); | ||
driver.get(baseUrl); | ||
driver.findElement(webdriver.By.id('login')).click(); | ||
tester.googleLogin(driver); | ||
driver.get(baseUrl + "/editor"); | ||
tester.waitForPyretLoad(driver, 15000); | ||
driver.findElement(webdriver.By.id('program-name')).sendKeys(name); | ||
driver.findElement(webdriver.By.id('saveButton')).click(); | ||
driver.wait(function() { | ||
return driver.isElementPresent(tester.contains("saved as " + name)); | ||
}, 4000); | ||
driver.get(baseUrl + "/my-programs"); | ||
driver.wait(function() { | ||
return driver.isElementPresent(tester.contains(name)); | ||
}, 4000); | ||
driver.call(done); | ||
}, 60000); | ||
|
||
it("should close the server and the connection to the browser", function(done) { | ||
console.log("closing down server"); | ||
if(maybeServer) { maybeServer.close(); } | ||
driver.quit(); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
_ = require("jasmine-node"); | ||
var tester = require("./selenium-init.js"); | ||
var webdriver = require('selenium-webdriver'); | ||
|
||
var contains = tester.contains; | ||
var waitThenClick = tester.waitThenClick; | ||
var googleLogin = tester.googleLogin; | ||
var googleLogout = tester.googleLogout; | ||
|
||
describe("Sign in", function() { | ||
tester.start(function(maybeServer, baseUrl, driver) { | ||
tester.webbit("Should forget everything it knows", function(done) { | ||
driver.get("https://security.google.com/settings/security/permissions"); | ||
googleLogin(driver); | ||
console.log("Waiting to see if Patch permissions are present..."); | ||
driver.wait(function() { | ||
return driver.executeScript("return document.readyState === 'complete'"); | ||
}, 3000); | ||
driver.isElementPresent(contains("Patch Test")).then(function(present) { | ||
if(present) { | ||
waitThenClick(driver, contains("Patch Test")); | ||
waitThenClick(driver, contains("Revoke access")); | ||
return waitThenClick(driver, webdriver.By.name("ok")); | ||
} else { | ||
// do nothing otherwise | ||
} | ||
}); | ||
googleLogout(driver); | ||
driver.call(done); | ||
}, 60000); | ||
|
||
tester.webbit("Should sign up from not being logged in", function(done) { | ||
driver.get(baseUrl); | ||
driver.findElement(webdriver.By.id('login')).click(); | ||
googleLogin(driver); | ||
console.log("Waiting for permission confirmation button..."); | ||
driver.wait(function() { | ||
return driver.findElement(webdriver.By.id("submit_approve_access")).getAttribute("disabled") | ||
.then(function(disabled) { | ||
return !disabled; | ||
}); | ||
}, 3000); | ||
driver.findElement(webdriver.By.id("submit_approve_access")).click(); | ||
tester.waitForPyretLoad(driver); | ||
driver.call(done); | ||
}, 60000); | ||
|
||
tester.webbit("When logging back in, should skip authentication and go straight to my-programs", function(done) { | ||
driver.get(baseUrl); | ||
driver.findElement(webdriver.By.id('login')).click(); | ||
tester.waitForPyretLoad(driver); | ||
driver.call(done); | ||
}, 60000); | ||
|
||
tester.webbit("If cookies are cleared, should still log in seamlessly and work", function(done) { | ||
driver.manage().deleteAllCookies(); | ||
driver.get(baseUrl); | ||
driver.findElement(webdriver.By.id('login')).click(); | ||
tester.waitForPyretLoad(driver); | ||
driver.call(done); | ||
}, 60000); | ||
|
||
it("Should close the server and the connection to the browser", function(done) { | ||
console.log("closing down server"); | ||
if(maybeServer) { maybeServer.close(); } | ||
done(); | ||
}); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.