mattermost-mobile/detox/e2e/test/messaging/message_posting.e2e.js
Saturnino Abril a819f63d99
MM-30076 Detox/E2E: Update UI test structure for reusability (#4931)
* update UI test structure for reusability

* fix Android tests

* improve autocomplete test

* minor cleanup
2020-11-03 18:11:49 +08:00

48 lines
1.5 KiB
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
// *******************************************************************
// - [#] indicates a test step (e.g. # Go to a screen)
// - [*] indicates an assertion (e.g. * Check the title)
// - Use element testID when selecting an element. Create one if none.
// *******************************************************************
import {ChannelScreen} from '@support/ui/screen';
import {Setup} from '@support/server_api';
describe('Messaging', () => {
beforeAll(async () => {
const {user} = await Setup.apiInit();
await ChannelScreen.open(user);
});
afterAll(async () => {
await ChannelScreen.logout();
});
it('should post a message on tap to paper send button', async () => {
// * Verify channel screen is visible
await ChannelScreen.toBeVisible();
const {postInput, sendButton} = ChannelScreen;
// * Post input should exist while send button should not
await expect(postInput).toBeVisible();
await expect(sendButton).not.toExist();
// # Tap on post input
await postInput.tap();
// # Type text on post input
const text = Date.now().toString();
await postInput.typeText(text);
// # Tap send button
await expect(sendButton).toBeVisible();
await sendButton.tap();
// * Verify text to exist
await expect(element(by.text(text))).toBeVisible();
});
});