/* eslint-disable */
import { login, logout } from '../services/authentication';
describe('data search module', () => {
  
  before(() => {
    login();
  });

  after(() => {
    logout();
  });

  // not working anymore because of back-end
  describe.skip('user should be to type and see suggestions', () => {
    it('should open the autocomplete panel and select the first dataset option and route the correct address', () => {
      cy.visit('http://localhost:8080/');
      cy.get('input.js-search-input').trigger('focus');
      cy.get('input.js-search-input').type('Park');
      cy.get('input.js-search-input').trigger('change');
      cy.get('.c-autocomplete').should('exist').and('be.visible');
      cy.get('h4').contains('Straatnamen').siblings('ul').children('li').first().children().first()
      .then(($el) => {
        const firstValue = $el[0].innerText;
        cy.get('h4').contains('Straatnamen').siblings('ul').children('li').first().click();
        cy.get('.o-header__title').contains(firstValue).should('exist').and('be.visible');
      });
    });
  });

  describe('user should be to type and submit', () => {
    beforeEach(() => {
      cy.server()
      cy.route('https://acc.api.data.amsterdam.nl/catalogus/api/3/action/*').as('getResults')
      cy.visit('http://localhost:8080');
      cy.get('input.js-search-input').trigger('focus');
    });

    it('should submit the search and give results', () => {
      cy.get('input.js-search-input').type('Park');
      cy.get('.c-search-form').submit();
      cy.wait('@getResults');
      cy.get('.o-list').should('exist').and('be.visible')
    });

    it('should submit the search and give no results', () => {
      cy.get('input.js-search-input').type('NORESULTS');
      cy.get('.c-search-form').submit();
      cy.wait('@getResults');
      cy.get('.o-list').should('have.length', 0);
    });
  });
});

@@ -117,11 +117,8 @@
 %3E %7B%0A
-  %0A
   be

Remove whitespace to trigger build