Complete the code to read a file named 'example.txt' using Cypress.
cy.[1]('example.txt').then((content) => { expect(content).to.exist })
The readFile command reads the contents of a file in Cypress.
Complete the code to assert that the file content includes the word 'Hello'.
cy.readFile('example.txt').then((content) => { expect(content).to.[1]('Hello') })
The include assertion checks if the string contains the given substring.
Fix the error in the code to correctly read a JSON file and assert a property value.
cy.readFile('data.json').then((data) => { expect(data.[1]).to.equal('John') })
The JSON file has a property named name (all lowercase), so we access it as data.name.
Fill both blanks to read a file and assert its length is greater than 10.
cy.readFile('log.txt').then((content) => { expect(content.[1]).to.[2](10) })
The length property gives the string length, and be.greaterThan asserts it is more than 10.
Fill all three blanks to read a JSON file, filter users older than 18, and assert the count.
cy.readFile('users.json').then((users) => { const adults = users.filter(user => user.[1] [2] 18) expect(adults.[3]).to.equal(3) })
We filter by the age property, use the greater than operator >, and check the length of the filtered array.