diff --git a/test/integration/teacher-registration/teacher_registration_utils.js b/test/integration/teacher-registration/teacher_registration_utils.js index 51f3f6ade..8b29c1c1d 100644 --- a/test/integration/teacher-registration/teacher_registration_utils.js +++ b/test/integration/teacher-registration/teacher_registration_utils.js @@ -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 diff --git a/test/integration/teacher-registration/test_teacher_registration_demographics.js b/test/integration/teacher-registration/test_teacher_registration_demographics_step.js similarity index 86% rename from test/integration/teacher-registration/test_teacher_registration_demographics.js rename to test/integration/teacher-registration/test_teacher_registration_demographics_step.js index e2126f62b..f0164ca32 100644 --- a/test/integration/teacher-registration/test_teacher_registration_demographics.js +++ b/test/integration/teacher-registration/test_teacher_registration_demographics_step.js @@ -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(); diff --git a/test/integration/teacher-registration/test_teacher_registration_organization.js b/test/integration/teacher-registration/test_teacher_registration_organization_step.js similarity index 86% rename from test/integration/teacher-registration/test_teacher_registration_organization.js rename to test/integration/teacher-registration/test_teacher_registration_organization_step.js index bda81b693..8cdf97b7e 100644 --- a/test/integration/teacher-registration/test_teacher_registration_organization.js +++ b/test/integration/teacher-registration/test_teacher_registration_organization_step.js @@ -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) {