<commit_before>module.exports = {
  url: process.env.QA_HOST,
  elements: {
    editContactDetailsButton: 'a[href*="/edit"]',
    auditHistoryTab: 'a[href*="/audit"]',
    telephone: '#field-telephone_number',
    telephoneCountryCode: '#field-telephone_countrycode',
    archiveReason: 'label[for=field-archived_reason-1]',
    unarchiveAnContactButton: 'a[href*="/unarchive"]',
    userName: 'a[href*="/profile"]',
  },

  commands: [
    {
      editContactDetails (telephone, countryCode, number) {
        this.click('@editContactDetailsButton')
        if (number > 1) {
          this.clearValue('@telephoneCountryCode')
          this.setValue('@telephoneCountryCode', countryCode)
        }
        this.clearValue('@telephone')
        this.setValue('@telephone', telephone)
        return this
      },
    },
  ],
}<commit_msg>Add wait for contact element to be visible before editing<commit_after>module.exports = {
  url: process.env.QA_HOST,
  elements: {
    editContactDetailsButton: 'a[href*="/edit"]',
    auditHistoryTab: 'a[href*="/audit"]',
    telephone: '#field-telephone_number',
    telephoneCountryCode: '#field-telephone_countrycode',
    archiveReason: 'label[for=field-archived_reason-1]',
    unarchiveAnContactButton: 'a[href*="/unarchive"]',
    userName: 'a[href*="/profile"]',
  },

  commands: [
    {
      editContactDetails (telephone, countryCode, number) {
        this
          .click('@editContactDetailsButton')
          .waitForElementVisible('@telephoneCountryCode')
          .waitForElementVisible('@telephone')

        if (number > 1) {
          this
            .clearValue('@telephoneCountryCode')
            .setValue('@telephoneCountryCode', countryCode)
        }

        this
          .clearValue('@telephone')
          .setValue('@telephone', telephone)

        return this
      },
    },
  ],
}
{'fraction_non_alphanumeric': 0.14723267060720044, 'fraction_numerical': 0.0021493820526598604, 'mean_word_length': 3.0655021834061134, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6958823', 'n_tokens_mistral': 563, 'n_tokens_neox': 562, 'n_words': 84}