Skip to content

Latest commit

 

History

History
150 lines (139 loc) · 8.36 KB

TESTING.md

File metadata and controls

150 lines (139 loc) · 8.36 KB

TESTING.md

Front-End Tests

HTML

W3 Validator HTML Validator Template Tests

W3C Jigsaw Test

CSS Validation Testing

  • Date: July 8, 2021
  • Issue: 'CSS Validation Service Testing'
    1. Visit W3C Jigsaw CSS Validation Service.
    1. Open workspace and copy the contents of base.css.
    1. Navigate back to CSS Validator and paste clipboard contents into the text area.
    1. Submit the form.
    1. Carefully review all warnings and errors.
    1. Fix all errors until there are no more and the page reads: jigsaw
    1. Repeat test if/when any changes are made to the stylesheet.

Back-End Tests

Database Tests

Database Conflict Test #1

  • Date: June 28, 2021, 4:38pm
  • Issue: 'Build failed after replacing Django model fields'
      1. Open hue-alissa.herokuapp.com in a web browser
      1. Navigate to 'hue-alissa.herokuapp.com/admin' and click on 'Orders'
      1. Observe an error message in the admin caused by missing fields.
      1. Retrace recent steps that were taken to edit the database.
      1. Determine problem was most likely caused by manually deleting migration files and only performing `zero-out migration on the SQLite (development) database.
      1. Conclude that this activity led to corruption.
      1. Determine the best course of action and take the following steps:
        • Provision new PostgreSQL database on Heroku.
        • Connect the database to manage.py
        • Load data into the new database.

Order Model Timestamp Test #1

  • Issue: 'Receipts for orders incorrectly timestamped'
      1. Open hue-alissa.herokuapp.com in a web browser
      1. Navigate to 'hue-alissa.herokuapp.com/admin' and click on 'Shop'
      1. Add products to the shopping cart and proceed to checkout for the test.
      1. Fill out the form and select, 'Complete Order'.
      1. Observe order confirmation is displayed upon submitting the order form.
      1. Review checkout_success.html and notice outputted 'time' is 4 hours ahead.
      1. Ensure order date is accurate and check order summary for additional errors.
      1. Open my IDE and visit checkout/models.py to ensure the date field is set up properly.
      1. Use Google, Stack Overflow & Django's documentation to learn about DateTime and timezone settings.
      1. Update the DateTime import on the top of checkout/models.py to read:
        • import datetime
        • now = datetime.datetime.now()
      1. Complete steps 1 - 7 again and observe that time is still incorrect (displaying one hour early now).
      1. Review Django''s documentation again.
      1. Decide to set timezone across the project by updating settings.py with timezone setting:
        • USE_TZ = True
        • TIME_ZONE = 'America/New_York'

Heroku

Build Failed Test #2

  • Date: June 30, 2021
      1. Open hue-alissa.herokuapp.com in a web browser
      1. Observe Heroku 'Application Error' is rendering on the front-end of the app.
      1. Open a terminal and enter heroku logs -tail.
      1. Read through the error log.
      1. Read error, "storages module could not be found".
      1. Visit, settings.py file and ensure storages are properly configured.
      1. Visit Git repository on GitHub.
      1. Inspect the commit that corresponds with the last successful build on Heroku.
      1. Review entire commit history from that day, paying close attention to any environmental changes that may have led to the crash.
      1. Visit Google and enter search the topic.
      1. Observe a post on Stack Overflow, advising to ensure Django-storages was/is not installed outside of a Django virtual environment.
      1. Visit the command line and enter pip freeze from my default bash profile.
      1. Review the contents of requirements.txt
      1. Activate my virtual environment and enter pip freeze.
      1. Review the contents of requirements.txt and notice django-storages is not listed in the file.
      1. Reinstall django-storages from my virtual environment.
      1. Freeze the requirements file.
      1. Save, commit and push these changes to Heroku.

Stripe Tests

Test #1: Setup Stripe CLI

  • Date: July 10, 2021, 10:38am
  • Objective: 'Setup Stripe CLI'
      1. Open terminal in my local development environment.
      1. Use Homebrew to install the Stripe CLI: brew install stripe/stripe-CLI/stripe
      1. Login: stripe login
      1. Ensure the output includes a Stripe pairing code, then press "Enter" to open a browser and log in to Stripe.
      1. Run a test command to ensure setup was successful: stripe customers create.
      1. Review raw Customer Object JSON output.
      1. Navigate to Stripe Dashboard and confirm that a new customer object has been created successfully.

Test #2: Use Stripe CLI to Test Webhook Endpoint

  • Date: July 10, 2021, 10:45am

  • Objective: 'Test Stripe webhook endpoint using Stripe CLI'

      1. Open terminal in local development environment.
      1. Enter stripe listen to begin listening for events.
      1. Review output Ready! Your webhook signing secret is whsec_##############.
      1. Trigger an event: stripe trigger payment_intent.succeeded stripe test
      1. Review output: stripe test output
      1. Forward events to my local server: stripe listen --forward-to localhost:8000/checkout/wh/
      1. Observe output with new signing secret.
      1. Open project in web browser and add products to shopping cart.
      1. Visit the checkout page.
      1. Head back to terminal window and observe output reads, payment_intent.created.
      1. Fill out the payment form with Stripe test credit card credentials and click, submit.
      1. Observe two new lines of output from STRIPE-CLI:
      • 'payment_intent.succeeded'
      • 'charge_succeeded'.
      1. Open Stripe developer dashboard and click, 'events.'
      1. Verify payment succeeded.
      1. Declare test, 'passed', proving that Stripe payment intents are being both created & completed successfully on the front & back end.

    Test #3: Content Error

  • Date: July 10, 2021, 10:45am

  • Issue: 'Test webhook endpoint request from Stripe's dashboard is returning a 401 error'

      1. Visit Stripe 'Webhooks' section of dashboard and click 'Add Endpoint`.
      1. Configure the endpoint accordingly.
      1. Click, Send test webhook.
      1. Observe a 401 error on Stripe: Test webhook error: 401
      1. Review Stripe's documentation regarding content errors:
      1. Visit the 'Error Codes' section of Stripe's documentation and learn that a 400 error status code in this context is most likely the result of a missing or incorrect parameter:
    • Visit workspace and review the contents of, views.py.
    • Notice, client_secret is still set to test secret.
    • Refactor accordingly.
    • Navigate to, settings.py and review all Stripe keys.
    • Notice that the keys in settings.py are improperly configured.
    • Repair key configurations.
    • Mark test, 'passed'.