mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-22 15:17:53 -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 usernamePromise = usernameInput.sendKeys('clipspringer');
|
||||
var passwordPromise = passwordInput.sendKeys('educators');
|
||||
var nextStepButton = driver.findElement(seleniumWebdriver.By.xpath('//button[span[contains(text(),'
|
||||
+ '"Next Step")]]'));
|
||||
var nextStepButton = driver.findElement(seleniumWebdriver.By.xpath(module.exports.constants.nextStepXpath));
|
||||
return Promise.all([usernamePromise, passwordPromise]).then(function () {
|
||||
nextStepButton.click().then(function () {
|
||||
driver.wait(seleniumWebdriver.until
|
||||
|
|
|
@ -29,15 +29,11 @@ tap.beforeEach(function () {
|
|||
tap.test('checkOtherGenderInput', function (t) {
|
||||
var otherGenderRadio = driver.findElement(seleniumWebdriver.By.xpath('//input[@value="other"' +
|
||||
'and @type="radio"]'));
|
||||
var nextStepButton = driver.findElement(seleniumWebdriver.By.xpath('//button[span[contains(text(),'
|
||||
+ '"Next Step")]]'));
|
||||
var errorMessage = 'This field is required';
|
||||
var errorMessageXPath = '//span[@class="help-block validation-message" and contains(text(),"'
|
||||
+ errorMessage + '")]';
|
||||
var nextStepButton = driver.findElement(seleniumWebdriver.By.xpath(constants.nextStepXpath));
|
||||
driver.findElement(seleniumWebdriver.By.xpath('//select[@name="user.country"]/option[2]')).click();
|
||||
otherGenderRadio.click().then(function () {
|
||||
nextStepButton.click().then(function () {
|
||||
driver.findElements(seleniumWebdriver.By.xpath(errorMessageXPath))
|
||||
driver.findElements(seleniumWebdriver.By.xpath(constants.generalErrorMessageXPath))
|
||||
.then(function (validationMessages) {
|
||||
t.equal(validationMessages.length, 1);
|
||||
t.end();
|
|
@ -16,22 +16,6 @@ var constants = utils.constants;
|
|||
//chrome driver
|
||||
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.tearDown(function () {
|
||||
|
@ -40,10 +24,10 @@ tap.tearDown(function () {
|
|||
|
||||
tap.beforeEach(function () {
|
||||
driver.get('https://scratch.mit.edu/educators/register');
|
||||
return fillUsernameSlide()
|
||||
.then(fillDemographicsSlide)
|
||||
.then(fillNameSlide)
|
||||
.then(fillPhoneSlide);
|
||||
return utils.fillUsernameSlide(driver, seleniumWebdriver)
|
||||
.then(function () { utils.fillDemographicsSlide(driver, seleniumWebdriver); })
|
||||
.then(function () { utils.fillNameSlide(driver, seleniumWebdriver); })
|
||||
.then(function () { utils.fillPhoneSlide(driver, seleniumWebdriver); });
|
||||
});
|
||||
|
||||
tap.test('otherFieldRequiredIfChecked', function (t) {
|
Loading…
Reference in a new issue