Skip to content

Latest commit

 

History

History
715 lines (487 loc) · 28.5 KB

TESTING.md

File metadata and controls

715 lines (487 loc) · 28.5 KB

Manual and Automated Testing

This section of the documentation comprises of various manual and automated tests and online validators to check the quality of my code and also to check the functionality of the project.

See User Story:

  • USER STORY: Testing

Table of Contents


Automated Testing

Due to time constraints, I was under pressure to conclude the project and as a result I did not manage to get around to doing a thorough unittest of all the python urls, views, etc.

I have managed to do some url resolutions, including some in the cars app, the checkout app, trackdays app and the profiles app. Of the tests I have run, all pass.

I will attempt to conduct a more thorough unittest of the entire project in future.

If you wish to run the tests for yourself, simply type the following command into your terminal:

python3 manage.py test


Manual Testing

Stripe

To test the checkout payments with card details in test mode, I used the following long card numbers:

  • 4242424242424242: for successful card payments (Visa)
  • 4000056655665556L for successful card payments (Visa Debit)
  • 4000000000009995: for card with insufficient funds
  • 4000000000000002: for testing card declined

I used the above to successfully test Stripe and I am happy to say it is working as expected.

Card Number Demos

Visa Visa Debit Insufficient funds Card declined



Home/Index/Middle-Navigation

Test Method Expected Outcome Result
Django Raceway Logo/Home Link Click on Logo at top of Page Redirect to the home page PASS
Carousel Click on chevrons either side of carousel Moves to next image slide in correct direction PASS
Booking Link Click on middle nav link Opens Trackday Booking Page PASS
Cars for Hire Link Click on middle nav link Opens Car Hire Page PASS
Tuition Link Click on middle nav link Opens Tuition Page PASS
Experiences Link Click on middle nav link Opens Experiences Page PASS
Contact Link Click on middle nav link Opens Contact Page PASS
About Page Link Click on middle nav link Opens About Page PASS
Gallery Modal Click Click on a modal image in the Gallery Expands image when clicked PASS
Gallery Modal Next Click on chevrons either side of the image Moves to next image slide in correct direction PASS
Gallery Modal Close Click on the 'x' at the top of the image Closes image model PASS

Footer/Mailchimp

Test Method Expected Outcome Result
Policies Link Click on link opens the Policies page PASS
FAQs Link Click on link opens FAQs Page PASS
Up-Arrow button Click on up-arrow button Takes you to the top of the page PASS
Sign Up Button in Footer Click on Sign up button Redirect to the Newletter sign up form/page PASS
Subscribe/Mailchimp Newsletter Enter a valid email and click on subscribe Green confirmation text confirming subscription will appear PASS

Trackday Booking Page/Booking Detail

Test Method Expected Outcome Result
Trackday Display check Trackdays are rendering on the page by clicking on the 'booking' tab in the middle nav Expect to see a list of upcoming trackdays, with details including base price displayed PASS
Hide Trackday in Basket add trackday to basket and return to trackday list page trackday currently in the basket is hidden from user PASS
Button change when Trackday in basket add trackday to basket and return to trackday list page buttons should change to reflect the face that you can only book one trackday at a time PASS
Request Trackday Button click on button directs you to the track day request page and form PASS
Availability counter update checkout out with a trackday order succesfully and return to the trackday list Availability of specific trackday will decrease PASS
Booking change when full Test what happens when a trackday's availability goes to 0 Booking will disappear from the trackday list PASS

Tuition/Experiences and Detail Pages

Test Method Expected Outcome Result
Tuition Page Click on tuition tab Opens tuition page where you will see list of tuition packages displayed PASS
Experience Page Click on experiences tab and Opens experiences page where you will see list of experiences displayed PASS
Tuition Detail Open detail page through clicking explore button Specific tuition package is opened with details and an itinerary on display PASS
Experience Detail Open detail page through clicking explore button Specific experience package is opened with details and an itinerary on display PASS
Quantity adjustments Click on plus and minus buttons quantity will increment/decrement and be reflected to the user. Will also cap at a max and min value PASS
Booking button Click on the book button Item will be added to the basket with the correct quantity selected by the user PASS

Trackday Request

Test Method Expected Outcome Result
Submit Button Submit form without filling out any required fields Form validation will prevent it from sending and alert the site user PASS
Submit Button Submit with one required input filled in only Form validation will prevent it from sending and alert the site user PASS
Email input Try to enter an invalid email address or random numbers, words etc. Form will not send and user will be informed to enter a valid email address PASS
Date input Try to enter a past date or today's date JS Alert will inform the user to enter a date no sooner than today PASS
Number of spaces Try to enter an incorrect number outside of the specified min and max Form validation will prevent it from sending and alert the site user PASS
Submit Complete Form Submit a valid form via the submit button Return to home page and inform user of successful submission with a success toast PASS
Database Check output of submission in the database All filled out information should be strored correctly in the database PASS

Contact

Test Method Expected Outcome Result
Submit Form Attempt to submit blank form with nothing filled in Form validation will prevent form from sending and alert user to which input needs filling in PASS
Submit Form Attempt to submit with just one input filled in Form validation will prevent form from sending and alert user to which input needs filling in PASS
Email input Try to enter an invalid email address or random numbers, words etc. Form will not send and user will be informed to enter a valid email address PASS
Submit Valid Form Submit a complete and valid contact form Page redirects to a success version of the same page, informs the user it sent successfully PASS
Return Home Button Click on button Redirects back to the Home page PASS
Database Check output of submission in the database All filled out information should be strored correctly in the database PASS

Profile

Test Method Expected Outcome Result
Profile Link Check appearance when logged out Profile page is not accessible to users not logged in PASS
Profile Link Check appearance and click on link when logged in User will be redirected to their profile page PASS
Edit Button Click Edit Button Form fields will become editable and the button will change to 'Save' PASS
Save Button Click Save Button Form will save new details for user PASS
Input fields Enter invalid inputs for fields User will get an error message PASS
Input fields Enter Valid input for fields User will be informed that it saved successfully PASS

Authentication

Test Method Expected Outcome Result
Sign Up Create an account You will be asked to verify your account and sent an email to verify it PASS
Verification Email Click on email link to verify account Upon click, you will be redirected to the site where it will be confirmed that your account is verified PASS
Click to verify Click on the click to verify when taken to page from verification email click and redirect to the sign in page PASS
Login Login with a registered account Redirected to homepage and informed you are logged in PASS
Remember me checkbox Click on remember me checkbox button before loggin in You will not need to login next time you visit the site PASS
Forgot Password Click on Forget Password and submit email Link to set new password sent to email address supplied by user PASS

Basket and Checkout

Test Method Expected Outcome Result
Basket Link Click on Basket link in top nav Redirects to basket page PASS
Checkout Link Have nothing in the basket and check basket icon for visibility If nothing is in the basket, the checkout page will be hidden Pass
Basket Page with no items Click on basket page with nothing in the basket Item counter reads as 0 and user is informed that there are no items in the basket, summary is blank PASS
Item in Basket Add item to basket and check that it appears in the items table Chosen product will appear in the basket PASS
Multiple items in Basket Add more than one item to the basket (both quantity and different products) Quantities are implemented and counted and you are able to add all 3 different products to basket in any order PASS
Delete Item in basket Click 'Delete button Item is deleted from the basket PASS
Summary total Calculator Add items to basket, change quantities, delete items from basket total will adjust accordingly PASS
Summary VAT calculator Add items to basket and check VAT calculation 20% VAT applied automatically PASS
Checkout Button (Basket Page) Add item to basket and click on the checkout button in the basket page redirect to the stripe checkout PASS
Checkout Button (Nav Link) Add item to basket and click on the checkout link in the nav redirect to the stripe checkout PASS
Checkout validation Attempt to submit checkout with inclomplete input fields Checkout will not proceed until you have filled in all required fields PASS
Checkout Success Visit checkout, fill in required fields and click 'Pay' On successfull payment, you are redirected to the success page PASS
Checkout Cancel Visit checkout and click the back arrow button Redirected to the cancel page and basket is still saved PASS
Checkout Fail Attempt a failed checkout Redirected to the checkout fail error page, user is not charged PASS
Confirmation Email Checkout by clicking 'Pay' and check inbox of email supplied Email will send with a link to your oreder history page PASS
Order History Added/Updated Checkout and visit order history page through the link provided in the email Order is added to order history table in chronological order PASS

Management

Test Method Expected Outcome Result
Management Link Login as Admin/Superuser and open profile dropdown Management link visible and when clicked, redirect to the management add trackday page PASS
Submit Form Complete valid form and click "Add Trackday" Trackday is added to list of trackdays on the booking page PASS
Image upload to AWS On form submit, check new trackday detail image on trackday detail is available due to automated image storage to AWS PASS
Superuser Access only Try to access url as a non-admin redirect to home poage with a message saying you are not allowed to view this page PASS
Trackday list Check trackday list has new trackday added post submission new trackday is visible with all data inputs added visible PASS
Form validation Attempt to add invalid entries or incomplete form and submit Form validation prevents submission until correctly filled out PASS

Other

Test Method Expected Outcome Result
Order History Link click on link in Nav Opens user order history page PASS
Order History Table Make orders and view order history page Orders will render in a table automatically and in chronological order PASS
Stripe Receipt Link Click receipt link in the table Redirects to Stripe receipt PASS

HTML Validation

All HTML validation was done using https://validator.w3.org/nu/

/templates

File Result
base.html PASS
main-nav.html PASS
includes/base.html PASS
includes/toast_error.html PASS
includes/toast_info.html PASS
includes/toast_success.html PASS
includes/toast_warning.html PASS

/trackdays

File Result
experience-detail.html PASS
experiences.html PASS
trackday-detail.html PASS
trackday-list.html PASS
trackday-request.html PASS
tuition-detail.html PASS
tuition.html PASS
includes/increment_decrement.html PASS

/profiles

File Result
profile.html PASS

/home

File Result
about.html PASS
contact.html PASS
faqs.html PASS
index.html PASS
policies.html PASS
management.html PASS
error404.html PASS
newsletter.html PASS

/checkout

File Result
basket.html PASS
cancel.html PASS
error.html PASS
success.html PASS
history.html PASS

/cars

File Result
car-hire.html PASS



Main HTML Validation Screenshots

Base.html, Main-nav.html and Index.html

Base Template Validation

experience-detail.html

Experience Detail Validation

experiences.html

Experiences Validation

trackday-detail.html

Trackday Detail Validation

trackday-list.html

Trackday List Validation

trackday-request.html

Trackday Request Validation

tuition-detail.html

Tuition Detail Validation

tuition.html

Tuition Validation

profile.html

Profile Validation

about.html

About Validation

contact.html

Contact Validation

faqs.html

FAQS Validation

policies.html

Policies Validation

management.html

Management Validation

error404.html

Error 404 Validation

newsletter.html

Newsletter Validation

basket.html

Empty Basket Validation Full Basket Validation

history.html

Order History Validation

success.html

Checkout Success Validation

cancel.html

Cancel Checkout Validation

car-hire.html

Car Hire Page Validation



Current HTML Errors/Issues/Explanations:

  • Mostly just warnings for script tags having the type="text/javascript" attribute in them. This can be ignored.

CSS Validation

All CSS validation was done using https://jigsaw.w3.org/css-validator/

/static/css

File Result
base.css PASS

/trackdays/css

File Result
booking-detail.css PASS
exp_detail.css PASS
experiences.css PASS
trackday-request.css PASS
trackdays.css PASS
tuition.css PASS

/profiles/css

File Result
profiles.css PASS

/home/css

File Result
about.css PASS
contact.css PASS
index.css PASS
management.css PASS
newsletter.css PASS

/basket/css

File Result
basket.css PASS
history.css PASS

cars/css

File Result
cars.css PASS



CSS Validation Screenshots

base.css

Base CSS Validation

booking-detail.css

Booking Detail CSS Validation

exp_detail.css

Experience Detail CSS Validation

experiences.css

Experiences CSS Validation

trackday-request.css

Trackday Request CSS Validation

trackdays.css

Trackdays CSS Validation

tuition.css

Tuition CSS Validation

profiles.css

Profiles CSS Validation

about.css

About CSS Validation

contact.css

Contact CSS Validation

index.css

Index CSS Validation

management.css

Management CSS Validation

newsletter.css

Newsletter CSS Validation

basket.css

Basket CSS Validation

history.css

History CSS Validation

cars.css

Cars CSS Validation



Current CSS Errors/Issues/Explanations:

  • No issues at all to report.

JS Validation

I cross-referenced JS Validation using two different Validation services:

I did find this particularly useful as some files generated warnings on one validator (perhaps due to over-sensitivity) and passed with zero errors on another. I have included different screenshots to demonstrate this and show that the JS is valid and working.

profiles/js

File Result
profile.js PASS

home/js

File Result
base.js PASS



JS Validation Screenshots

profile.js

Profile Page JS

base.js

Base JS Base JS

increment-decrement js

Increment and Decrement JS

basket js

Basket JS

Management js

Management JS

Trackday Detail js

Trackday Detail JS

Bootstrap Toast js

Bootstrap Toast JS Bootstrao Toast JS

Extra JS in includes/toasts html files: Extra JS



Current JS Errors/Issues/Explanations:

  • As you can see from the screen shots, the same code on one js linter can be more sensitive towards things than others. I have included cases like this above for transparency and to prove I have tested across more than one JS linter.

Python Validation

All Python validation was checked through Code Institute's PEP8 Python Linter. You can find it via this link: https://pep8ci.herokuapp.com/

/django_raceway

File Result
settings.py PASS
urls.py PASS

/trackdays

File Result
admin.py PASS
models.py PASS
urls.py PASS
views.py PASS
tests.py PASS

/profiles

File Result
admin.py PASS
models.py PASS
urls.py PASS
views.py PASS
tests.py PASS

/home

File Result
admin.py PASS
models.py PASS
urls.py PASS
views.py PASS

/checkout

File Result
admin.py PASS
contexts.py PASS
models.py PASS
urls.py PASS
views.py PASS*
helpers.py PASS
tests.py PASS
  • Line 313 in views.py reads as too long, however, for reliability I have opted to leave this in as it can cause issues in deployment when concatenated as it is an image url. I believe this is a sensible and reasonable precaution to take for site reliability in conjunction with stripe. See further explanation below.

/cars

File Result
admin.py PASS
models.py PASS
urls.py PASS
views.py PASS
tests.py PASS



Python Validation Screenshots

/django_raceway

settings.py urls.py

/trackdays

admin.py models.py urls.py views.py

/home

admin.py models.py urls.py views.py

/profiles

admin.py models.py urls.py views.py

/checkout

admin.py models.py urls.py views.py views.py 2 contexts.py helpers.py

/cars

admin.py models.py urls.py views.py tests.py



Current Python Errors/Issues/Explanations:

  • Only 1 known python linting issue across the entire workspace, being that of line 313 in /checkout/views.py where a line is too long. Due to this being a url, and a pretty specific one from Stripe as well, I opted to follow best practice and to leave it as is for this one exception in order to ensure reliability of the checkout on the site. I believe reliability takes priority over anything else. I am very much following this Principal

Lighthouse Performance Testing

  • Lighthouse Testing was performed in an incognito tab to ensure no external chrome add-ons were affecting the test.
  • I did the test 3 times to see how consistent the tests were.
  • Results of the Lighthouse Performance testing below:

Test 1 Test 1 Test 2 Test 2 Test 3 Test 3

  • As you can see, there is quite a bit of variation in the test results. However, taking an average of the scores from the 3 tests, I am fairly happy with the performance of the site overall.

Device and Browser Testing

  • Browsers Tested:

    • Google Chrome
    • Safari
  • Devices Tested:

    • MacBook Pro
    • Apple iPhone 12 Pro
    • iPhone 14 Pro
    • iPhone X
    • iPad Pro

Responsiveness

  • The site has been tested down to screen widths of 320px and up to screen widths of 2560px
  • The site is fully responsive between these viewport widths

Current known and unresolved issues

  • As documented in the outstanding bugs section in the readme, there is an (as of writing) unresolved bug where when you sign in or log out, the sign in and log out buttons can appear to not be clickable. This is always able to be fixed by either refreshing the page or clicking on to another link/page. Alternatively, click on the site logo (which redirects to the home page anyway) to clear this bug. This may not happen to you at all or it may happen to you randomly.
  • My Trackday Constraint in my Trackday model appears to not work realiably. I have tried various combinations of the code, tried to reformat it countless times and tried to use it in conjunction with adding unique=True in the fields that are supposed to work with it. I have yet to resolve this issue and will aim to do so in a future update.
  • If you visit the site too often, you may find you need to hard refresh or clear the cache on some pages, especially the checkout page I find. This can be avoided entirely by using an incognito tab in your browser.

Return to Top