Remove unnecessary actionTypes, reducers and sagas, e2e tests and navigation to team view
This commit is contained in:
parent
c8b8680541
commit
a245af6c1c
|
@ -1,22 +0,0 @@
|
||||||
import * as types from './actionsTypes';
|
|
||||||
|
|
||||||
export function createTeamRequest(data) {
|
|
||||||
return {
|
|
||||||
type: types.CREATE_TEAM.REQUEST,
|
|
||||||
data
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createTeamSuccess(data) {
|
|
||||||
return {
|
|
||||||
type: types.CREATE_TEAM.SUCCESS,
|
|
||||||
data
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createTeamFailure(err) {
|
|
||||||
return {
|
|
||||||
type: types.CREATE_TEAM.FAILURE,
|
|
||||||
err
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -731,10 +731,20 @@ const RocketChat = {
|
||||||
createTeam({
|
createTeam({
|
||||||
name, users, type, readOnly, broadcast, encrypted
|
name, users, type, readOnly, broadcast, encrypted
|
||||||
}) {
|
}) {
|
||||||
|
const params = {
|
||||||
|
name,
|
||||||
|
users,
|
||||||
|
type: type ? 1 : 0,
|
||||||
|
room: {
|
||||||
|
readOnly,
|
||||||
|
extraData: {
|
||||||
|
broadcast,
|
||||||
|
encrypted
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
// RC 3.13.0
|
// RC 3.13.0
|
||||||
return this.post('teams.create', {
|
return this.post('teams.create', params);
|
||||||
name, users, type, readOnly, broadcast, encrypted
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
joinRoom(roomId, joinCode, type) {
|
joinRoom(roomId, joinCode, type) {
|
||||||
// TODO: join code
|
// TODO: join code
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
import { CREATE_TEAM } from '../actions/actionsTypes';
|
|
||||||
|
|
||||||
const initialState = {
|
|
||||||
isFetching: false,
|
|
||||||
failure: false,
|
|
||||||
result: {},
|
|
||||||
error: {}
|
|
||||||
};
|
|
||||||
|
|
||||||
export default function(state = initialState, action) {
|
|
||||||
switch (action.type) {
|
|
||||||
case CREATE_TEAM.REQUEST:
|
|
||||||
return {
|
|
||||||
...state,
|
|
||||||
isFetching: true,
|
|
||||||
failure: false,
|
|
||||||
error: {}
|
|
||||||
};
|
|
||||||
case CREATE_TEAM.SUCCESS:
|
|
||||||
return {
|
|
||||||
...state,
|
|
||||||
isFetching: false,
|
|
||||||
failure: false,
|
|
||||||
result: action.data
|
|
||||||
};
|
|
||||||
case CREATE_TEAM.FAILURE:
|
|
||||||
return {
|
|
||||||
...state,
|
|
||||||
isFetching: false,
|
|
||||||
failure: true,
|
|
||||||
error: action.err
|
|
||||||
};
|
|
||||||
default:
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -7,7 +7,6 @@ import rooms from './rooms';
|
||||||
import server from './server';
|
import server from './server';
|
||||||
import selectedUsers from './selectedUsers';
|
import selectedUsers from './selectedUsers';
|
||||||
import createChannel from './createChannel';
|
import createChannel from './createChannel';
|
||||||
import createTeam from './createTeam';
|
|
||||||
import app from './app';
|
import app from './app';
|
||||||
import sortPreferences from './sortPreferences';
|
import sortPreferences from './sortPreferences';
|
||||||
import share from './share';
|
import share from './share';
|
||||||
|
@ -30,7 +29,6 @@ export default combineReducers({
|
||||||
server,
|
server,
|
||||||
selectedUsers,
|
selectedUsers,
|
||||||
createChannel,
|
createChannel,
|
||||||
createTeam,
|
|
||||||
app,
|
app,
|
||||||
room,
|
room,
|
||||||
rooms,
|
rooms,
|
||||||
|
|
|
@ -21,6 +21,10 @@ const createGroupChat = function createGroupChat() {
|
||||||
return RocketChat.createGroupChat();
|
return RocketChat.createGroupChat();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const createTeam = function createTeam(data) {
|
||||||
|
return RocketChat.createTeam(data);
|
||||||
|
};
|
||||||
|
|
||||||
const handleRequest = function* handleRequest({ data }) {
|
const handleRequest = function* handleRequest({ data }) {
|
||||||
try {
|
try {
|
||||||
const auth = yield select(state => state.login.isAuthenticated);
|
const auth = yield select(state => state.login.isAuthenticated);
|
||||||
|
@ -29,7 +33,21 @@ const handleRequest = function* handleRequest({ data }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
let sub;
|
let sub;
|
||||||
if (data.group) {
|
if (data.isTeam) {
|
||||||
|
const {
|
||||||
|
type,
|
||||||
|
readOnly,
|
||||||
|
broadcast,
|
||||||
|
encrypted
|
||||||
|
} = data;
|
||||||
|
logEvent(events.CR_CREATE, {
|
||||||
|
type,
|
||||||
|
readOnly,
|
||||||
|
broadcast,
|
||||||
|
encrypted
|
||||||
|
});
|
||||||
|
sub = yield call(createTeam, data);
|
||||||
|
} else if (data.group) {
|
||||||
logEvent(events.SELECTED_USERS_CREATE_GROUP);
|
logEvent(events.SELECTED_USERS_CREATE_GROUP);
|
||||||
const result = yield call(createGroupChat);
|
const result = yield call(createGroupChat);
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
|
@ -76,7 +94,11 @@ const handleSuccess = function* handleSuccess({ data }) {
|
||||||
if (isMasterDetail) {
|
if (isMasterDetail) {
|
||||||
Navigation.navigate('DrawerNavigator');
|
Navigation.navigate('DrawerNavigator');
|
||||||
}
|
}
|
||||||
goRoom({ item: data, isMasterDetail });
|
if (data.team) {
|
||||||
|
goRoom({ item: data.team, isMasterDetail });
|
||||||
|
} else {
|
||||||
|
goRoom({ item: data, isMasterDetail });
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleFailure = function handleFailure({ err }) {
|
const handleFailure = function handleFailure({ err }) {
|
||||||
|
|
|
@ -1,80 +0,0 @@
|
||||||
import {
|
|
||||||
select, put, call, take, takeLatest
|
|
||||||
} from 'redux-saga/effects';
|
|
||||||
import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord';
|
|
||||||
|
|
||||||
import { CREATE_TEAM, LOGIN } from '../actions/actionsTypes';
|
|
||||||
import { createTeamSuccess, createTeamFailure } from '../actions/createTeam';
|
|
||||||
import { showErrorAlert } from '../utils/info';
|
|
||||||
import RocketChat from '../lib/rocketchat';
|
|
||||||
import Navigation from '../lib/Navigation';
|
|
||||||
import database from '../lib/database';
|
|
||||||
import I18n from '../i18n';
|
|
||||||
import { logEvent, events } from '../utils/log';
|
|
||||||
import { goRoom } from '../utils/goRoom';
|
|
||||||
|
|
||||||
const createTeam = function createTeam(data) {
|
|
||||||
return RocketChat.createTeam(data);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleRequest = function* handleRequest({ data }) {
|
|
||||||
try {
|
|
||||||
const auth = yield select(state => state.login.isAuthenticated);
|
|
||||||
if (!auth) {
|
|
||||||
yield take(LOGIN.SUCCESS);
|
|
||||||
}
|
|
||||||
|
|
||||||
const {
|
|
||||||
type, readOnly, broadcast, encrypted
|
|
||||||
} = data;
|
|
||||||
|
|
||||||
logEvent(events.CR_CREATE, {
|
|
||||||
type,
|
|
||||||
readOnly,
|
|
||||||
broadcast,
|
|
||||||
encrypted
|
|
||||||
});
|
|
||||||
const sub = yield call(createTeam, data);
|
|
||||||
|
|
||||||
try {
|
|
||||||
const db = database.active;
|
|
||||||
const subCollection = db.get('subscriptions');
|
|
||||||
yield db.action(async() => {
|
|
||||||
await subCollection.create((s) => {
|
|
||||||
s._raw = sanitizedRaw({ id: sub.rid }, subCollection.schema);
|
|
||||||
Object.assign(s, sub);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
} catch {
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
yield put(createTeamSuccess(sub));
|
|
||||||
} catch (err) {
|
|
||||||
logEvent(events[data.group ? 'SELECTED_USERS_CREATE_GROUP_F' : 'CR_CREATE_F']);
|
|
||||||
yield put(createTeamFailure(err));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleSuccess = function* handleSuccess({ data }) {
|
|
||||||
const isMasterDetail = yield select(state => state.app.isMasterDetail);
|
|
||||||
if (isMasterDetail) {
|
|
||||||
Navigation.navigate('DrawerNavigator');
|
|
||||||
}
|
|
||||||
goRoom({ item: data, isMasterDetail });
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleFailure = function handleFailure({ err }) {
|
|
||||||
setTimeout(() => {
|
|
||||||
const msg = err.reason || I18n.t('There_was_an_error_while_action', { action: I18n.t('creating_team') });
|
|
||||||
showErrorAlert(msg);
|
|
||||||
}, 300);
|
|
||||||
};
|
|
||||||
|
|
||||||
const root = function* root() {
|
|
||||||
yield takeLatest(CREATE_TEAM.REQUEST, handleRequest);
|
|
||||||
yield takeLatest(CREATE_TEAM.SUCCESS, handleSuccess);
|
|
||||||
yield takeLatest(CREATE_TEAM.FAILURE, handleFailure);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default root;
|
|
|
@ -5,7 +5,6 @@ import room from './room';
|
||||||
import messages from './messages';
|
import messages from './messages';
|
||||||
import selectServer from './selectServer';
|
import selectServer from './selectServer';
|
||||||
import createChannel from './createChannel';
|
import createChannel from './createChannel';
|
||||||
import createTeam from './createTeam';
|
|
||||||
import init from './init';
|
import init from './init';
|
||||||
import state from './state';
|
import state from './state';
|
||||||
import deepLinking from './deepLinking';
|
import deepLinking from './deepLinking';
|
||||||
|
@ -19,7 +18,6 @@ const root = function* root() {
|
||||||
yield all([
|
yield all([
|
||||||
init(),
|
init(),
|
||||||
createChannel(),
|
createChannel(),
|
||||||
createTeam(),
|
|
||||||
rooms(),
|
rooms(),
|
||||||
room(),
|
room(),
|
||||||
login(),
|
login(),
|
||||||
|
|
|
@ -7,18 +7,27 @@ const navigate = ({ item, isMasterDetail, ...props }) => {
|
||||||
if (isMasterDetail) {
|
if (isMasterDetail) {
|
||||||
navigationMethod = Navigation.replace;
|
navigationMethod = Navigation.replace;
|
||||||
}
|
}
|
||||||
|
console.log({ item });
|
||||||
navigationMethod('RoomView', {
|
if (item.roomId) {
|
||||||
rid: item.rid,
|
navigationMethod('RoomView', {
|
||||||
name: RocketChat.getRoomTitle(item),
|
rid: item.roomId || item.rid,
|
||||||
t: item.t,
|
name: RocketChat.getRoomTitle(item),
|
||||||
prid: item.prid,
|
roomUserId: RocketChat.getUidDirectMessage(item),
|
||||||
room: item,
|
...props
|
||||||
search: item.search,
|
});
|
||||||
visitor: item.visitor,
|
} else {
|
||||||
roomUserId: RocketChat.getUidDirectMessage(item),
|
navigationMethod('RoomView', {
|
||||||
...props
|
rid: item.rid,
|
||||||
});
|
name: RocketChat.getRoomTitle(item),
|
||||||
|
t: item.t,
|
||||||
|
prid: item.prid,
|
||||||
|
room: item,
|
||||||
|
search: item.search,
|
||||||
|
visitor: item.visitor,
|
||||||
|
roomUserId: RocketChat.getUidDirectMessage(item),
|
||||||
|
...props
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const goRoom = async({ item = {}, isMasterDetail = false, ...props }) => {
|
export const goRoom = async({ item = {}, isMasterDetail = false, ...props }) => {
|
||||||
|
|
|
@ -10,7 +10,6 @@ import * as List from '../containers/List';
|
||||||
import TextInput from '../presentation/TextInput';
|
import TextInput from '../presentation/TextInput';
|
||||||
import Loading from '../containers/Loading';
|
import Loading from '../containers/Loading';
|
||||||
import { createChannelRequest as createChannelRequestAction } from '../actions/createChannel';
|
import { createChannelRequest as createChannelRequestAction } from '../actions/createChannel';
|
||||||
import { createTeamRequest as createTeamRequestAction } from '../actions/createTeam';
|
|
||||||
import { removeUser as removeUserAction } from '../actions/selectedUsers';
|
import { removeUser as removeUserAction } from '../actions/selectedUsers';
|
||||||
import sharedStyles from './Styles';
|
import sharedStyles from './Styles';
|
||||||
import KeyboardView from '../presentation/KeyboardView';
|
import KeyboardView from '../presentation/KeyboardView';
|
||||||
|
@ -77,8 +76,7 @@ class CreateChannelView extends React.Component {
|
||||||
navigation: PropTypes.object,
|
navigation: PropTypes.object,
|
||||||
route: PropTypes.object,
|
route: PropTypes.object,
|
||||||
baseUrl: PropTypes.string,
|
baseUrl: PropTypes.string,
|
||||||
createChannel: PropTypes.func.isRequired,
|
create: PropTypes.func.isRequired,
|
||||||
createTeam: PropTypes.func.isRequired,
|
|
||||||
removeUser: PropTypes.func.isRequired,
|
removeUser: PropTypes.func.isRequired,
|
||||||
error: PropTypes.object,
|
error: PropTypes.object,
|
||||||
failure: PropTypes.bool,
|
failure: PropTypes.bool,
|
||||||
|
@ -158,7 +156,7 @@ class CreateChannelView extends React.Component {
|
||||||
channelName, type, readOnly, broadcast, encrypted
|
channelName, type, readOnly, broadcast, encrypted
|
||||||
} = this.state;
|
} = this.state;
|
||||||
const {
|
const {
|
||||||
users: usersProps, isFetching, createTeam, createChannel, route
|
users: usersProps, isFetching, create, route
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const { isTeam } = route?.params;
|
const { isTeam } = route?.params;
|
||||||
|
|
||||||
|
@ -169,17 +167,10 @@ class CreateChannelView extends React.Component {
|
||||||
// transform users object into array of usernames
|
// transform users object into array of usernames
|
||||||
const users = usersProps.map(user => user.name);
|
const users = usersProps.map(user => user.name);
|
||||||
|
|
||||||
if (isTeam) {
|
// create channel or team
|
||||||
// create team
|
create({
|
||||||
createTeam({
|
name: channelName, users, type, readOnly, broadcast, encrypted, isTeam
|
||||||
name: channelName, users, type, readOnly, broadcast, encrypted
|
});
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// create channel
|
|
||||||
createChannel({
|
|
||||||
name: channelName, users, type, readOnly, broadcast, encrypted
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Review.pushPositiveEvent();
|
Review.pushPositiveEvent();
|
||||||
}
|
}
|
||||||
|
@ -376,20 +367,16 @@ class CreateChannelView extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapStateToProps = (state, ownProps) => {
|
const mapStateToProps = state => ({
|
||||||
const { route } = ownProps;
|
baseUrl: state.server.server,
|
||||||
return {
|
isFetching: state.createChannel.isFetching,
|
||||||
baseUrl: state.server.server,
|
encryptionEnabled: state.encryption.enabled,
|
||||||
isFetching: route?.params?.isTeam ? state.createTeam.isFetching : state.createChannel.isFetching,
|
users: state.selectedUsers.users,
|
||||||
encryptionEnabled: state.encryption.enabled,
|
user: getUserSelector(state)
|
||||||
users: state.selectedUsers.users,
|
});
|
||||||
user: getUserSelector(state)
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => ({
|
const mapDispatchToProps = dispatch => ({
|
||||||
createChannel: data => dispatch(createChannelRequestAction(data)),
|
create: data => dispatch(createChannelRequestAction(data)),
|
||||||
createTeam: data => dispatch(createTeamRequestAction(data)),
|
|
||||||
removeUser: user => dispatch(removeUserAction(user))
|
removeUser: user => dispatch(removeUserAction(user))
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@ import { withTheme } from '../theme';
|
||||||
import { getUserSelector } from '../selectors/login';
|
import { getUserSelector } from '../selectors/login';
|
||||||
import Navigation from '../lib/Navigation';
|
import Navigation from '../lib/Navigation';
|
||||||
import { createChannelRequest } from '../actions/createChannel';
|
import { createChannelRequest } from '../actions/createChannel';
|
||||||
import { createTeamRequest } from '../actions/createTeam';
|
|
||||||
import { goRoom } from '../utils/goRoom';
|
import { goRoom } from '../utils/goRoom';
|
||||||
import SafeAreaView from '../containers/SafeAreaView';
|
import SafeAreaView from '../containers/SafeAreaView';
|
||||||
|
|
||||||
|
@ -266,8 +265,7 @@ const mapStateToProps = state => ({
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => ({
|
const mapDispatchToProps = dispatch => ({
|
||||||
createChannel: params => dispatch(createChannelRequest(params)),
|
create: params => dispatch(createChannelRequest(params))
|
||||||
createTeam: params => dispatch(createTeamRequest(params))
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(withTheme(NewMessageView));
|
export default connect(mapStateToProps, mapDispatchToProps)(withTheme(NewMessageView));
|
||||||
|
|
|
@ -42,6 +42,11 @@ const data = {
|
||||||
name: `detox-private-${ value }`
|
name: `detox-private-${ value }`
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
teams: {
|
||||||
|
private: {
|
||||||
|
name: `detox-team-${ value }`
|
||||||
|
}
|
||||||
|
},
|
||||||
registeringUser: {
|
registeringUser: {
|
||||||
username: `newuser${ value }`,
|
username: `newuser${ value }`,
|
||||||
password: `password${ value }`,
|
password: `password${ value }`,
|
||||||
|
|
|
@ -57,6 +57,26 @@ const createChannelIfNotExists = async (channelname) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const createTeamIfNotExists = async (teamname) => {
|
||||||
|
console.log(`Creating private team ${teamname}`)
|
||||||
|
try {
|
||||||
|
const team = await rocketchat.post('teams.create', {
|
||||||
|
"name": teamname,
|
||||||
|
"type": 1
|
||||||
|
})
|
||||||
|
return team
|
||||||
|
} catch (createError) {
|
||||||
|
try { //Maybe it exists already?
|
||||||
|
const team = rocketchat.get(`teams.info?teamName=${teamname}`)
|
||||||
|
return team
|
||||||
|
} catch (infoError) {
|
||||||
|
console.log(JSON.stringify(createError))
|
||||||
|
console.log(JSON.stringify(infoError))
|
||||||
|
throw "Failed to find or create private team"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const createGroupIfNotExists = async (groupname) => {
|
const createGroupIfNotExists = async (groupname) => {
|
||||||
console.log(`Creating private group ${groupname}`)
|
console.log(`Creating private group ${groupname}`)
|
||||||
try {
|
try {
|
||||||
|
@ -133,6 +153,13 @@ const setup = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (var teamKey in data.teams) {
|
||||||
|
if (data.teams.hasOwnProperty(teamKey)) {
|
||||||
|
const team = data.teams[teamKey]
|
||||||
|
await createTeamIfNotExists(team.name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
const {
|
||||||
|
device, expect, element, by, waitFor
|
||||||
|
} = require('detox');
|
||||||
|
const data = require('../../data');
|
||||||
|
const { tapBack, sleep, navigateToLogin, login, tryTapping } = require('../../helpers/app');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
describe('Create team screen', () => {
|
||||||
|
before(async() => {
|
||||||
|
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
|
||||||
|
await navigateToLogin();
|
||||||
|
await login(data.users.regular.username, data.users.regular.password);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('New Message', async() => {
|
||||||
|
before(async() => {
|
||||||
|
await element(by.id('rooms-list-view-create-channel')).tap();
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Render', async() => {
|
||||||
|
it('should have team button', async() => {
|
||||||
|
await waitFor(element(by.id('new-message-view-create-team'))).toBeVisible().withTimeout(2000);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('Usage', async() => {
|
||||||
|
it('should navigate to select users', async() => {
|
||||||
|
await element(by.id('new-message-view-create-team')).tap();
|
||||||
|
await waitFor(element(by.id('select-users-view'))).toExist().withTimeout(5000);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Select Users', async() => {
|
||||||
|
it('should search users', async() => {
|
||||||
|
await element(by.id('select-users-view-search')).replaceText('rocket.cat');
|
||||||
|
await waitFor(element(by.id(`select-users-view-item-rocket.cat`))).toBeVisible().withTimeout(10000);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should select/unselect user', async() => {
|
||||||
|
// Spotlight issues
|
||||||
|
await element(by.id('select-users-view-item-rocket.cat')).tap();
|
||||||
|
await waitFor(element(by.id('selected-user-rocket.cat'))).toBeVisible().withTimeout(10000);
|
||||||
|
await element(by.id('selected-user-rocket.cat')).tap();
|
||||||
|
await waitFor(element(by.id('selected-user-rocket.cat'))).toBeNotVisible().withTimeout(10000);
|
||||||
|
// Spotlight issues
|
||||||
|
await element(by.id('select-users-view-item-rocket.cat')).tap();
|
||||||
|
await waitFor(element(by.id('selected-user-rocket.cat'))).toBeVisible().withTimeout(10000);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create team', async() => {
|
||||||
|
await element(by.id('selected-users-view-submit')).tap();
|
||||||
|
await waitFor(element(by.id('create-team-view'))).toExist().withTimeout(10000);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('Create Team', async() => {
|
||||||
|
describe('Usage', async() => {
|
||||||
|
it('should get invalid team name', async() => {
|
||||||
|
await element(by.id('create-team-name')).typeText(`${data.teams.private.name}`);
|
||||||
|
await element(by.id('create-channel-submit')).tap();
|
||||||
|
await element(by.text('OK')).tap();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create private team', async() => {
|
||||||
|
const room = `private${ data.random }`;
|
||||||
|
await element(by.id('create-team-name')).replaceText('');
|
||||||
|
await element(by.id('create-team-name')).typeText(room);
|
||||||
|
await element(by.id('create-channel-submit')).tap();
|
||||||
|
await waitFor(element(by.id('room-view'))).toExist().withTimeout(20000);
|
||||||
|
await expect(element(by.id('room-view'))).toExist();
|
||||||
|
await waitFor(element(by.id(`room-view-title-${ room }`))).toExist().withTimeout(6000);
|
||||||
|
await expect(element(by.id(`room-view-title-${ room }`))).toExist();
|
||||||
|
await tapBack();
|
||||||
|
await waitFor(element(by.id('rooms-list-view'))).toExist().withTimeout(10000);
|
||||||
|
await waitFor(element(by.id(`rooms-list-view-item-${ room }`))).toExist().withTimeout(6000);
|
||||||
|
await expect(element(by.id(`rooms-list-view-item-${ room }`))).toExist();
|
||||||
|
});
|
||||||
|
})
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue