Skip to content

Instantly share code, notes, and snippets.

@sweeneyapps
Created December 27, 2019 18:22
Show Gist options
  • Select an option

  • Save sweeneyapps/7509db56acf17ac0674d198efb4bba98 to your computer and use it in GitHub Desktop.

Select an option

Save sweeneyapps/7509db56acf17ac0674d198efb4bba98 to your computer and use it in GitHub Desktop.
Login buttons for accessing various of customers account during test writing
// ==UserScript==
// @name RF Accounts
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author Paul Sweeney Jr.
// @match https://app.rainforestqa.com/login
// @grant none
// ==/UserScript==
(function() {
'use strict';
loginButtonFor("Customer 1", "[email protected]", "asdf1234");
loginButtonFor("Customer 2", "[email protected]", "asdf1234");
loginButtonFor("Customer 3", "[email protected]", "asdf1234");
function loginButtonFor(title, user, pass) {
var centeredBox = document.querySelector("#sessions_controller_new > div.wrapper > div.login > div");
var button = document.createElement("button");
button.innerHTML = title;
button.onclick = function() {
login(user, pass);
};
centeredBox.insertBefore(button, centeredBox.firstChild);
}
function login(user, pass) {
var emailField = document.querySelector("#email");
var passwordField = document.querySelector("#password");
var loginButton = document.querySelector("#sessions_controller_new > div.wrapper > div.login > div > form > button");
emailField.value = user;
passwordField.value = pass;
loginButton.click();
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment