blob: df792eba5b2080d760b1e4b5b55c2a0d0bf7a447 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
describe('example-refresh', () => {
it('should refresh the example', () => {
// given
cy.visit('/api/faker.html#constructor');
cy.get('.refresh').first().as('refresh');
cy.get('@refresh').next().find('code').as('codeBlock');
cy.get('@codeBlock').then(($el) => {
const originalCodeText = $el.text();
cy.get('@refresh')
.click()
.should('not.be.disabled') // stays disabled on error
.then(() => {
cy.get('@codeBlock').then(($el) => {
const newCodeText = $el.text();
expect(newCodeText).not.to.equal(originalCodeText);
cy.get('@refresh')
.click()
.should('not.be.disabled') // stays disabled on error
.then(() => {
cy.get('@codeBlock').then(($el) => {
const newCodeText2 = $el.text();
expect(newCodeText2).not.to.equal(originalCodeText);
expect(newCodeText2).not.to.equal(newCodeText);
});
});
});
});
});
});
});
|