What Happens When You Don't Test in Safari
Liviu Lupei
Posted on February 15, 2022
I decided to write about a major bug I recently encountered in our platform.
In Endtest, there is a section where users can view the test execution logs:
It's a critical component, and that's where it occurred.
1. The Bug
We recently made a change to improve the timestamps.
In our database, we store all the timestamps in UTC time zone, in a basic format:
2022-02-10 07:31:15
And we wanted to display the timestamps in a more friendly way, while also converting them to the time zone of the user:
February 10, 2022, 14:31:15
This was being done in the frontend, with some vanilla JavaScript.
It worked great in Chrome, Edge and Firefox, but not in Safari:
2. The Fix
The issue was coming from this line:
unixTimestamp = new Date(the_timestamp).getTime() / 1000 - (diff*60);
As you can see, it's a really basic one, nothing fancy or risky.
Turns out Safari has an issue with spaces in timestamps, and the solution is to replace each space with a T, like this:
the_timestamp = the_timestamp.replace(' ', 'T');
3. The Lesson
No unit or Jest test could have captured this issue.
The only way to detect such an issue is to run functional tests in Safari.
This shows us that a browser is more than just a JavaScript interpreter.
And that cross-browser testing is more relevant than ever.
4. The rise of Safari
More and more folks are using Safari, they're loving the privacy-focused aspect of it.
Not testing on Safari means that you might be ignoring 20% of your users.
I'm also using it, but only on my phone. Chrome is still my desktop browser.
5. The Democratization of Automated Testing
We've always advocated for testing in multiple browsers, that's why Safari was always an option in our platform:
By providing browsers in the cloud, anyone can run tests on Safari, regardless of what operating system they're using.
And by proving a low-code interface, anyone can create automated tests in a few minutes, even without writing code.
The Test Automation space has always had its fair share of gatekeepers, and we're getting them out of the way.
6. What about you?
Are you running your functional tests in Safari?
What percentage of your users are on Safari?
Did you ever find bugs that occurred only in Safari?
Posted on February 15, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
October 15, 2024