mattermost-mobile/detox/e2e/test/messaging/markdown_image.e2e.ts
Joseph Baylon 6a3c600c8a
Detox/E2E: Messaging (at-mentions, channel mentions, autocomplete etc) e2e tests in Gekidou (#6428)
* Detox/E2E: Messaging (at-mentions, channel mentions, autocomplete etc) e2e tests in Gekidou

* Enable other failing tests so they're visible

* Detox/E2E: Messaging markdown e2e tests in Gekidou (#6450)

* Detox/E2E: Messaging markdown e2e tests in Gekidou

* Added zephyr test ids

* Added markdown smoke test

* Enable disabled tests

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-07-05 10:01:46 -07:00

80 lines
2.9 KiB
TypeScript

// 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 {
Post,
Setup,
} from '@support/server_api';
import {
serverOneUrl,
siteOneUrl,
} from '@support/test_config';
import {
ChannelListScreen,
ChannelScreen,
HomeScreen,
LoginScreen,
ServerScreen,
} from '@support/ui/screen';
import {expect} from 'detox';
describe('Messaging - Markdown Image', () => {
const serverOneDisplayName = 'Server 1';
const channelsCategory = 'channels';
let testChannel: any;
beforeAll(async () => {
const {channel, user} = await Setup.apiInit(siteOneUrl);
testChannel = channel;
// # Log in to server
await ServerScreen.connectToServer(serverOneUrl, serverOneDisplayName);
await LoginScreen.login(user);
});
beforeEach(async () => {
// * Verify on channel list screen
await ChannelListScreen.toBeVisible();
});
afterAll(async () => {
// # Log out
await HomeScreen.logout();
});
it('MM-T4896_1 - should be able to display markdown image', async () => {
// # Open a channel screen and post a markdown image
const markdownImage = '![Mattermost](https://docs.mattermost.com/_images/icon-76x76.png)';
await ChannelScreen.open(channelsCategory, testChannel.name);
await ChannelScreen.postMessage(markdownImage);
// * Verify markdown image is displayed
const {post} = await Post.apiGetLastPostInChannel(siteOneUrl, testChannel.id);
const {postListPostItemImage} = ChannelScreen.getPostListPostItem(post.id);
await expect(postListPostItemImage).toBeVisible();
// # Go back to channel list screen
await ChannelScreen.back();
});
it('MM-T4896_2 - should be able to display markdown image with link', async () => {
// # Open a channel screen and post a markdown image with link
const markdownImage = '[![Mattermost](https://docs.mattermost.com/_images/icon-76x76.png)](https://github.com/mattermost/mattermost-server)';
await ChannelScreen.open(channelsCategory, testChannel.name);
await ChannelScreen.postMessage(markdownImage);
// * Verify markdown image with link is displayed
const {post} = await Post.apiGetLastPostInChannel(siteOneUrl, testChannel.id);
const {postListPostItemImage} = ChannelScreen.getPostListPostItem(post.id);
await expect(postListPostItemImage).toBeVisible();
// # Go back to channel list screen
await ChannelScreen.back();
});
});