Fine on my laptop
A student builds a bus times page. On the laptop it looks great.
Then a friend opens it on a phone. The text is tiny. One box is cut off. The page takes ten seconds to load.
The code was correct. The page still failed its users. Front-end testing finds this.
Key words
| Word | What it means | Example |
|---|---|---|
| Front-end | The part of a product the user sees and touches. | A web page |
| Browser | The program that opens web pages. | Chrome, Firefox, Safari |
| Rendering | How the browser draws the page on the screen. | Fonts, colours, layout |
| Responsive | Changing to fit the size of the screen. | One column on a phone |
| Loading time | How long the page takes to appear. | 3 seconds |
| Script | Code that runs inside the page. | JavaScript for a button that adds to a basket |
| Operating system | The main software on a device. | Windows, macOS, Android, iOS |
| Cross-browser | Working the same in more than one browser. | Same page in Chrome and Safari |
| KB (kilobyte) | A unit for the size of a file. | A small picture is about 50 KB |
| Media query | A CSS rule that works only on some screen sizes. | @media (max-width: 500px) |
The cells students fill in are left blank in this preview.
Front-end testing makes seven checks
| Check | The question | A way to test it |
|---|---|---|
| Script performance and functionality | Do the buttons and forms work? Are they fast? | Click everything. Watch the browser console for errors |
| Browser compatibility | Does it work in each browser we support? | Open it in Chrome, Firefox, Safari and Edge |
| Operating system compatibility | Does it work on each system? | Try Windows, macOS, Android and iOS |
| Cross-browser performance | Is it equally fast in every browser? | Time the same action in each browser |
| Formatting and rendering | Does it look right? | Check fonts, colours, images and spacing |
| Loading times | Does it appear quickly? | Use the browser developer tools to time it |
| Responsiveness | Does it fit every screen size? | Resize the window. Use the device mode in developer tools |
The cells students fill in are left blank in this preview.
Match each symptom to its check
Have a go
Loading…
Your answers are marked here and are not kept. A college account keeps every student’s marks.
A responsive page fits every screen
People use phones, tablets and big screens. A responsive page changes to fit.
To test it, make the window narrow and look. In the browser, press F12 for the developer tools. Then use the device mode to see a phone size.
Try it: narrow the window
<h1>Bus times</h1>
<div class="box">Route 42</div>
<div class="box">Route 5A</div>
Make a free account to save your work and track your progress.
A page that looks fine can be broken
Tip
Many people think a page that looks right also works. A page can look fine and still have a broken script. Press F12 and open the Console tab. A red message there is a script error. Test every button, then check the console.
Fix the page for a phone
This bus times page is fixed at 900 pixels wide. On a phone you must scroll sideways. 1. Change the CSS so the three boxes fit any screen. Use a width in % (percent, such as 30%) or a media query. 2. Make the window narrow to test it. On a phone size, the boxes should sit one under another or fit side by side. 3. Ask your teacher to look at your page.
<h1>Bus times</h1>
<div class="row">
<div class="box">Route 42</div>
<div class="box">Route 5A</div>
<div class="box">Route 17</div>
</div>
<p>Next bus in 4 minutes.</p>
Make a free account to save your work, or press Start lab to work through the whole lesson.
Loading time is size divided by speed
A page is made of files: text, pictures and scripts. A big picture can slow the whole page.
You can work out the time. Time in seconds is the size divided by the speed. Sizes here are in KB.
Worked example: loading time
| Step | What we do | Number |
|---|---|---|
| 1 | Find the page size | 2000 KB |
| 2 | Find the phone download speed | 500 KB every second |
| 3 | Divide the size by the speed: 2000 divided by 500 | 4 seconds |
| 4 | Our limit is 3 seconds, so the page is | Too slow |
The cells students fill in are left blank in this preview.
Smaller pictures load faster
Tip
The biggest file is often a picture. Make the picture file smaller and the page loads much faster.
Your turn: loading time
A page loads files of different sizes. Fill in three functions. loading_time divides the size by the speed. too_slow says if the time is over the limit. heaviest_file gives the name of the biggest file in a dictionary. Press Run Tests.
# A web page is made of files. Every size is in kilobytes (KB).
# Speed is how many KB a phone can download in one second.
def loading_time(size_kb, speed_kb_per_second):
# Seconds to download = size divided by speed.
return 0
def too_slow(size_kb, speed_kb_per_second, limit_seconds):
# True if the page takes longer than the limit.
return False
def heaviest_file(files):
# files is a dictionary: name -> size in KB. Give back the name of the biggest file.
return ""
Make a free account to save your work, or press Start lab to work through the whole lesson.
Key words crossword
Have a go
Loading…
Your answers are marked here and are not kept. A college account keeps every student’s marks.
Final check
Have a go