cypress_test/data/desktop/writer/focus.odt                  |binary
 cypress_test/integration_tests/desktop/writer/focus_spec.js |   79 ++++++++++++
 2 files changed, 79 insertions(+)

New commits:
commit 4f317433070c90b8c4f4374bf63dedb3ddddfd4a
Author:     Tamás Zolnai <tamas.zol...@collabora.com>
AuthorDate: Tue Aug 11 13:12:06 2020 +0200
Commit:     Tamás Zolnai <tamas.zol...@collabora.com>
CommitDate: Tue Aug 11 14:56:22 2020 +0200

    cypress: add focus tests for search field.
    
    A known issue is that when the sidebar is updated
    the focus is grabbed from the search field.
    
    Change-Id: I762de7c6498f5b015465af325a24996719caeae1
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100477
    Tested-by: Jenkins
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com>

diff --git a/cypress_test/data/desktop/writer/focus.odt 
b/cypress_test/data/desktop/writer/focus.odt
new file mode 100644
index 000000000..c8c972343
Binary files /dev/null and b/cypress_test/data/desktop/writer/focus.odt differ
diff --git a/cypress_test/integration_tests/desktop/writer/focus_spec.js 
b/cypress_test/integration_tests/desktop/writer/focus_spec.js
new file mode 100644
index 000000000..ab830e34a
--- /dev/null
+++ b/cypress_test/integration_tests/desktop/writer/focus_spec.js
@@ -0,0 +1,79 @@
+/* global describe it cy beforeEach require afterEach */
+
+var helper = require('../../common/helper');
+
+describe('Focus tests', function() {
+       var testFileName = 'focus.odt';
+
+       beforeEach(function() {
+               helper.beforeAll(testFileName, 'writer');
+       });
+
+       afterEach(function() {
+               helper.afterAll(testFileName);
+       });
+
+       it('Basic document focus.', function() {
+               // Document has the focus after load
+               cy.document().its('activeElement.className')
+                       .should('be.eq', 'clipboard');
+       });
+
+       it('Search for non existing word.', function() {
+               // Move focus to the search field
+               cy.get('#search-input')
+                       .click();
+
+               cy.document().its('activeElement.id')
+                       .should('be.eq', 'search-input');
+
+               var text = 'qqqqq';
+               helper.typeText('body', text, 100);
+
+               // Search field still has the focus.
+               cy.document().its('activeElement.id')
+                       .should('be.eq', 'search-input');
+
+               cy.get('#search-input')
+                       .should('have.prop', 'value', text);
+       });
+
+       it('Search for existing word (with bold font).', function() {
+               // Move focus to the search field
+               cy.get('#search-input')
+                       .click();
+
+               cy.document().its('activeElement.id')
+                       .should('be.eq', 'search-input');
+
+               var text = 'text';
+               helper.typeText('body', text, 100);
+
+               // Search field still has the focus.
+               cy.document().its('activeElement.id')
+                       .should('be.eq', 'search-input');
+
+               cy.get('#search-input')
+                       .should('have.prop', 'value', text);
+       });
+
+       it('Search for existing word (in table).', function() {
+               // Move focus to the search field
+               cy.get('#search-input')
+                       .click();
+
+               cy.document().its('activeElement.id')
+                       .should('be.eq', 'search-input');
+
+               var text = 'word';
+               helper.typeText('body', text, 200);
+
+               // Search field still has the focus.
+               // We have a focus issue here.
+               //cy.document().its('activeElement.id')
+               //      .should('be.eq', 'search-input');
+
+               //cy.get('#search-input')
+               //      .should('have.prop', 'value', text);
+       });
+});
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to