mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-26 17:16:11 -05:00
Rename tests for the demographic and organization steps for consistency. Clean up teacher_registration_utils
This commit is contained in:
parent
60565d22c6
commit
e357a62c2c
3 changed files with 7 additions and 28 deletions
|
@ -13,8 +13,7 @@ module.exports.fillUsernameSlide = function (driver, seleniumWebdriver) {
|
||||||
var usernameInput = driver.findElement(seleniumWebdriver.By.name('user.username'));
|
var usernameInput = driver.findElement(seleniumWebdriver.By.name('user.username'));
|
||||||
var usernamePromise = usernameInput.sendKeys('clipspringer');
|
var usernamePromise = usernameInput.sendKeys('clipspringer');
|
||||||
var passwordPromise = passwordInput.sendKeys('educators');
|
var passwordPromise = passwordInput.sendKeys('educators');
|
||||||
var nextStepButton = driver.findElement(seleniumWebdriver.By.xpath('//button[span[contains(text(),'
|
var nextStepButton = driver.findElement(seleniumWebdriver.By.xpath(module.exports.constants.nextStepXpath));
|
||||||
+ '"Next Step")]]'));
|
|
||||||
return Promise.all([usernamePromise, passwordPromise]).then(function () {
|
return Promise.all([usernamePromise, passwordPromise]).then(function () {
|
||||||
nextStepButton.click().then(function () {
|
nextStepButton.click().then(function () {
|
||||||
driver.wait(seleniumWebdriver.until
|
driver.wait(seleniumWebdriver.until
|
||||||
|
|
|
@ -29,15 +29,11 @@ tap.beforeEach(function () {
|
||||||
tap.test('checkOtherGenderInput', function (t) {
|
tap.test('checkOtherGenderInput', function (t) {
|
||||||
var otherGenderRadio = driver.findElement(seleniumWebdriver.By.xpath('//input[@value="other"' +
|
var otherGenderRadio = driver.findElement(seleniumWebdriver.By.xpath('//input[@value="other"' +
|
||||||
'and @type="radio"]'));
|
'and @type="radio"]'));
|
||||||
var nextStepButton = driver.findElement(seleniumWebdriver.By.xpath('//button[span[contains(text(),'
|
var nextStepButton = driver.findElement(seleniumWebdriver.By.xpath(constants.nextStepXpath));
|
||||||
+ '"Next Step")]]'));
|
|
||||||
var errorMessage = 'This field is required';
|
|
||||||
var errorMessageXPath = '//span[@class="help-block validation-message" and contains(text(),"'
|
|
||||||
+ errorMessage + '")]';
|
|
||||||
driver.findElement(seleniumWebdriver.By.xpath('//select[@name="user.country"]/option[2]')).click();
|
driver.findElement(seleniumWebdriver.By.xpath('//select[@name="user.country"]/option[2]')).click();
|
||||||
otherGenderRadio.click().then(function () {
|
otherGenderRadio.click().then(function () {
|
||||||
nextStepButton.click().then(function () {
|
nextStepButton.click().then(function () {
|
||||||
driver.findElements(seleniumWebdriver.By.xpath(errorMessageXPath))
|
driver.findElements(seleniumWebdriver.By.xpath(constants.generalErrorMessageXPath))
|
||||||
.then(function (validationMessages) {
|
.then(function (validationMessages) {
|
||||||
t.equal(validationMessages.length, 1);
|
t.equal(validationMessages.length, 1);
|
||||||
t.end();
|
t.end();
|
|
@ -16,22 +16,6 @@ var constants = utils.constants;
|
||||||
//chrome driver
|
//chrome driver
|
||||||
var driver = new seleniumWebdriver.Builder().withCapabilities(seleniumWebdriver.Capabilities.chrome()).build();
|
var driver = new seleniumWebdriver.Builder().withCapabilities(seleniumWebdriver.Capabilities.chrome()).build();
|
||||||
|
|
||||||
var fillUsernameSlide = function () {
|
|
||||||
return utils.fillUsernameSlide(driver, seleniumWebdriver);
|
|
||||||
};
|
|
||||||
|
|
||||||
var fillDemographicsSlide = function () {
|
|
||||||
return utils.fillDemographicsSlide(driver, seleniumWebdriver);
|
|
||||||
};
|
|
||||||
|
|
||||||
var fillNameSlide = function () {
|
|
||||||
return utils.fillNameSlide(driver, seleniumWebdriver);
|
|
||||||
};
|
|
||||||
|
|
||||||
var fillPhoneSlide = function () {
|
|
||||||
return utils.fillPhoneSlide(driver, seleniumWebdriver);
|
|
||||||
};
|
|
||||||
|
|
||||||
tap.plan(4);
|
tap.plan(4);
|
||||||
|
|
||||||
tap.tearDown(function () {
|
tap.tearDown(function () {
|
||||||
|
@ -40,10 +24,10 @@ tap.tearDown(function () {
|
||||||
|
|
||||||
tap.beforeEach(function () {
|
tap.beforeEach(function () {
|
||||||
driver.get('https://scratch.mit.edu/educators/register');
|
driver.get('https://scratch.mit.edu/educators/register');
|
||||||
return fillUsernameSlide()
|
return utils.fillUsernameSlide(driver, seleniumWebdriver)
|
||||||
.then(fillDemographicsSlide)
|
.then(function () { utils.fillDemographicsSlide(driver, seleniumWebdriver); })
|
||||||
.then(fillNameSlide)
|
.then(function () { utils.fillNameSlide(driver, seleniumWebdriver); })
|
||||||
.then(fillPhoneSlide);
|
.then(function () { utils.fillPhoneSlide(driver, seleniumWebdriver); });
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('otherFieldRequiredIfChecked', function (t) {
|
tap.test('otherFieldRequiredIfChecked', function (t) {
|
Loading…
Reference in a new issue