 parsePrice = (str) ->
   str = str.substring(1, str.length) # strip $
   parseFloat str
-
-sleep = (seconds) ->
-  e = new Date().getTime() + (seconds * 1000)
-  while (new Date().getTime() <= e)
-    1
 
 describe "Checkout (#{process.env.BROWSER})", ->
   testPage = "http://localhost:#{process.env.PORT ? 3333}/widget.html"

    it 'should work', (done) ->
      getBrowser()
        .url testPage
        .waitForExist 'modal', ->
          sleep 1
        .click 'a.btn'
        .waitForExist '.crowdstart-active'
        .waitForExist '.crowdstart-line-item'
        .waitForEnabled '#crowdstart-credit-card', ->
          sleep 1
        .setValue '#crowdstart-credit-card', '4242424242424242'
        .setValue '#crowdstart-expiry', '1122'
        .setValue '#crowdstart-cvc', '424'
        .click 'span.crowdstart-checkbox'
        .click 'a.crowdstart-checkout-button'
        .waitForEnabled '#crowdstart-line1', ->
          sleep 1
        .setValue '#crowdstart-line1', '1234 fake street'
        .setValue '#crowdstart-city', 'fake city'
        .setValue '#crowdstart-state', 'fake state'
        .setValue '#crowdstart-postalCode', '55555'
        .click 'a.crowdstart-checkout-button'
        .waitForExist '.crowdstart-loader', 10000, true, ->
          sleep 1
        .getText '.crowdstart-thankyou > form > h1', (err, res) ->
          assert.strictEqual res, 'Thank You'
        .end done

      getBrowser()
        .url testPage

        .waitForExist 'modal'

        # Click the Buy button
        .click 'a.btn'
