mattermost-mobile/detox/e2e/test/teams/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

54 lines
1.9 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', () => {
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});
// # Open select team screen
await LoginScreen.open();
await LoginScreen.login(user);
await SelectTeamScreen.toBeVisible();
});
afterAll(async () => {
await ChannelScreen.logout();
await Team.apiPatchTeams({allow_open_invite: true});
});
it('MM-T3619 should be able to select a team', async () => {
// # Tap on team to join
await waitFor(SelectTeamScreen.getTeamByDisplayName(testTeam.display_name)).toBeVisible().whileElement(by.id(SelectTeamScreen.testID.teamsList)).scroll(500, 'down');
const team = await SelectTeamScreen.getTeamByDisplayName(testTeam.display_name);
await team.tap();
// * Verify redirect to default channel of joined team
const {channel} = await Channel.apiGetChannelByName(testTeam.id, 'town-square');
const {channelNavBarTitle} = ChannelScreen;
await ChannelScreen.toBeVisible();
await expect(channelNavBarTitle).toHaveText(channel.display_name);
});
});