Allow to create empty channel (#615)
This commit is contained in:
parent
c9bf599bcf
commit
f065bd05f2
|
@ -52,6 +52,19 @@ const styles = StyleSheet.create({
|
|||
}))
|
||||
/** @extends React.Component */
|
||||
export default class SelectedUsersView extends LoggedView {
|
||||
static options() {
|
||||
return {
|
||||
topBar: {
|
||||
rightButtons: [{
|
||||
id: 'create',
|
||||
text: I18n.t('Next'),
|
||||
testID: 'selected-users-view-submit',
|
||||
color: isAndroid ? '#FFF' : undefined
|
||||
}]
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
static propTypes = {
|
||||
componentId: PropTypes.string,
|
||||
rid: PropTypes.string,
|
||||
|
@ -94,27 +107,6 @@ export default class SelectedUsersView extends LoggedView {
|
|||
return false;
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
const { componentId, users } = this.props;
|
||||
if (prevProps.users.length !== users.length) {
|
||||
const { length } = users;
|
||||
const rightButtons = [];
|
||||
if (length > 0) {
|
||||
rightButtons.push({
|
||||
id: 'create',
|
||||
text: I18n.t('Next'),
|
||||
testID: 'selected-users-view-submit',
|
||||
color: isAndroid ? '#FFF' : undefined
|
||||
});
|
||||
}
|
||||
Navigation.mergeOptions(componentId, {
|
||||
topBar: {
|
||||
rightButtons
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
const { reset } = this.props;
|
||||
this.updateState.stop();
|
||||
|
|
|
@ -77,11 +77,9 @@ describe('Create room screen', () => {
|
|||
await element(by.id('select-users-view-item-rocket.cat')).tap();
|
||||
await waitFor(element(by.id('selected-user-rocket.cat'))).toBeVisible().withTimeout(5000);
|
||||
await expect(element(by.id('selected-user-rocket.cat'))).toBeVisible();
|
||||
await expect(element(by.id('selected-users-view-submit'))).toBeVisible();
|
||||
await element(by.id('selected-user-rocket.cat')).tap();
|
||||
await waitFor(element(by.id('selected-user-rocket.cat'))).toBeNotVisible().withTimeout(5000);
|
||||
await expect(element(by.id('selected-user-rocket.cat'))).toBeNotVisible();
|
||||
await expect(element(by.id('selected-users-view-submit'))).toBeNotVisible();
|
||||
await element(by.id('select-users-view-item-rocket.cat')).tap();
|
||||
await waitFor(element(by.id('selected-user-rocket.cat'))).toBeVisible().withTimeout(5000);
|
||||
});
|
||||
|
@ -113,20 +111,22 @@ describe('Create room screen', () => {
|
|||
});
|
||||
|
||||
it('should create public room', async() => {
|
||||
await element(by.id('create-channel-name')).replaceText(`public${ data.random }`);
|
||||
const room = `public${ data.random }`;
|
||||
await element(by.id('create-channel-name')).replaceText(room);
|
||||
await element(by.id('create-channel-type')).tap();
|
||||
await element(by.id('create-channel-submit')).tap();
|
||||
await waitFor(element(by.id('room-view'))).toBeVisible().withTimeout(60000);
|
||||
await expect(element(by.id('room-view'))).toBeVisible();
|
||||
await waitFor(element(by.text(`public${ data.random }`))).toBeVisible().withTimeout(60000);
|
||||
await expect(element(by.text(`public${ data.random }`))).toBeVisible();
|
||||
await waitFor(element(by.text(room))).toBeVisible().withTimeout(60000);
|
||||
await expect(element(by.text(room))).toBeVisible();
|
||||
await tapBack();
|
||||
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(2000);
|
||||
await waitFor(element(by.id(`rooms-list-view-item-public${ data.random }`))).toBeVisible().withTimeout(60000);
|
||||
await expect(element(by.id(`rooms-list-view-item-public${ data.random }`))).toBeVisible();
|
||||
await waitFor(element(by.id(`rooms-list-view-item-${ room }`))).toBeVisible().withTimeout(60000);
|
||||
await expect(element(by.id(`rooms-list-view-item-${ room }`))).toBeVisible();
|
||||
});
|
||||
|
||||
it('should create private room', async() => {
|
||||
const room = `private${ data.random }`;
|
||||
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(2000);
|
||||
await device.reloadReactNative();
|
||||
await element(by.id('rooms-list-view-create-channel')).tap();
|
||||
|
@ -137,18 +137,42 @@ describe('Create room screen', () => {
|
|||
await waitFor(element(by.id('selected-user-rocket.cat'))).toBeVisible().withTimeout(5000);
|
||||
await element(by.id('selected-users-view-submit')).tap();
|
||||
await waitFor(element(by.id('create-channel-view'))).toBeVisible().withTimeout(5000);
|
||||
await element(by.id('create-channel-name')).replaceText(`private${ data.random }`);
|
||||
await element(by.id('create-channel-name')).replaceText(room);
|
||||
await element(by.id('create-channel-submit')).tap();
|
||||
await waitFor(element(by.id('room-view'))).toBeVisible().withTimeout(60000);
|
||||
await expect(element(by.id('room-view'))).toBeVisible();
|
||||
await waitFor(element(by.text(`private${ data.random }`))).toBeVisible().withTimeout(60000);
|
||||
await expect(element(by.text(`private${ data.random }`))).toBeVisible();
|
||||
await waitFor(element(by.text(room))).toBeVisible().withTimeout(60000);
|
||||
await expect(element(by.text(room))).toBeVisible();
|
||||
await tapBack();
|
||||
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(2000);
|
||||
await element(by.id('rooms-list-view-search')).replaceText(`private${ data.random }`);
|
||||
await element(by.id('rooms-list-view-search')).replaceText(room);
|
||||
await sleep(2000);
|
||||
await waitFor(element(by.id(`rooms-list-view-item-private${ data.random }`))).toBeVisible().withTimeout(60000);
|
||||
await expect(element(by.id(`rooms-list-view-item-private${ data.random }`))).toBeVisible();
|
||||
await waitFor(element(by.id(`rooms-list-view-item-${ room }`))).toBeVisible().withTimeout(60000);
|
||||
await expect(element(by.id(`rooms-list-view-item-${ room }`))).toBeVisible();
|
||||
});
|
||||
|
||||
it('should create empty room', async() => {
|
||||
const room = `empty${ data.random }`;
|
||||
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(2000);
|
||||
await device.reloadReactNative();
|
||||
await element(by.id('rooms-list-view-create-channel')).tap();
|
||||
await waitFor(element(by.id('new-message-view'))).toBeVisible().withTimeout(2000);
|
||||
await element(by.id('new-message-view-create-channel')).tap();
|
||||
await waitFor(element(by.id('select-users-view'))).toBeVisible().withTimeout(2000);
|
||||
await element(by.id('selected-users-view-submit')).tap();
|
||||
await waitFor(element(by.id('create-channel-view'))).toBeVisible().withTimeout(5000);
|
||||
await element(by.id('create-channel-name')).replaceText(room);
|
||||
await element(by.id('create-channel-submit')).tap();
|
||||
await waitFor(element(by.id('room-view'))).toBeVisible().withTimeout(60000);
|
||||
await expect(element(by.id('room-view'))).toBeVisible();
|
||||
await waitFor(element(by.text(room))).toBeVisible().withTimeout(60000);
|
||||
await expect(element(by.text(room))).toBeVisible();
|
||||
await tapBack();
|
||||
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(2000);
|
||||
await element(by.id('rooms-list-view-search')).replaceText(room);
|
||||
await sleep(2000);
|
||||
await waitFor(element(by.id(`rooms-list-view-item-${ room }`))).toBeVisible().withTimeout(60000);
|
||||
await expect(element(by.id(`rooms-list-view-item-${ room }`))).toBeVisible();
|
||||
});
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue