Path: blob/main/cypress/integration/binary-demo.spec.js
3855 views
/// <reference types="cypress" />12describe('Binary demo', () => {3it('Should render on page', () => {4const binaryDemo = '.binary-demo'56cy.visit('/course/introduction/the-atoms-of-computation')7cy.url().should('include', 'introduction/the-atoms-of-computation')89cy.get(binaryDemo).scrollIntoView().should('be.visible')10})1112it('Should render all Binary demo tiles', () => {13const binaryDemoTiles = '.binary-tile'14const expectedTileCount = 61516cy.get(binaryDemoTiles).should('have.length', expectedTileCount)17})1819it('Should render Decimal total', () => {20const decimalTotal = '[data-test="binary-demo-total"] .binary-demo__block'21const expectedDecimalTotal = 252223cy.get(decimalTotal).should('be.visible')24cy.get(decimalTotal).should('have.text', expectedDecimalTotal)25})2627it('Should update Decimal total', () => {28const binaryDemo = '.binary'29const binaryDemoBtns = '.binary-tile'30const decimalTotal = '[data-test="binary-demo-total"] .binary-demo__block'31const initialTotal = 2532const updatedTotalEl = '[data-test="binary-demo-total"] .binary-demo__block'33const expectedUpdatedTotal = 573435cy.visit('/course/introduction/the-atoms-of-computation')36cy.url().should('include', 'introduction/the-atoms-of-computation')3738cy.get(binaryDemo).scrollIntoView()39cy.get(decimalTotal).should('have.text', initialTotal)40cy.get(binaryDemoBtns).first().click() // add 3241cy.get(updatedTotalEl).should('have.text', expectedUpdatedTotal)42cy.get(binaryDemoBtns).first().click() // remove 3243cy.get(updatedTotalEl).should('have.text', initialTotal)44})45})464748