describe('Spider application', () => {
before(() => {
cy.visit('/');
});
it('should center the spider by left border', () => {
cy.get('.spider').then(($spider) => {
cy.get('.wall').then(($wall) => {
const spider = $spider.get(0);
const wall = $wall.get(0);
const spiderLeft = spider.getBoundingClientRect().left;
const spiderLeftAbs = (wall.clientWidth / 2) + (wall.offsetLeft + 10)
- (spider.width / 2);
expect(spiderLeft).to.equal(spiderLeftAbs);
});
});
});
}):
Hello! My test should check the position of the element 'spider'. But without cy.wait(1000) it always fails, as the time of transition is 1s. How to wait for the end of the spider's transition and only after check the actual position?