mattermost-mobile/detox/e2e/test/smoke_test/select_team.e2e.js
Joseph Baylon 53050595dd
MM-35355 Detox/E2E: Add e2e for channels settings (#5377)
* MM-35355 Detox/E2E: Add e2e for channels settings

* Added disabling of non prepackaged plugins to init

* Fix apiGetChannelByName doc parameter
2021-05-12 08:04:01 -07:00

56 lines
2 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,
LoginScreen,
SelectTeamScreen,
} from '@support/ui/screen';
import {
Channel,
Team,
User,
} from '@support/server_api';
describe('Select Team', () => {
const {getTeamByDisplayName} = SelectTeamScreen;
let testTeam;
beforeAll(async () => {
await Team.apiPatchTeams({allow_open_invite: false});
const {user} = await User.apiCreateUser();
const {team} = await Team.apiCreateTeam();
testTeam = team;
await Team.apiPatchTeam(testTeam.id, {allow_open_invite: true});
// # Login
await LoginScreen.open();
await LoginScreen.login(user);
});
afterAll(async () => {
await ChannelScreen.logout();
await Team.apiPatchTeams({allow_open_invite: true});
});
it('MM-T3274 user with no teams should be able to select a team', async () => {
// * Verify select team screen is displayed
await SelectTeamScreen.toBeVisible();
// # Tap on team to join
await waitFor(getTeamByDisplayName(testTeam.display_name)).toBeVisible().whileElement(by.id(SelectTeamScreen.testID.teamsList)).scroll(500, 'down');
const team = await getTeamByDisplayName(testTeam.display_name);
await team.tap();
// * Verify redirect to default channel of joined team
const {channel} = await Channel.apiGetChannelByName(testTeam.id, 'town-square');
await ChannelScreen.toBeVisible();
await expect(ChannelScreen.channelNavBarTitle).toHaveText(channel.display_name);
});
});