From d799584184147d6b3309325a65f254ce25a259f0 Mon Sep 17 00:00:00 2001 From: Lukas Mertens Date: Sat, 30 Mar 2024 22:23:47 +0100 Subject: [PATCH] test(module-selection): added e2e test for search Closes #116 Signed-off-by: Lukas Mertens commit-id:baa01b64 --- cypress/e2e/module-selection.cy.ts | 13 +++++++++++++ cypress/support/commands.ts | 17 ++++++++++++++++- src/components/EvModuleList.vue | 4 +++- 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 cypress/e2e/module-selection.cy.ts diff --git a/cypress/e2e/module-selection.cy.ts b/cypress/e2e/module-selection.cy.ts new file mode 100644 index 00000000..210611d4 --- /dev/null +++ b/cypress/e2e/module-selection.cy.ts @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest + +describe('Module Selection', () => { + it('should be possible to search for EvseManager', () => { + cy.connectToSimulator(); + cy.get('[data-cy="modules-expansion-panel"]').click(); + cy.get('[data-cy="modules-search"]').type("EvseManager"); + cy.get('[data-cy="module-list-item"]').contains("EvseManager").should('be.visible'); + cy.get('[data-cy="modules-search"]').type("{selectall}{backspace}LoremIpsumDolorModule"); + cy.get('[data-cy="module-list-item"]').should('not.exist'); + }); +}); diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index 698b01a4..c1f86e06 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -34,4 +34,19 @@ // visit(originalFn: CommandOriginalFn, url: string, options: Partial): Chainable // } // } -// } \ No newline at end of file +// } +export {}; + +declare global { + namespace Cypress { + interface Chainable { + connectToSimulator(): Chainable; + } + } +} + +Cypress.Commands.add('connectToSimulator', () => { + cy.visit('/'); + cy.get('[data-cy="server-list-item').contains('Simulator').click(); + cy.get('[data-cy="hamburger-menu"]').should('be.visible'); +}) diff --git a/src/components/EvModuleList.vue b/src/components/EvModuleList.vue index afad793c..cd3c9cfc 100644 --- a/src/components/EvModuleList.vue +++ b/src/components/EvModuleList.vue @@ -3,7 +3,7 @@