Last active
October 3, 2018 14:12
Star
You must be signed in to star a gist
Automate rapid/fast creation of sandbox testers in itunesConnect
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
// Steps to use: | |
// 1. Go to itunesConnect > Users & Roles | |
// 2. Select "Testers" under the "Sandbox" header on the left | |
// 2. Open the console on your browser (eg. CMD-OPT-J) | |
// 3. Paste the code below (modified to your liking) into the console and hit enter | |
// 4. enter `createUser('desiredEmailAlias')` into the console and watch the user get created automatically | |
// | |
// NOTE: To create several users rapidly: in the console hit the up arrow, change the alias, and hit enter again. Repeat. | |
// Edit the user here to your liking | |
var user = { | |
firstName: "Jeff", | |
lastName: "Knuckles", | |
emailDomain: "test.com", | |
password: "Jane1234!", | |
question: "question1", | |
answer: "answer1", | |
birthMonth: "1", | |
birthYear: "1", | |
territory: "USA" | |
} | |
// Don't edit anything below this line | |
// ----------------------------------------------------- | |
var jq = document.createElement('script'); | |
jq.src = "//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"; | |
document.getElementsByTagName('head')[0].appendChild(jq); | |
var inputTypes = [ | |
window.HTMLInputElement, | |
window.HTMLSelectElement, | |
window.HTMLTextAreaElement, | |
]; | |
function triggerInputChange(node, value) { | |
// only process the change on elements we know have a value setter in their constructor | |
if ( inputTypes.indexOf(node.__proto__.constructor) >-1 ) { | |
var setValue = Object.getOwnPropertyDescriptor(node.__proto__, 'value').set; | |
var eventType = inputTypes.indexOf(node.__proto__.constructor) == 1 ? 'change' : 'input' | |
var event = new Event(eventType, { bubbles: true }); | |
setValue.call(node, value); | |
node.dispatchEvent(event); | |
} | |
}; | |
function createUser(alias) { | |
var userDetails = { | |
"input[name=firstName]": user.firstName, | |
"input[name=lastName]": user.lastName, | |
"input[name=email]": alias+'@'+user.emailDomain, | |
"input[name=password]": user.password, | |
"input[name=confirmPassword]": user.password, | |
"input[name=secretQuestion]": user.question, | |
"input[name=secretAnswer]": user.answer, | |
".territory-selector select": user.territory, | |
".date-selector div:nth-child(1) select": user.birthMonth, | |
".date-selector div:nth-child(2) select": user.birthYear, | |
} | |
// click on the "+" button to bring up the user fields | |
jQuery('.tb-icon--plus-alt-filled').click() | |
// wait briefly for the fields to come up | |
setTimeout(function(){ | |
// trigger a change on each user field | |
for (var k in userDetails) { | |
triggerInputChange(jQuery(k)[0], userDetails[k]) | |
} | |
// wait briefly for all the fields to be updated | |
setTimeout(function(){ | |
// click on the "invite" button | |
jQuery('.tb-btn--primary').click() | |
}, 500); | |
}, 500); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment