Skip to content

Commit f68b1cd

Browse files
committed
test visibility of selector
1 parent 499b40b commit f68b1cd

File tree

2 files changed

+54
-1
lines changed

2 files changed

+54
-1
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/**
2+
* ---------------------------------------------------------------------
3+
*
4+
* GLPI - Gestionnaire Libre de Parc Informatique
5+
*
6+
* http://glpi-project.org
7+
*
8+
* @copyright 2015-2024 Teclib' and contributors.
9+
* @copyright 2003-2014 by the INDEPNET Development Team.
10+
* @licence https://www.gnu.org/licenses/gpl-3.0.html
11+
*
12+
* ---------------------------------------------------------------------
13+
*
14+
* LICENSE
15+
*
16+
* This file is part of GLPI.
17+
*
18+
* This program is free software: you can redistribute it and/or modify
19+
* it under the terms of the GNU General Public License as published by
20+
* the Free Software Foundation, either version 3 of the License, or
21+
* (at your option) any later version.
22+
*
23+
* This program is distributed in the hope that it will be useful,
24+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
25+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26+
* GNU General Public License for more details.
27+
*
28+
* You should have received a copy of the GNU General Public License
29+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
30+
*
31+
* ---------------------------------------------------------------------
32+
*/
33+
34+
describe('Entity Selector', () => {
35+
beforeEach(() => {
36+
cy.login();
37+
cy.changeProfile('Super-Admin');
38+
});
39+
it('Loads', () => {
40+
cy.visit('/');
41+
cy.get('.user-menu-dropdown-toggle:visible').click();
42+
cy.get('.entity-dropdown-toggle:visible').click();
43+
cy.get('.entity-dropdown-toggle:visible').next().should('have.class', 'dropdown-menu').and('be.visible');
44+
45+
cy.get('.entity-dropdown-toggle:visible').next().within(() => {
46+
cy.get('h3').should('have.text', 'Select the desired entity');
47+
cy.get('.alert').should('have.length', 2);
48+
cy.get('input[name="entsearchtext"]').should('be.visible').and('have.attr', 'placeholder', 'Search entity');
49+
cy.get('.data_tree table tr').should('have.length.gte', 1);
50+
cy.get('.data_tree table a').contains('Root entity').should('exist');
51+
});
52+
});
53+
});

tests/cypress/support/commands.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ Cypress.Commands.add('changeProfile', (profile, verify = false) => {
9494
cy.blockGLPIDashboards();
9595
cy.visit(href);
9696
if (verify) {
97-
cy.get('a.user-menu-dropdown-toggle').contains(profile_pattern);
97+
cy.get('a.user-menu-dropdown-toggle:visible').contains(profile_pattern);
9898
}
9999
});
100100
});

0 commit comments

Comments
 (0)