Cypress practice website
Every element on one page, each built well and built to break, with Cypress commands for each group. Switch to v2 and see which selectors survive.
Starter spec: sign in and check out (Cypress)
cypress/e2e/checkout.cy.js
describe('Kestrel Goods checkout', () => {
const cardBody = () =>
cy.get('iframe[title="Card details"]')
.its('0.contentDocument.body').should('not.be.empty').then(cy.wrap);
it('signs in and places an order', () => {
cy.visit('/practice/shop/sign-in');
cy.get('#email').type('[email protected]');
cy.get('#password').type('practice123');
cy.contains('button', 'Sign in').click();
cy.contains('h1', 'Order history');
cy.get('[data-testid="shop-search"]').type('Pocket');
cy.contains('[role="option"]', 'Pocket Speaker').click();
cy.get('[data-testid="add-to-cart"]').click();
cy.get('[data-testid="cart-link"]').click();
cy.get('[data-testid="checkout"]').click();
cy.get('#address').type('1 Main St');
cy.get('input[placeholder="City"]').type('Springfield');
cy.get('input[placeholder="Postcode"]').type('12345');
cardBody().find('[data-testid="card-number"]').type('4242 4242 4242 4242');
cardBody().find('[data-testid="card-expiry"]').type('12/30');
cardBody().find('[data-testid="card-cvc"]').type('123');
cy.get('[data-testid="place-order"]').click();
cy.get('[data-testid="row-KG-2101"]').should('be.visible');
});
});Shadow DOMMore Shadow DOM practice
Coupon fieldAn input and a button inside a shadow root.
Built well
Built to break
Two roots deepA button inside a root that sits inside another root.
Built well
Built to break
Date pickerThe same picker the admin product editor uses.
Built well
Built to break
Iframe inside a shadow rootCross the root, then switch into the frame.
Built well
Built to break
Design-system buttonThe label is slotted in from outside; the button lives in the root.
Built well
Built to break
Cypress code for this section
cy.get('[data-testid="coupon-widget"]').shadow()
.find('[data-testid="coupon-input"]').type('SAVE10');
cy.get('[data-testid="coupon-widget"]').shadow()
.find('[data-testid="coupon-apply"]').click();
// One .shadow() per host. Or set includeShadowDom: true in cypress.config.js
cy.get('[data-testid="wishlist-outer"]').shadow()
.find('[data-testid="wishlist-inner"]').shadow()
.find('[data-testid="wishlist-add"]').click();
// The slotted label is light DOM: no .shadow() needed
cy.get('[data-testid="ds-label"]').click();
cy.get('[data-testid="ds-button"]').shadow().find('[data-testid="ds-control"]').should('be.enabled');IframesMore Iframes practice
Card formUse the test card 4242 4242 4242 4242, any future expiry and any CVC.
Built well
Built to break
Nested framesA chat frame inside a help-center frame.
Built well
Built to break
Shadow root inside an iframeSwitch into the frame, then cross the root.
Built well
Built to break
Cypress code for this section
// Same-origin frames: wait for the body, then wrap it
const frameBody = (title) =>
cy.get(`iframe[title="${title}"]`)
.its('0.contentDocument.body').should('not.be.empty').then(cy.wrap);
frameBody('Card details').find('[data-testid="card-number"]').type('4242 4242 4242 4242');
frameBody('Card details').find('[data-testid="card-expiry"]').type('12/30');
frameBody('Card details').find('[data-testid="card-cvc"]').type('123');DropdownsMore Dropdowns practice
Native selectA real <select> element.
Built well
Built to break
Searchable comboboxType to filter, then pick a suggestion.
Built well
Built to break
Multi-selectChoose several options; remove them from the chips.
Built well
Built to break
Menu that closes when you inspect itIt closes when the page loses focus. In DevTools, turn on "Emulate a focused page" to inspect it.
Built well
Built to break
Cypress code for this section
cy.get('[data-testid="native-select"]').select('phones');
cy.get('[data-testid="combobox"]').type('cam');
cy.contains('[role="option"]', 'Cameras').click();
cy.get('[data-testid="multi-select"]').click();
cy.contains('[role="option"]', 'Audio').click()
.should('have.attr', 'aria-selected', 'true');Web tablesMore Web tables practice
Sortable, editable tableSort by any column. Edit a customer name with the pencil.
Built well
| ORD-1001 | Ada Park | Paid | $19.50 |
| ORD-1002 | Bo Chen | Refunded | $56.50 |
| ORD-1003 | Cal Diaz | Pending | $93.50 |
| ORD-1004 | Dee Evans | Shipped | $130.50 |
| ORD-1005 | Eli Fox | Paid | $167.50 |
| ORD-1006 | Fay Gold | Refunded | $204.50 |
| ORD-1007 | Gus Hale | Pending | $241.50 |
| ORD-1008 | Ivy Ito | Shipped | $278.50 |
| ORD-1009 | Jon Kerr | Paid | $315.50 |
| ORD-1010 | Kai Lund | Refunded | $352.50 |
| ORD-1011 | Lia Moss | Pending | $389.50 |
| ORD-1012 | Max Nori | Shipped | $26.50 |
Built to break
Virtualized table500 orders, but only the rows in view are in the DOM.
Built well
Built to break
Paginated tableFind INV-1010: it is not on the first page.
Built well
| Order | Customer | Status | Total |
|---|---|---|---|
| INV-1001 | Ada Park | Paid | $19.50 |
| INV-1002 | Bo Chen | Refunded | $56.50 |
| INV-1003 | Cal Diaz | Pending | $93.50 |
| INV-1004 | Dee Evans | Shipped | $130.50 |
Built to break
Table of duplicate valuesFind the run on Firefox in Austin. Most cells repeat.
Built well
| Run | OS | Browser | City | Country |
|---|---|---|---|---|
| DUP-1 | Windows | Chrome | Pune | India |
| DUP-2 | Windows | Firefox | Pune | India |
| DUP-3 | macOS | Chrome | Pune | India |
| DUP-4 | Windows | Chrome | Austin | USA |
| DUP-5 | Linux | Firefox | Pune | India |
| DUP-6 | Windows | Chrome | Pune | India |
| DUP-7 | macOS | Safari | Austin | USA |
| DUP-8 | Windows | Firefox | Austin | USA |
Built to break
Cypress code for this section
cy.get('[data-testid="row-ORD-1003"]').within(() => {
cy.get('button[aria-label="Edit customer for ORD-1003"]').click();
cy.get('input[aria-label="Customer for ORD-1003"]').clear().type('Zed Young');
cy.contains('button', 'Save').click();
});
cy.get('[data-testid="row-ORD-1003"]').should('contain', 'Zed Young');
cy.contains('th button', 'Total').click();
cy.contains('th', 'Total').should('have.attr', 'aria-sort', 'ascending');
cy.get('[data-testid="virtual-table"]').scrollTo(0, 40 * 300);
cy.get('[data-testid="vrow-ORD-1301"]').should('be.visible');XPathMore XPath practice
Value in a table rowGet the total for Bo Chen, wherever the row sits.
Built well
| Customer | Status | Total |
|---|---|---|
| Ada Park | Paid | $149.00 |
| Bo Chen | Shipped | $56.00 |
| Cal Diaz | Refunded | $899.00 |
| Dee Evans | Paid | $249.00 |
Built to break
Id that changes every build
Built well
Built to break
Text with stray spaces
Built well
Built to break
Repeated Edit linksEdit Bo Chen, not "the second one".
Built well
- Ada Park
- Bo Chen
- Cal Diaz
Built to break
- Ada ParkEdit
- Bo ChenEdit
- Cal DiazEdit
Inputs that differ by one attribute
Built well
Built to break
Text in other scriptsHindi, Chinese and accents are fine; a non-breaking space or curly quotes are not.
Built well
Built to break
Cypress code for this section
// XPath in Cypress needs the cypress-xpath plugin (npm i -D cypress-xpath)
cy.xpath('//table[@data-testid="xp-table"]//tr[td[normalize-space()="Bo Chen"]]/td[3]')
.should('contain', '$');
cy.xpath('//input[starts-with(@id, "search-")]').type('headphones');
cy.xpath('//div[span][normalize-space()="Save draft"]').click();
cy.xpath('//label[normalize-space()="Text me"]/input[@name="notify" and @value="sms"]').check();Form controlsMore Form controls practice
Input with validationType something that is not an email, then leave the field.
Built well
Built to break
Radio buttons
Built well
Built to break
Checkbox
Built well
Built to break
File uploadThe fragile one hides its real input.
Built well
Built to break
Slider and date
Built well
Built to break
Cypress code for this section
cy.get('[data-testid="work-email"]').type('not-an-email').blur();
cy.get('[data-testid="work-email"]').should('have.attr', 'aria-invalid', 'true');
cy.get('[data-testid="plan-group"]').contains('label', 'Pro').find('input').check();
cy.get('[data-testid="newsletter"]').check();
cy.get('[data-testid="file-upload"]').selectFile('cypress/fixtures/shoe.png');
cy.get('[data-testid="date-field"]').type('2026-12-24');
// React ignores a plain value change on a range input; use the native setter
cy.get('[data-testid="slider"]').then(($el) => {
const set = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value').set;
set.call($el[0], 70);
$el[0].dispatchEvent(new Event('input', { bubbles: true }));
});Alerts and modalsMore Alerts and modals practice
Modal dialog
Built well
Built to break
ToastGone after three seconds.
Built well
Built to break
TooltipHover the icon.
Built well
Built to break
Browser alert, confirm and promptNative dialogs have no DOM.
Built well
Built to break
Cypress code for this section
cy.get('[data-testid="open-dialog"]').click();
cy.get('[role="dialog"]').contains('button', 'Cancel').click();
cy.get('[role="dialog"]').should('not.exist');
cy.get('[data-testid="save-changes"]').click();
cy.get('[data-testid="toast"]').should('have.text', 'Changes saved');
cy.get('button[aria-label="Shipping info"]').trigger('mouseover');
cy.get('[role="tooltip"]').should('have.text', 'Ships in 2 business days');
cy.on('window:confirm', () => true); // Cypress accepts by default; return false to cancel
cy.get('[data-testid="confirm-button"]').click();
cy.get('[data-testid="dialog-result"]').should('have.text', 'Confirmed');Mouse hoverMore Mouse hover practice
Nested hover menuAccount → Security → Two-factor.
Built well
Built to break
Right-click menu
Built well
Built to break
Cypress code for this section
cy.get('[data-testid="hover-menu"]').contains('[role="menuitem"]', 'Account').trigger('mouseover');
cy.contains('[role="menuitem"]', 'Security').trigger('mouseover');
cy.contains('[role="menuitem"]', 'Two-factor').click();
cy.get('[data-testid="menu-result"]').should('have.text', 'Selected: Two-factor');
cy.get('[data-testid="context-area"]').rightclick();
cy.get('[role="menu"][aria-label="Row actions"]').contains('Delete').click();
cy.get('[data-testid="context-result"]').should('have.text', 'Chose: Delete');Drag and dropMore Drag and drop practice
Drag to reorderDrag a row onto another. The good list also has move buttons.
Built well
Built to break
TabsThe fragile tabs change order on v2.
Built well
Built to break
Accordion
Built well
Built to break
Cypress code for this section
// Native drag and drop: dispatch the events with one shared DataTransfer
const dataTransfer = new DataTransfer();
cy.get('[data-testid="drag-gift-guide"]').trigger('dragstart', { dataTransfer });
cy.get('[data-testid="drag-summer-sale"]').trigger('drop', { dataTransfer });
cy.contains('[role="tab"]', 'Specs').click();
cy.get('[role="tabpanel"]').should('contain', '200 gsm');
cy.contains('button', 'Returns').click();
cy.get('[role="region"][aria-label="Returns"]').should('be.visible');WaitsMore Waits practice
Content that arrives lateTwo seconds after the page loads, or after Reload.
Built well
Built to break
Spinner
Built well
Built to break
Stacked toastsEach hides after 3 seconds. Two can show at once.
Built well
Built to break
List that loads as you scroll
Built well
- Product 1
- Product 2
- Product 3
- Product 4
- Product 5
- Product 6
- Product 7
- Product 8
- Product 9
- Product 10
Built to break
Cypress code for this section
cy.get('[data-testid="delayed-content"]', { timeout: 6000 })
.should('have.attr', 'aria-busy', 'false')
.and('contain', 'Aero Headphones');
cy.get('[data-testid="load-orders"]').click();
cy.get('[role="progressbar"][aria-label="Loading orders"]').should('not.exist');
cy.get('[data-testid="orders-result"]').should('have.text', '3 orders found.');
cy.contains('button', 'Load more').click();
cy.get('[data-testid="lazy-item-20"]').should('be.visible');
cy.contains('button', 'Both at once').click();
cy.get('[data-testid="toast-shipped"]').should('have.text', 'Order KG-2101 shipped.');
cy.get('[data-testid="toast-shipped"]').should('not.exist');Windows and tabsMore Windows and tabs practice
New tab
Built well
Open product in new tabBuilt to break
OpenPop-up windowType a reply in the pop-up and send it back.
Built well
Built to break
Cypress code for this section
// Cypress drives one tab: check the link, then open it in the same tab
cy.get('[data-testid="new-tab-link"]')
.should('have.attr', 'target', '_blank')
.invoke('removeAttr', 'target').click();
cy.location('pathname').should('eq', '/practice/shop/product');
cy.go('back');
// Pop-ups: stub window.open and check what it was asked to open
cy.window().then((win) => cy.stub(win, 'open').as('open'));
cy.get('[data-testid="popup-button"]').click();
cy.get('@open').should('be.calledWithMatch', '/practice/popup');SVG and canvasMore SVG and canvas practice
SVG icon button
Built well
Built to break
SVG bar chartClick Wednesday’s bar.
Built well
Built to break
CanvasClick the green tile.
Built well
Built to break
SVG inside a shadow root
Built well
Built to break
Cypress code for this section
cy.get('button[aria-label="Delete item"]').click();
cy.get('[data-testid="svg-delete-result"]').should('have.text', 'Deleted');
// CSS reaches SVG elements without any namespace tricks
cy.get('[data-testid="bar-wed"]').click();
cy.get('[data-testid="chart-result"]').should('have.text', 'Wed: 7 orders');
// Canvas: click at x, y inside the element
cy.get('[data-testid="tiles-canvas"]').click(110, 40);
cy.get('[data-testid="canvas-result"]').should('have.text', 'Green tile');Hidden elementsMore Hidden elements practice
Hidden until you open it
Built well
Built to break
Covered by a bannerClick Subscribe, then accept the cookies first.
Built well
Built to break
Disabled until enabled
Built well
Built to break
Invisible real inputThe checkbox you see is a span; the real one is invisible.
Built well
Built to break
Text drawn by CSS
Built well
Built to break
Cypress code for this section
cy.get('[data-testid="edit-nickname"]').click();
cy.get('[data-testid="nickname"]').type('Sam');
cy.get('[role="dialog"][aria-label="Cookie consent"]').contains('button', 'Accept cookies').click();
cy.get('[data-testid="subscribe"]').click();
cy.get('[data-testid="enable-editing"]').click();
cy.get('[data-testid="company-name"]').should('be.enabled').type('Kestrel');
// The real input is invisible; check() needs force here
cy.get('[data-testid="email-alerts"]').check({ force: true });
cy.get('.pr-pseudo-sale').then(($el) => {
const content = $el[0].ownerDocument.defaultView.getComputedStyle($el[0], '::before').content;
expect(content).to.eq('"Sale"');
});Broken linksMore Broken links practice
Find the broken linksTwo of these five links answer 404.
Built to break
Link padded with spaces
Built well
Built to break
File download
Built well
Built to break
Cypress code for this section
cy.get('[data-testid="link-list"] a').each(($a) => {
cy.request({ url: $a.prop('href'), failOnStatusCode: false })
.its('status').then((status) => cy.log(`${status} ${$a.prop('href')}`));
});
cy.get('a[aria-label="Open cart"]').should('have.attr', 'href', '/practice/shop/cart');
cy.contains('a', 'Track my order').should('be.visible');
cy.get('[data-testid="download-orders"]').should('have.attr', 'download');Virtualized listsMore Virtualized lists practice
1,000-row virtualized listScroll to ORD-742 (Rosa Quinn). Rows outside the view are removed, not hidden.
Built well
Built to break
Cypress code for this section
function scrollTo(customer) {
cy.get('[data-testid="order-list"]').then(($list) => {
if ($list.find(`[data-customer="${customer}"]`).length) return;
$list[0].scrollBy(0, $list[0].clientHeight);
scrollTo(customer);
});
}
scrollTo('Rosa Quinn');
cy.get('[data-customer="Rosa Quinn"]').should('contain', 'ORD-742');Generated idsMore Generated ids practice
Profile formSame form twice. Switch to v2 and watch the ids on the right change.
Built well
Built to break
Cypress code for this section
cy.get('[data-testid="gen-name"]').type('Ada Park');
cy.get('[data-testid="gen-email"]').type('[email protected]');
cy.get('[data-testid="gen-save"]').click();
cy.get('[data-testid="gen-result"]').should('have.text', 'Profile saved.');
// Breaks on the next build: cy.get('#billing-email-48213')Localized textMore Localized text practice
Checkout in two languagesUse the Language switch above. The same build serves both.
Built well
Checkout
Total: $149.00
Built to break
Checkout
Total: $149.00
Cypress code for this section
['en', 'de'].forEach((lang) => {
cy.visit(`/practice/localized-text?lang=${lang}`);
cy.get('[data-testid="l10n-email"]').type('[email protected]');
cy.get('[data-testid="l10n-place-order"]').click();
cy.get('[data-testid="l10n-result"]').should('not.be.empty');
});
// English only: cy.contains('button', 'Place order')A/B variantsMore A/B variants practice
Newsletter sign-up, A/B testedv1 shows variant A, v2 variant B.
Built well
Built to break
Cypress code for this section
cy.get('[data-testid="ab-signup"]').within(() => {
cy.get('[data-testid="ab-email"]').type('[email protected]');
cy.get('[data-testid="ab-subscribe"]').click();
});
cy.get('[data-testid="ab-result"]').should('have.text', 'You are on the list.');