cypress: add tests for search bar in Calc (mobile).
Change-Id: I046b90d021d01ce0bc1c1fc65d3ee435af3ad97f
This commit is contained in:
parent
e63afd6431
commit
995f454c32
2 changed files with 138 additions and 0 deletions
BIN
cypress_test/data/mobile/calc/search_bar.ods
Normal file
BIN
cypress_test/data/mobile/calc/search_bar.ods
Normal file
Binary file not shown.
138
cypress_test/integration_tests/mobile/calc/searchbar_spec.js
Normal file
138
cypress_test/integration_tests/mobile/calc/searchbar_spec.js
Normal file
|
@ -0,0 +1,138 @@
|
|||
/* global describe it cy beforeEach require afterEach*/
|
||||
|
||||
var helper = require('../../common/helper');
|
||||
var searchHelper = require('../../common/search_helper');
|
||||
var mobileHelper = require('../../common/mobile_helper');
|
||||
|
||||
describe('Searching via search bar.', function() {
|
||||
var testFileName = 'search_bar.ods';
|
||||
|
||||
beforeEach(function() {
|
||||
helper.beforeAll(testFileName, 'calc');
|
||||
|
||||
mobileHelper.enableEditingMobile();
|
||||
|
||||
searchHelper.showSearchBar();
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
helper.afterAll(testFileName);
|
||||
});
|
||||
|
||||
it('Search existing word.', function() {
|
||||
searchHelper.tpyeIntoSearchField('a');
|
||||
|
||||
searchHelper.searchNext();
|
||||
|
||||
// First cell should be selected
|
||||
cy.get('input#addressInput')
|
||||
.should('have.prop', 'value', 'A1');
|
||||
|
||||
cy.get('#copy-paste-container table td')
|
||||
.should('have.text', 'a');
|
||||
});
|
||||
|
||||
it('Search not existing word.', function() {
|
||||
cy.get('input#addressInput')
|
||||
.should('have.prop', 'value', 'A2');
|
||||
|
||||
searchHelper.tpyeIntoSearchField('q');
|
||||
|
||||
// Should be no new selection
|
||||
cy.get('input#addressInput')
|
||||
.should('have.prop', 'value', 'A2');
|
||||
});
|
||||
|
||||
it('Search next / prev instance.', function() {
|
||||
searchHelper.tpyeIntoSearchField('a');
|
||||
|
||||
searchHelper.searchNext();
|
||||
|
||||
cy.get('input#addressInput')
|
||||
.should('have.prop', 'value', 'A1');
|
||||
|
||||
cy.get('#copy-paste-container table td')
|
||||
.should('have.text', 'a');
|
||||
|
||||
// Search next instance
|
||||
searchHelper.searchNext();
|
||||
|
||||
cy.get('input#addressInput')
|
||||
.should('have.prop', 'value', 'B1');
|
||||
|
||||
cy.get('#copy-paste-container table td')
|
||||
.should('have.text', 'a');
|
||||
|
||||
// Search prev instance
|
||||
searchHelper.searchPrev();
|
||||
|
||||
cy.get('input#addressInput')
|
||||
.should('have.prop', 'value', 'A1');
|
||||
|
||||
cy.get('#copy-paste-container table td')
|
||||
.should('have.text', 'a');
|
||||
});
|
||||
|
||||
it('Search at the document end.', function() {
|
||||
searchHelper.tpyeIntoSearchField('a');
|
||||
|
||||
searchHelper.searchNext();
|
||||
|
||||
cy.get('input#addressInput')
|
||||
.should('have.prop', 'value', 'A1');
|
||||
|
||||
cy.get('#copy-paste-container table td')
|
||||
.should('have.text', 'a');
|
||||
|
||||
// Search next instance
|
||||
searchHelper.searchNext();
|
||||
|
||||
cy.get('input#addressInput')
|
||||
.should('have.prop', 'value', 'B1');
|
||||
|
||||
cy.get('#copy-paste-container table td')
|
||||
.should('have.text', 'a');
|
||||
|
||||
// Search next instance, which is in the beginning of the document.
|
||||
searchHelper.searchNext();
|
||||
|
||||
cy.get('input#addressInput')
|
||||
.should('have.prop', 'value', 'A1');
|
||||
|
||||
cy.get('#copy-paste-container table td')
|
||||
.should('have.text', 'a');
|
||||
});
|
||||
|
||||
it('Cancel search.', function() {
|
||||
searchHelper.tpyeIntoSearchField('a');
|
||||
|
||||
searchHelper.searchNext();
|
||||
|
||||
cy.get('input#addressInput')
|
||||
.should('have.prop', 'value', 'A1');
|
||||
|
||||
cy.get('#copy-paste-container table td')
|
||||
.should('have.text', 'a');
|
||||
|
||||
// Cancel search -> selection removed
|
||||
searchHelper.cancelSearch();
|
||||
|
||||
cy.get('input#search-input')
|
||||
.should('be.visible');
|
||||
});
|
||||
|
||||
it('Close search.', function() {
|
||||
searchHelper.tpyeIntoSearchField('a');
|
||||
|
||||
searchHelper.searchNext();
|
||||
|
||||
cy.get('input#addressInput')
|
||||
.should('have.prop', 'value', 'A1');
|
||||
|
||||
cy.get('#copy-paste-container table td')
|
||||
.should('have.text', 'a');
|
||||
|
||||
// Close search -> search bar is closed
|
||||
searchHelper.closeSearchBar();
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue