Socialify

Folder ..

Viewing smoke.cy.ts
26 lines (24 loc) • 756.0 B

 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
describe('Smoke Test', () => {
  beforeEach(() => {
    cy.visit('/guide/');
    cy.get('a[href="/api/animal.html"]').as('firstSectionLink');
  });

  it('compiles the guide page', () => {
    cy.contains('Getting Started');
  });

  it('renders this last code example in the code', () => {
    // Click on any section in the sidebar
    cy.get('@firstSectionLink')
      .click()
      // Make sure the number of code examples is the same between reloads
      .get('.container pre code')
      .then(($codeBlocks) => {
        // Trigger a reload
        cy.reload()
          // Give the runtime a chance to update/fail
          .wait(500)
          .get('.container pre code')
          .should('have.length', $codeBlocks.length);
      });
  });
});