Complete the code to visit the slot machine page before each test.
beforeEach(() => {
cy.[1]('http://localhost:3000/slot-machine')
})The cy.visit() command loads a page URL in Cypress before each test.
Complete the code to check if the slot machine's spin button is visible.
cy.get('#spin-button').[1]('be.visible')
The should('be.visible') assertion checks if the element is visible on the page.
Fix the error in the code to correctly simulate clicking the spin button.
cy.get('#spin-button').[1]()
The click() command simulates a user clicking the button.
Fill both blanks to check that the slot machine result contains exactly 3 symbols.
cy.get('.slot-result').[1]().should('have.length', [2])
children() gets the child elements, and should('have.length', 3) asserts there are exactly 3 symbols.
Fill all three blanks to assert the slot machine displays a winning message after spinning.
cy.get('#spin-button').click() cy.get('.message').[1]('text').should('contain', [2]) cy.get('.message').should('have.class', [3])
invoke('text') gets the text content, should('contain', 'You win!') checks the message, and should('have.class', 'win-message') verifies the CSS class for winning.