E2E & Performance Testing — Series 3

Preview — 3 of 10 questions

Which locator survives a CSS refactor and a copy tweak best?

javascript
page.locator('.btn.btn--primary.mt-4')        // A
page.getByRole('button', { name: 'Sign in' }) // B
page.locator('div > form > button:nth-child(3)') // C
page.locator('text=Sign in')                  // D
AA
BB
CC
DD

A suite has grown 40 tests that each perform login, then navigate. What is the useful split?

ACopy the login steps into each test so every test is self-contained.
BPut every assertion inside the page object so tests are one line each.
CMove login into a global beforeAll so it runs once for the whole run.
DPage objects encapsulate how to interact with a screen (locators and actions); setup like authenticating and seeding belongs in a fixture that provides an already-signed-in context — and assertions stay in the tests.

Which metric captures how quickly the page responds to user interactions across the whole visit?

AINP — Interaction to Next Paint
BLCP — Largest Contentful Paint
CCLS — Cumulative Layout Shift
DTTFB — Time to First Byte

Sign up free to play

Answer all 10 questions (7 more), see explanations for every answer, and track your score.