UNCLASSIFIED - NO CUI

Skip to content
Snippets Groups Projects
search.js 1.07 KiB
Newer Older
graham.smith's avatar
graham.smith committed
describe("Testing Search", () => {
  before(() => {
    cy.viewport(1024, 768);
    cy.visit("/");
  });

  it("should expand search bar", () => {
    cy.get('[data-cy="search"]').should("exist").focus();
    // check expand state hides the nav
    cy.get('[data-cy="nav-logo"]').should("not.be.visible");
  });
  it("should show empty search results", () => {
    cy.get('[data-cy="search"]').should("exist").focus();
    cy.get('[data-cy="search"]').type("dummytokenthatshouldnotmatchanyresults");
    cy.get('[data-cy="emptySearchResults"]')
      .should("exist")
      .should("contain", "No search results found");
    cy.get('[data-cy="searchResults"]').should("not.exist");
    cy.get('[data-cy="search"]').get(".mdi-close").click();
  });
  it("should show search results", () => {
    cy.get('[data-cy="search"]').should("exist").focus();
    cy.get('[data-cy="search"]').type("platform");
    cy.get('[data-cy="emptySearchResults"]').should("not.exist");
    cy.get('[data-cy="searchResults"]').should("exist");
    cy.get('[data-cy="search"]').get(".mdi-close").click();
  });
});