You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the Puppeteer tests we run against JavaScript functionality use two different coding styles when evaluating the page's content.
One of them is page.evaluate, which looks similar to this:
it('renders the button thing',async()=>{awaitrender(page,'component',examples.default)constbuttonThingType=awaitpage.evaluate(()=>document.body.querySelectorAll('.button-thing').type)expect(buttonThingType).toBe('button')})
We also use page.$eval in many places:
it('renders the button thing',async()=>{awaitrender(page,'component',examples.default)constbuttonThingType=awaitpage.$eval('.button-thing',(el)=>el.type)expect(buttonThingType).toBe('button')})
Consequentially, we have a mixture of the two styles floating around, with different components favouring one style over the other. Many components have both styles within the same test suites.
There are 87 instances of components using page.evaluate. The components using it the most include:
Accordion
Button
Checkboxes
Radios
Tabs
There are 126 instances of components using page.$eval. The components using it the most include:
Character Count
Exit This Page
Header
Password Input
Skip Link
These components use a fairly even split of both styles:
Error Summary
Notification Banner
Consequences
This is inconsistent, and inconsistency sucks when it comes to code reuse, onboarding new team members and contributors, and general code neatness.
As the page.$eval style seems to have been used more recently, I assume this is the style that we would favour should we rewrite the older tests.
Impact of debt
Low
Reason (impact of debt)
The older style tests still work and will probably work for the indefinite future.
This tech debt only affects the internals of the team, and does not affect our users outside of potential contributors.
Effort to pay down
Medium
Reason (effort to pay down)
Quite a lot of tests would need to be rewritten, although the differences aren't too significant. Mostly it requires an investment of time, rather than hard think-y effort.
Overall rating
Low
Reason (overall rating)
There's no immediate need or benefit to doing this outside of maintaining glorious consistency.
The text was updated successfully, but these errors were encountered:
Cause
Currently, the Puppeteer tests we run against JavaScript functionality use two different coding styles when evaluating the page's content.
One of them is
page.evaluate
, which looks similar to this:We also use
page.$eval
in many places:Consequentially, we have a mixture of the two styles floating around, with different components favouring one style over the other. Many components have both styles within the same test suites.
There are 87 instances of components using
page.evaluate
. The components using it the most include:There are 126 instances of components using
page.$eval
. The components using it the most include:These components use a fairly even split of both styles:
Consequences
This is inconsistent, and inconsistency sucks when it comes to code reuse, onboarding new team members and contributors, and general code neatness.
As the
page.$eval
style seems to have been used more recently, I assume this is the style that we would favour should we rewrite the older tests.Impact of debt
Low
Reason (impact of debt)
The older style tests still work and will probably work for the indefinite future.
This tech debt only affects the internals of the team, and does not affect our users outside of potential contributors.
Effort to pay down
Medium
Reason (effort to pay down)
Quite a lot of tests would need to be rewritten, although the differences aren't too significant. Mostly it requires an investment of time, rather than hard think-y effort.
Overall rating
Low
Reason (overall rating)
There's no immediate need or benefit to doing this outside of maintaining glorious consistency.
The text was updated successfully, but these errors were encountered: