diff --git a/templates/pages/tools/search_solution.twig b/templates/pages/tools/search_solution.twig index 7b663a0f2bf..d6318dfc56c 100644 --- a/templates/pages/tools/search_solution.twig +++ b/templates/pages/tools/search_solution.twig @@ -39,7 +39,13 @@ {% endif %}
- {{ inputs.text('contains', contains, {additional_attributes: {size: 50}, input_addclass: 'me-1'}) }} + {{ inputs.text('contains', contains, { + additional_attributes: { + size: 50, + 'aria-label': __('Search…'), + }, + input_addclass: 'me-1' + }) }} {{ inputs.button('search', _x('button', 'Search')) }} {{ inputs.hidden('start', start) }}
@@ -47,9 +53,9 @@ {{ include('components/pager.html.twig', { no_limit_display: true, }) }} -
+
{% for result in results %} -
+
diff --git a/tests/cypress/e2e/ITILObject/ticket_form.cy.js b/tests/cypress/e2e/ITILObject/ticket_form.cy.js new file mode 100644 index 00000000000..2b0b25a845b --- /dev/null +++ b/tests/cypress/e2e/ITILObject/ticket_form.cy.js @@ -0,0 +1,68 @@ +/** + * --------------------------------------------------------------------- + * + * GLPI - Gestionnaire Libre de Parc Informatique + * + * http://glpi-project.org + * + * @copyright 2015-2024 Teclib' and contributors. + * @copyright 2003-2014 by the INDEPNET Development Team. + * @licence https://www.gnu.org/licenses/gpl-3.0.html + * + * --------------------------------------------------------------------- + * + * LICENSE + * + * This file is part of GLPI. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --------------------------------------------------------------------- + */ + +describe("Ticket Form", () => { + beforeEach(() => { + cy.login(); + }); + + it('Search for Solution', () => { + cy.createWithAPI('Ticket', { + name: 'apple', + content: 'apple', + }).as('ticket_id'); + cy.get('@ticket_id').then((ticket_id) => { + cy.visit(`/front/ticket.form.php?id=${ticket_id}`); + cy.get('.timeline-buttons .main-actions button.dropdown-toggle-split').click(); + cy.findByText('Add a solution').click(); + cy.findByLabelText('Search a solution').click(); + cy.get('#modal_searchSolution').within(() => { + cy.findByLabelText('Search…').should('have.value', 'apple'); + cy.findAllByRole('listitem').should('have.length.at.least', 2); + + cy.findAllByTitle('Preview').first().click(); + cy.findByText('Subject').should('be.visible'); + cy.findByText('Content').should('be.visible'); + cy.findByText('Content').parent().next().invoke('text').should('not.be.empty').as('content'); + cy.findAllByRole('listitem').should('have.length', 0); + cy.findByText('Back to results').click(); + + cy.findAllByTitle('Use as a solution').first().click(); + }); + cy.get('#modal_searchSolution').should('not.exist'); + cy.get('@content').then((content) => { + cy.get('textarea[name="content"]').awaitTinyMCE().should('contain.text', content.trim()); + }); + }); + }); +});