<commit_before>utils   = require '../utils/utils.js'
helpers = require '../helpers/helpers.js'


module.exports =

  editFirstName: (browser) ->

    helpers.beginTest(browser)
    inputSelector = '.firstname input.text'

    helpers.changeName(browser, inputSelector, yes)
    browser.end()


  editLastName: (browser) ->

    helpers.beginTest(browser)
    inputSelector = '.lastname input.text'

    helpers.changeName(browser, inputSelector, no)
    browser.end()<commit_msg>Tests: Account: AccountSettings: Added changePassword test.<commit_after>utils   = require '../utils/utils.js'
helpers = require '../helpers/helpers.js'


module.exports =

  editFirstName: (browser) ->

    helpers.beginTest(browser)
    inputSelector = '.firstname input.text'

    helpers.changeName(browser, inputSelector, yes)
    browser.end()


  editLastName: (browser) ->

    helpers.beginTest(browser)
    inputSelector = '.lastname input.text'

    helpers.changeName(browser, inputSelector, no)
    browser.end()


  changePassword: (browser) ->

    newPassword           = utils.getPassword()
    inputSelector         = '.password input.text'
    modalSelector         = '.AppModal-form'
    passwordModalSelector = '.kdmodal.kddraggable:not(.AppModal)'
    saveButtonSelector    = '.AppModal--account .button-field button'

    user = helpers.beginTest(browser)
    helpers.openAccountPage(browser)

    browser
      .waitForElementVisible   inputSelector, 20000
      .clearValue              modalSelector + ' input[name=password]'
      .setValue                modalSelector + ' input[name=password]', newPassword
      .clearValue              modalSelector + ' input[name=confirmPassword]'
      .setValue                modalSelector + ' input[name=confirmPassword]', newPassword

      .waitForElementVisible   saveButtonSelector, 20000
      .click                   saveButtonSelector

      .waitForElementVisible   passwordModalSelector , 20000
      .waitForElementVisible   passwordModalSelector + ' input[name=password]', 20000
      .setValue                passwordModalSelector + ' input[name=password]', user.password, =>
        browser
          .click                   passwordModalSelector + ' button[type=submit]'

          .waitForElementVisible   '.kdnotification.main', 20000
          .click                   '.kdmodal-inner .close-icon'

        utils.getUser(yes)
        user.password = <PASSWORD>

        helpers.doLogout(browser)
        helpers.doLogin(browser, user)
        browser.end()
{'fraction_non_alphanumeric': 0.10578446909667195, 'fraction_numerical': 0.009904912836767036, 'mean_word_length': 2.6435786435786435, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2126590', 'n_tokens_mistral': 725, 'n_tokens_neox': 677, 'n_words': 127}