Cypress Tips September 2024
Conferences, free workshops, branded types, Microsoft Playwright dashboard 📰
Cypress vs Playwright Online Workshop
I will be teaching a full-day “Cypress vs Playwright” workshop at HUSTEF 2024 in October. This workshop covers the material from my “Cypress vs Playwright” online course. I will do a practice run over two days next week to ensure the workshop runs smoothly.
Thursday, Sept 26th, 10 AM-1 PM EST (Easter time zone)
Friday, Sept 27th, 10 AM-1 PM EST (Easter time zone)
If you want to attend the online workshop, book it now. Tip: my online “Cy vs Pw” course subscribers receive 90% workshop discount!
Conferences
The same announcements as last month, but now there is a discount code for HUSTEF 2024 conference!
SquiggleConf Boston, MA
On October 3,4 I am attending a conference about developer tooling! If you want to join me, here is a $50 discount coupon “GlebBFriend” The conference will be held at New England Aquarium which is exciting. I will be listening and learning.
Hungarian Test Conference, Budapest
I will be at https://hustef.hu/ from October 8 to 10 in Budapest, Hungary. See me talk about my cypress-split plugin in the presentation "Fast E2E Testing Using Cypress For Free." I will also teach a workshop on both Cypress and Playwright test runners. Through a series of hands-on exercises, you will learn how to write tests using both test runners. You can get 50% discount (limited number) by using the code “SpeakerCode“ when signing up at ti.to/hustef/hustef2024
Maine JS, Portland, ME
My friends from the Maine JS meetup have invited me to come to Portland again to give the presentation “Writing Tests Using GitHub Copilot”. It will happen on December 10h, see the meetup page here. Free.
ConFoo 2025, Montreal, Canada
I applied to speak at the ConFoo conference. Please vote for my proposals.
Blog posts and videos
Refactor Cypress Network Tests 📝 shows an example of improving Cypress tests that spy/stub a network call
Skip Dependent Cypress Tests On Failure 📝 shows my tiny plugin cypress-skip-this-test
Return A Fake Window Object 📝 shows how to return a stub window object to the application call in response to
window.open
Parse Email Url 📝 uses browser APIs to parse
mailto:…
URL that the application visits to send an email on the user’s behalfRetry Network Requests 📝 refactors the testing code using cypress-recurse and cy-spok plugins
Do you have a Cypress question? And you cannot find an answer at cypress.tips/search? Send it my way, if it makes sense I will answer it in a blog post or a video.
WICK-A11Y plugin with voice support
Sebastian Clavijo Suero has been doing wizard-level stuff with his Cypress plugins. The new version of his Cypress a11y plugin supports voice commands 😱
I need to record a video showing this amazing plugin in action. If only the Cypress team realized that 3rd-party plugins are awesome and provided better support for plugins’ user interfaces.
Branded types for testing
Have you ever tried to distinguish cents from dollars in your tests? If you are using TypeScript, the compiler is no help because both types are just numbers.
type cents = number
function formatPrice(price: cents) { ... }
// Ooops, passed dollars accidentally
const txt = formatPrice(7.99)
The solution is to use branded types, a sort of “number + private field” combination that works everywhere a number is used, but a number cannot be implicitly cast into it.
type cents = number & { __brandType: 'cents' }
function formatPrice(price: cents) { ... }
// cannot pass a number, TS complains
const txt = formatPrice(7.99)
// can pass a number if it is explicitly declared as "cents"
const txt = formatPrice(799 as cents)
I have created a new bonus lesson in my “Swag Store” course showing the simple branded type in action. Check it out this week, I will make the lesson private to the course subscribers on September 28th.
Microsoft Playwright dashboard
Microsoft has announced a managed testing solution where they run your Playwright tests in parallel using Azure cloud instances and then give you the testing portal access with the test runs, reports, test replays, etc.
Pricing
According to the Microsoft calculator the pricing depends on the number of tests times the number of runs per month. It seems that a suite with 100 tests executing 100 times per month means 10,000 test results. Microsoft cloud browser instances would cost $135; a hundred for the test execution plus $35 for the recordings.
Let’s only focus on the reporting part. Microsoft reporting is about half the price compared to the Cypress Cloud pricing The “Team Plan" has 10,000 test recordings for $67, while MS reporting is $35.
I would not want to be in the next board meeting. Of course, you might say “MS offers only managed testing solutions, not the same as running tests yourself and just sending the test artifacts to the reporting service”. Fair. Remember: MS will do what is good for MS. If they decide that bundling running and reporting tests is the way to go, then maybe Cypress-the-company can squeak by providing their reporting only.