Skip to content

Commit

Permalink
[mattermostGH-12272] UI Automation: Write an automated test using Cyp…
Browse files Browse the repository at this point in the history
…ress for "Trying to type in middle of text should not send the cursor to end of textbox" (mattermost#4251)

* Write an automated test using Cypress for "Trying to type in middle of text should not send the cursor to end of textbox"

* Add one more character to make sure the cursor does not move to the end after one character is written

* Add small wait to make sure it has time to move the cursor automatically in case it fails

* Remove unneeded visit statement.
  • Loading branch information
larkox authored and saturninoabril committed Nov 20, 2019
1 parent cb46ca7 commit 2e8c90d
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions e2e/cypress/integration/messaging/typing_on_middle_spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.

// ***************************************************************
// - [number] indicates a test step (e.g. 1. Go to a page)
// - [*] indicates an assertion (e.g. * Check the title)
// - Use element ID when selecting an element. Create one if none.
// ***************************************************************

import * as TIMEOUTS from '../../fixtures/timeouts';

describe('Messaging', () => {
before(() => {
// # Login and go to /
cy.apiLogin('user-1');
cy.visit('/');
});

it('M18683-Trying to type in middle of text should not send the cursor to end of textbox', () => {
// # Type message to use
cy.get('#post_textbox').clear().type('aa');

// # Move the cursor and keep typing
cy.get('#post_textbox').click().type('{leftarrow}b');

// # Wait for the cursor to move in failing case
cy.wait(TIMEOUTS.SMALL);

// # Write another letter
cy.get('#post_textbox').type('c');

// * Should contain abca instead of aabc or abac
cy.get('#post_textbox').should('contain', 'abca');
});
});

0 comments on commit 2e8c90d

Please sign in to comment.