diff --git a/cypress/integration/home.spec.js b/cypress/integration/home.spec.js --- a/cypress/integration/home.spec.js +++ b/cypress/integration/home.spec.js @@ -10,6 +10,17 @@ const url = '/'; describe('Home Page Tests', function() { + + it('should have focus on search form after page load', function() { + cy.visit(url); + + cy.get('#swh-origins-url-patterns') + .should('have.attr', 'autofocus'); + // for some reason, autofocus is not honored when running cypress tests + // while it is in non controlled browsers + // .should('have.focus'); + }); + it('should display positive stats for each category', function() { cy.server(); diff --git a/cypress/integration/origin-search.spec.js b/cypress/integration/origin-search.spec.js --- a/cypress/integration/origin-search.spec.js +++ b/cypress/integration/origin-search.spec.js @@ -51,6 +51,14 @@ cy.visit(url); }); + it('should have focus on search form after page load', function() { + cy.get('#swh-origins-url-patterns') + .should('have.attr', 'autofocus'); + // for some reason, autofocus is not honored when running cypress tests + // while it is in non controlled browsers + // .should('have.focus'); + }); + it('should show in result when url is searched', function() { cy.get('#swh-origins-url-patterns') .type(origin.url); diff --git a/swh/web/templates/includes/origin-search-form.html b/swh/web/templates/includes/origin-search-form.html --- a/swh/web/templates/includes/origin-search-form.html +++ b/swh/web/templates/includes/origin-search-form.html @@ -7,7 +7,9 @@
- +