You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The third test, which tests for the clearing of the cache seems to have an error with its logic or the comment.
it('test clearing the cache', () => {
// Crops should not be cached to start.
let crops = localStorage.getItem('crops')
expect(crops).to.not.equal(null)
// Wait here for the response to come, be cached and fill in the list.
cy.get('[data-cy=1crop]').should('have.text','ARUGULA')
.then(() => {
// Now crops should be in the cache.
crops = localStorage.getItem('crops')
expect(crops).to.not.equal(null)
})
// click the "Clear the Cache" button.
cy.get('[data-cy=clear-cache]').click()
// Now reload the page
cy.reload(true)
// Now crops should not be in the cache
crops = localStorage.getItem('crops')
expect(crops).to.not.equal(null)
// But once the response returns the crops should be cached again.
cy.get('[data-cy=1crop]').should('have.text','ARUGULA')
.then(() => {
crops = localStorage.getItem('crops')
expect(crops).to.not.equal(null)
})
})
The test checks if the clearCache button successfully clears the localStorage when it is clicked. When the page reloads after line 70, the localStorage should not contain any caches. However, line 74 checks if the crops are not equal to null (asserting that there should be cache inside localStorage), which is the opposite of what it should be testing. The cypress tests passed, meaning that the clearCache method in cache.html might be erroneous.
The text was updated successfully, but these errors were encountered:
JingyuMarcelLee
changed the title
Cache.spec.js Cypress test needs to be fixed
Cache.spec.js Cypress test flaws
Jun 28, 2022
The cypress test for the cache.html page in fd2_examples needs to be revised.
The third test, which tests for the clearing of the cache seems to have an error with its logic or the comment.
The test checks if the clearCache button successfully clears the localStorage when it is clicked. When the page reloads after line 70, the localStorage should not contain any caches. However, line 74 checks if the crops are not equal to null (asserting that there should be cache inside localStorage), which is the opposite of what it should be testing. The cypress tests passed, meaning that the clearCache method in cache.html might be erroneous.
The text was updated successfully, but these errors were encountered: