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

upgradePlanLink 	  = '.avatararea-popup .kdview [href="/Pricing"]'
upgradePlanButton	  = '.kdmodal-inner .green'
upgradePlanName     = '.plan-name'
tooltipValidation   = '.kdtooltip'

freePlanSelector    = '.single-plan.free.current'


module.exports = 

  checkInvalidCardNumber: (browser) ->

    helpers.beginTest(browser)

    inputWrapper = '.input-wrapper'

    browser
      .url                     helpers.getUrl() + '/Pricing'
      .waitForElementVisible   '.content-page.pricing', 20000
      .waitForElementVisible   '.current', 20000
      .element 'css selector', freePlanSelector, (result) ->
        if result.status is 0
          helpers.selectPlan(browser, 'developer')
          .waitForElementVisible      upgradePlanName, 10000
          .assert.containsText        upgradePlanName, 'Developer Plan'
          .assert.containsText        '.card-number', 'Card Number'
          .setValue                   inputWrapper + ' .kdinput', '111111111111'
          .waitForElementVisible      inputWrapper + ' .validation-error', 5000
          .assert.containsText        tooltipValidation, 'Card number is not valid'

          .expect.element(upgradePlanButton).to.not.be.enabled
          browser.end()
        else
          browser.end()


  checkInvalidCVC: (browser) ->

    helpers.beginTest(browser)

    cvcInputField = ' [name=cardCVC]'

    browser
      .url                     helpers.getUrl() + '/Pricing'
      .waitForElementVisible   '.content-page.pricing', 20000
      .waitForElementVisible   '.current', 20000
      .element 'css selector', freePlanSelector, (result) ->
        if result.status is 0
          helpers.selectPlan(browser, 'developer')
          .waitForElementVisible      upgradePlanName, 10000
          .assert.containsText        upgradePlanName, 'Developer Plan'
          .assert.containsText        '.cardcvc .cvc', 'CVC'
          .setValue                   cvcInputField, '12345'
          .waitForElementVisible      cvcInputField, 5000
          .assert.containsText        tooltipValidation, 'CVC is not valid'

          .expect.element(upgradePlanButton).to.not.be.enabled
          browser.end()
        else
          browser.end()


  checkInvalidExpirationMonth: (browser) ->

    helpers.beginTest(browser)

    cardMonthInputField = '[name=cardMonth]'

    browser
      .url                     helpers.getUrl() + '/Pricing'
      .waitForElementVisible   '.content-page.pricing', 20000
      .waitForElementVisible   '.current', 20000
      .element 'css selector', freePlanSelector, (result) ->
        if result.status is 0
          helpers.selectPlan(browser, 'developer')
          .waitForElementVisible       upgradePlanName, 10000
          .assert.containsText        upgradePlanName, 'Developer Plan'
          .assert.containsText        '.cardmonth .exp-date', 'Exp. Date'
          .setValue                   cardMonthInputField, '88'
          .waitForElementVisible      cardMonthInputField, 5000
          .assert.containsText        tooltipValidation, 'Invalid month!'

          .expect.element(upgradePlanButton).to.not.be.enabled
          browser.end()
        else
          browser.end()<commit_msg>(test: invalid card details) - alignment problem solved<commit_after>helpers = require '../helpers/helpers.js'
assert  = require 'assert'

upgradePlanLink   = '.avatararea-popup .kdview [href="/Pricing"]'
upgradePlanButton = '.kdmodal-inner .green'
upgradePlanName   = '.plan-name'
tooltipValidation = '.kdtooltip'

freePlanSelector  = '.single-plan.free.current'


module.exports = 

  checkInvalidCardNumber: (browser) ->

    helpers.beginTest(browser)

    inputWrapper = '.input-wrapper'

    browser
      .url                     helpers.getUrl() + '/Pricing'
      .waitForElementVisible   '.content-page.pricing', 20000
      .waitForElementVisible   '.current', 20000
      .element 'css selector', freePlanSelector, (result) ->
        if result.status is 0
          helpers.selectPlan(browser, 'developer')
          .waitForElementVisible      upgradePlanName, 10000
          .assert.containsText        upgradePlanName, 'Developer Plan'
          .assert.containsText        '.card-number', 'Card Number'
          .setValue                   inputWrapper + ' .kdinput', '111111111111'
          .waitForElementVisible      inputWrapper + ' .validation-error', 5000
          .assert.containsText        tooltipValidation, 'Card number is not valid'

          .expect.element(upgradePlanButton).to.not.be.enabled
          browser.end()
        else
          browser.end()


  checkInvalidCVC: (browser) ->

    helpers.beginTest(browser)

    cvcInputField = ' [name=cardCVC]'

    browser
      .url                     helpers.getUrl() + '/Pricing'
      .waitForElementVisible   '.content-page.pricing', 20000
      .waitForElementVisible   '.current', 20000
      .element 'css selector', freePlanSelector, (result) ->
        if result.status is 0
          helpers.selectPlan(browser, 'developer')
          .waitForElementVisible      upgradePlanName, 10000
          .assert.containsText        upgradePlanName, 'Developer Plan'
          .assert.containsText        '.cardcvc .cvc', 'CVC'
          .setValue                   cvcInputField, '12345'
          .waitForElementVisible      cvcInputField, 5000
          .assert.containsText        tooltipValidation, 'CVC is not valid'

          .expect.element(upgradePlanButton).to.not.be.enabled
          browser.end()
        else
          browser.end()


  checkInvalidExpirationMonth: (browser) ->

    helpers.beginTest(browser)

    cardMonthInputField = '[name=cardMonth]'

    browser
      .url                     helpers.getUrl() + '/Pricing'
      .waitForElementVisible   '.content-page.pricing', 20000
      .waitForElementVisible   '.current', 20000
      .element 'css selector', freePlanSelector, (result) ->
        if result.status is 0
          helpers.selectPlan(browser, 'developer')
          .waitForElementVisible      upgradePlanName, 10000
          .assert.containsText        upgradePlanName, 'Developer Plan'
          .assert.containsText        '.cardmonth .exp-date', 'Exp. Date'
          .setValue                   cardMonthInputField, '88'
          .waitForElementVisible      cardMonthInputField, 5000
          .assert.containsText        tooltipValidation, 'Invalid month!'

          .expect.element(upgradePlanButton).to.not.be.enabled
          browser.end()
        else
          browser.end()
{'fraction_non_alphanumeric': 0.10166414523449319, 'fraction_numerical': 0.02390317700453858, 'mean_word_length': 2.14061757719715, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6881883', 'n_tokens_mistral': 1959, 'n_tokens_neox': 1741, 'n_words': 367}