* Detox/E2E: Migrate to typescript * Add jest.config.js * Add moduleMapper to config.json * Add cookie jar to axios client, fix tsconfig.json and default_config.json * Take keyboard into consideration; clean test for now for this migration PR * Revert changes on path_builder * Attempt to fix dep issues * Update detox dep * Added missing @type dev dependencies * Fix dep order * Fix unit tests * Added dynamic year to email.ts
95 lines
3.5 KiB
TypeScript
95 lines
3.5 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 {Setup} from '@support/server_api';
|
|
import {
|
|
serverOneUrl,
|
|
siteOneUrl,
|
|
} from '@support/test_config';
|
|
import {
|
|
ChannelListScreen,
|
|
LoginScreen,
|
|
ServerScreen,
|
|
} from '@support/ui/screen';
|
|
import {expect} from 'detox';
|
|
|
|
describe('Server Login - Login by Email', () => {
|
|
const {
|
|
backButton,
|
|
forgotPasswordButton,
|
|
passwordInput,
|
|
passwordInputError,
|
|
signinButton,
|
|
signinButtonDisabled,
|
|
usernameInput,
|
|
} = LoginScreen;
|
|
const serverOneDisplayName = 'Server 1';
|
|
|
|
beforeAll(async () => {
|
|
// # Connect to server
|
|
await ServerScreen.connectToServer(serverOneUrl, serverOneDisplayName);
|
|
});
|
|
|
|
beforeEach(async () => {
|
|
// * Verify on login screen
|
|
await LoginScreen.toBeVisible();
|
|
|
|
// # Clear fields
|
|
await usernameInput.clearText();
|
|
await passwordInput.clearText();
|
|
});
|
|
|
|
it('MM-T4677_1 - should match elements on login screen', async () => {
|
|
// * Verify basic elements on login screen
|
|
await expect(backButton).toBeVisible();
|
|
await expect(usernameInput).toBeVisible();
|
|
await expect(passwordInput).toBeVisible();
|
|
await expect(forgotPasswordButton).toBeVisible();
|
|
await expect(signinButtonDisabled).toBeVisible();
|
|
});
|
|
|
|
it('MM-T4677_2 - should show disabled signin button on empty username or password', async () => {
|
|
// # Log in with empty username and non-empty password
|
|
await usernameInput.replaceText('');
|
|
await passwordInput.replaceText('password');
|
|
|
|
// * Verify signin button is disabled
|
|
await expect(signinButtonDisabled).toBeVisible();
|
|
|
|
// # Log in with non-empty username and empty password
|
|
await usernameInput.replaceText('username');
|
|
await passwordInput.replaceText('');
|
|
|
|
// * Verify signin button is disabled
|
|
await expect(signinButtonDisabled).toBeVisible();
|
|
});
|
|
|
|
it('MM-T4677_3 - should show incorrect combination error on incorrect credentials', async () => {
|
|
// # Log in with incorrect credentials
|
|
await usernameInput.replaceText('username');
|
|
await passwordInput.replaceText('password');
|
|
await signinButton.tap();
|
|
|
|
// * Verify incorrect combination error
|
|
await expect(passwordInputError).toHaveText('The email and password combination is incorrect');
|
|
});
|
|
|
|
it('MM-T4677_4 - should show channel list screen on successful login', async () => {
|
|
// # Log in to server with correct credentials
|
|
const {team, user} = await Setup.apiInit(siteOneUrl);
|
|
await usernameInput.replaceText(user.username);
|
|
await passwordInput.replaceText(user.password);
|
|
await signinButton.tap();
|
|
|
|
// * Verify on channel list screen and channel list header shows team display name and server display name
|
|
await ChannelListScreen.toBeVisible();
|
|
await expect(ChannelListScreen.headerTeamDisplayName).toHaveText(team.display_name);
|
|
await expect(ChannelListScreen.headerServerDisplayName).toHaveText(serverOneDisplayName);
|
|
});
|
|
});
|