Skip to content

Commit

Permalink
test(module-selection): added e2e test for search
Browse files Browse the repository at this point in the history
Closes #116

Signed-off-by: Lukas Mertens <[email protected]>

commit-id:baa01b64
  • Loading branch information
lukas-mertens committed Apr 2, 2024
1 parent 4178558 commit d799584
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
13 changes: 13 additions & 0 deletions cypress/e2e/module-selection.cy.ts
Original file line number Diff line number Diff line change
@@ -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');
});
});
17 changes: 16 additions & 1 deletion cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,19 @@
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
// }
// }
// }
// }
export {};

declare global {
namespace Cypress {
interface Chainable {
connectToSimulator(): Chainable<void>;
}
}
}

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');
})
4 changes: 3 additions & 1 deletion src/components/EvModuleList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<template>
<v-expansion-panels class="ma-0">
<v-expansion-panel>
<v-expansion-panel data-cy="modules-expansion-panel">
<v-expansion-panel-title> Available modules</v-expansion-panel-title>
<v-expansion-panel-text>
<v-text-field v-model="search"
Expand All @@ -12,6 +12,7 @@
label="Search"
density="compact"
variant="outlined"
data-cy="modules-search"
clearable
></v-text-field>
<v-list class="ma-0">
Expand All @@ -21,6 +22,7 @@
v-bind="props"
:title="module.type"
@click.stop="add_module_to_config(module.type)"
data-cy="module-list-item"
>
<template v-slot:append>
<v-icon>mdi-plus</v-icon>
Expand Down

0 comments on commit d799584

Please sign in to comment.