Fix new server view
This commit is contained in:
parent
6008b9cacb
commit
1a63e80861
|
@ -772,5 +772,6 @@
|
|||
"Converting_Team_To_Channel": "Converting Team to Channel",
|
||||
"Select_Team_Channels_To_Delete": "Select the Team’s Channels you would like to delete, the ones you do not select will be moved to the Workspace. \n\nNotice that public Channels will be public and visible to everyone.",
|
||||
"You_are_converting_the_team": "You are converting this Team to a Channel",
|
||||
"creating_discussion": "creating discussion"
|
||||
"creating_discussion": "creating discussion",
|
||||
"Rocket_Chat": "Rocket.Chat"
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
import React from 'react';
|
||||
import { createStackNavigator } from '@react-navigation/stack';
|
||||
import { connect } from 'react-redux';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import { ThemeContext } from '../theme';
|
||||
import {
|
||||
|
@ -9,7 +8,6 @@ import {
|
|||
} from '../utils/navigation';
|
||||
|
||||
// Outside Stack
|
||||
import OnboardingView from '../views/OnboardingView';
|
||||
import NewServerView from '../views/NewServerView';
|
||||
import WorkspaceView from '../views/WorkspaceView';
|
||||
import LoginView from '../views/LoginView';
|
||||
|
@ -17,22 +15,14 @@ import ForgotPasswordView from '../views/ForgotPasswordView';
|
|||
import RegisterView from '../views/RegisterView';
|
||||
import LegalView from '../views/LegalView';
|
||||
import AuthenticationWebView from '../views/AuthenticationWebView';
|
||||
import { ROOT_OUTSIDE } from '../actions/app';
|
||||
|
||||
// Outside
|
||||
const Outside = createStackNavigator();
|
||||
const _OutsideStack = ({ root }) => {
|
||||
const _OutsideStack = () => {
|
||||
const { theme } = React.useContext(ThemeContext);
|
||||
|
||||
return (
|
||||
<Outside.Navigator screenOptions={{ ...defaultHeader, ...themedHeader(theme), ...StackAnimation }}>
|
||||
{root === ROOT_OUTSIDE ? (
|
||||
<Outside.Screen
|
||||
name='OnboardingView'
|
||||
component={OnboardingView}
|
||||
options={OnboardingView.navigationOptions}
|
||||
/>
|
||||
) : null}
|
||||
<Outside.Screen
|
||||
name='NewServerView'
|
||||
component={NewServerView}
|
||||
|
@ -71,10 +61,6 @@ const mapStateToProps = state => ({
|
|||
root: state.app.root
|
||||
});
|
||||
|
||||
_OutsideStack.propTypes = {
|
||||
root: PropTypes.string
|
||||
};
|
||||
|
||||
const OutsideStack = connect(mapStateToProps)(_OutsideStack);
|
||||
|
||||
// OutsideStackModal
|
||||
|
|
|
@ -11,7 +11,6 @@ import I18n from '../../../i18n';
|
|||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
zIndex: 1,
|
||||
marginTop: 24,
|
||||
marginBottom: 32
|
||||
},
|
||||
inputContainer: {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import {
|
||||
Text, Keyboard, StyleSheet, View, BackHandler
|
||||
Text, Keyboard, StyleSheet, View, BackHandler, Image
|
||||
} from 'react-native';
|
||||
import { connect } from 'react-redux';
|
||||
import { Base64 } from 'js-base64';
|
||||
|
@ -30,11 +30,30 @@ import ServerInput from './ServerInput';
|
|||
import { sanitizeLikeString } from '../../lib/database/utils';
|
||||
import SSLPinning from '../../utils/sslPinning';
|
||||
import RocketChat from '../../lib/rocketchat';
|
||||
import { isTablet } from '../../utils/deviceInfo';
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
onboarding: {
|
||||
alignSelf: 'center',
|
||||
marginTop: isTablet ? 0 : 96,
|
||||
marginBottom: 25,
|
||||
maxHeight: 150,
|
||||
width: 100,
|
||||
height: 100
|
||||
},
|
||||
title: {
|
||||
...sharedStyles.textBold,
|
||||
fontSize: 22
|
||||
letterSpacing: 0,
|
||||
fontSize: 22,
|
||||
alignSelf: 'center',
|
||||
marginBottom: 8,
|
||||
lineHeight: 32
|
||||
},
|
||||
subtitle: {
|
||||
...sharedStyles.textRegular,
|
||||
fontSize: 16,
|
||||
alignSelf: 'center',
|
||||
marginBottom: 41
|
||||
},
|
||||
certificatePicker: {
|
||||
marginBottom: 32,
|
||||
|
@ -52,7 +71,7 @@ const styles = StyleSheet.create({
|
|||
description: {
|
||||
...sharedStyles.textRegular,
|
||||
fontSize: 14,
|
||||
textAlign: 'left',
|
||||
textAlign: 'center',
|
||||
marginBottom: 24
|
||||
},
|
||||
connectButton: {
|
||||
|
@ -61,9 +80,9 @@ const styles = StyleSheet.create({
|
|||
});
|
||||
|
||||
class NewServerView extends React.Component {
|
||||
static navigationOptions = () => ({
|
||||
title: I18n.t('Workspaces')
|
||||
})
|
||||
static navigationOptions = {
|
||||
headerShown: false
|
||||
};
|
||||
|
||||
static propTypes = {
|
||||
navigation: PropTypes.object,
|
||||
|
@ -321,7 +340,9 @@ class NewServerView extends React.Component {
|
|||
keyboardShouldPersistTaps='never'
|
||||
>
|
||||
<FormContainerInner>
|
||||
<Text style={[styles.title, { color: themes[theme].titleText }]}>{I18n.t('Join_your_workspace')}</Text>
|
||||
<Image style={styles.onboarding} source={require('../../static/images/logo.png')} fadeDuration={0} resizeMode='stretch' />
|
||||
<Text style={[styles.title, { color: themes[theme].titleText }]}>{I18n.t('Rocket_Chat')}</Text>
|
||||
<Text style={[styles.subtitle, { color: themes[theme].controlText }]}>{I18n.t('Onboarding_subtitle')}</Text>
|
||||
<ServerInput
|
||||
text={text}
|
||||
theme={theme}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
const data = require('../data');
|
||||
|
||||
async function navigateToWorkspace(server = data.server) {
|
||||
await waitFor(element(by.id('onboarding-view'))).toBeVisible().withTimeout(10000);
|
||||
await element(by.id('join-workspace')).tap();
|
||||
await waitFor(element(by.id('new-server-view'))).toBeVisible().withTimeout(60000);
|
||||
await element(by.id('new-server-view-input')).typeText(`${ server }\n`);
|
||||
await waitFor(element(by.id('workspace-view'))).toBeVisible().withTimeout(60000);
|
||||
|
@ -10,7 +8,6 @@ async function navigateToWorkspace(server = data.server) {
|
|||
}
|
||||
|
||||
async function navigateToLogin(server) {
|
||||
await waitFor(element(by.id('onboarding-view'))).toBeVisible().withTimeout(20000);
|
||||
await navigateToWorkspace(server);
|
||||
await element(by.id('workspace-view-login')).tap();
|
||||
await waitFor(element(by.id('login-view'))).toBeVisible().withTimeout(2000);
|
||||
|
@ -18,7 +15,6 @@ async function navigateToLogin(server) {
|
|||
}
|
||||
|
||||
async function navigateToRegister(server) {
|
||||
await waitFor(element(by.id('onboarding-view'))).toBeVisible().withTimeout(20000);
|
||||
await navigateToWorkspace(server);
|
||||
await element(by.id('workspace-view-register')).tap();
|
||||
await waitFor(element(by.id('register-view'))).toBeVisible().withTimeout(2000);
|
||||
|
@ -44,8 +40,8 @@ async function logout() {
|
|||
await waitFor(element(by.text(logoutAlertMessage)).atIndex(0)).toExist().withTimeout(10000);
|
||||
await expect(element(by.text(logoutAlertMessage)).atIndex(0)).toExist();
|
||||
await element(by.text('Logout')).tap();
|
||||
await waitFor(element(by.id('onboarding-view'))).toBeVisible().withTimeout(10000);
|
||||
await expect(element(by.id('onboarding-view'))).toBeVisible();
|
||||
await waitFor(element(by.id('new-server-view'))).toBeVisible().withTimeout(10000);
|
||||
await expect(element(by.id('new-server-view'))).toBeVisible();
|
||||
}
|
||||
|
||||
async function mockMessage(message, isThread = false) {
|
||||
|
|
|
@ -3,7 +3,7 @@ const { navigateToLogin, login, checkServer } = require('../../helpers/app');
|
|||
|
||||
const reopenAndCheckServer = async(server) => {
|
||||
await device.launchApp({ permissions: { notifications: 'YES' } });
|
||||
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(6000);
|
||||
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(10000);
|
||||
await checkServer(server);
|
||||
};
|
||||
|
||||
|
@ -15,11 +15,15 @@ describe('Change server', () => {
|
|||
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(10000);
|
||||
});
|
||||
|
||||
it('should login to server, add new server, close the app, open the app and show previous logged server', async() => {
|
||||
it('should open the dropdown button, have the server add button and create workspace button', async() => {
|
||||
await element(by.id('rooms-list-header-server-dropdown-button')).tap();
|
||||
await waitFor(element(by.id('rooms-list-header-server-dropdown'))).toBeVisible().withTimeout(5000);
|
||||
await element(by.id('rooms-list-header-server-add')).tap();
|
||||
await waitFor(element(by.id('rooms-list-header-server-add'))).toBeVisible().withTimeout(5000);
|
||||
await waitFor(element(by.id('rooms-list-header-create-workspace-button'))).toBeVisible().withTimeout(5000);
|
||||
});
|
||||
|
||||
it('should login to server, add new server, close the app, open the app and show previous logged server', async() => {
|
||||
await element(by.id('rooms-list-header-server-add')).tap();
|
||||
await waitFor(element(by.id('new-server-view'))).toBeVisible().withTimeout(6000);
|
||||
await element(by.id('new-server-view-input')).typeText(`${ data.alternateServer }\n`);
|
||||
await waitFor(element(by.id('workspace-view'))).toBeVisible().withTimeout(10000);
|
||||
|
|
|
@ -28,9 +28,8 @@ describe('i18n', () => {
|
|||
},
|
||||
delete: true
|
||||
});
|
||||
await waitFor(element(by.id('onboarding-view'))).toBeVisible().withTimeout(20000);
|
||||
await expect(element(by.id('join-workspace').and(by.label('Join a workspace')))).toBeVisible();
|
||||
await expect(element(by.id('create-workspace-button').and(by.label('Create a new workspace')))).toBeVisible();
|
||||
await waitFor(element(by.id('new-server-view'))).toBeVisible().withTimeout(20000);
|
||||
await expect(element(by.id('new-server-view-open').and(by.label('Join our open workspace')))).toBeVisible();
|
||||
});
|
||||
|
||||
it('OS set to unavailable language and fallback to \'en\'', async() => {
|
||||
|
@ -41,9 +40,8 @@ describe('i18n', () => {
|
|||
locale: 'es-MX'
|
||||
}
|
||||
});
|
||||
await waitFor(element(by.id('onboarding-view'))).toBeVisible().withTimeout(20000);
|
||||
await expect(element(by.id('join-workspace').and(by.label('Join a workspace')))).toBeVisible();
|
||||
await expect(element(by.id('create-workspace-button').and(by.label('Create a new workspace')))).toBeVisible();
|
||||
await waitFor(element(by.id('new-server-view'))).toBeVisible().withTimeout(20000);
|
||||
await expect(element(by.id('new-server-view-open').and(by.label('Join our open workspace')))).toBeVisible();
|
||||
});
|
||||
|
||||
/**
|
||||
|
@ -58,9 +56,6 @@ describe('i18n', () => {
|
|||
// locale: "nl"
|
||||
// }
|
||||
// });
|
||||
// await waitFor(element(by.id('onboarding-view'))).toBeVisible().withTimeout(20000);
|
||||
// await expect(element(by.id('join-workspace').and(by.label('Word lid van een werkruimte')))).toBeVisible();
|
||||
// await expect(element(by.id('create-workspace-button').and(by.label('Een nieuwe werkruimte aanmaken')))).toBeVisible();
|
||||
// });
|
||||
});
|
||||
|
||||
|
|
|
@ -3,20 +3,16 @@ const data = require('../../data');
|
|||
describe('Onboarding', () => {
|
||||
before(async() => {
|
||||
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
|
||||
await waitFor(element(by.id('onboarding-view'))).toBeVisible().withTimeout(20000);
|
||||
await waitFor(element(by.id('new-server-view'))).toBeVisible().withTimeout(20000);
|
||||
});
|
||||
|
||||
describe('Render', () => {
|
||||
it('should have onboarding screen', async() => {
|
||||
await expect(element(by.id('onboarding-view'))).toBeVisible();
|
||||
it('should have onboarding screen as New Server View', async() => {
|
||||
await expect(element(by.id('new-server-view'))).toBeVisible();
|
||||
});
|
||||
|
||||
it('should have "Join a workspace"', async() => {
|
||||
await expect(element(by.id('join-workspace'))).toBeVisible();
|
||||
});
|
||||
|
||||
it('should have "Create a new workspace"', async() => {
|
||||
await expect(element(by.id('create-workspace-button'))).toBeVisible();
|
||||
it('should have "Join our open workspace"', async() => {
|
||||
await expect(element(by.id('new-server-view-open'))).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -25,11 +21,6 @@ describe('Onboarding', () => {
|
|||
// // webviews are not supported by detox: https://github.com/wix/detox/issues/136#issuecomment-306591554
|
||||
// });
|
||||
|
||||
it('should navigate to join a workspace', async() => {
|
||||
await element(by.id('join-workspace')).tap();
|
||||
await waitFor(element(by.id('new-server-view'))).toBeVisible().withTimeout(60000);
|
||||
});
|
||||
|
||||
it('should enter an invalid server and get error', async() => {
|
||||
await element(by.id('new-server-view-input')).typeText('invalidtest\n');
|
||||
const errorText = 'Oops!';
|
||||
|
@ -44,9 +35,7 @@ describe('Onboarding', () => {
|
|||
|
||||
it('should enter a valid server without login services and navigate to login', async() => {
|
||||
await device.launchApp({ newInstance: true });
|
||||
await waitFor(element(by.id('onboarding-view'))).toBeVisible().withTimeout(2000);
|
||||
await element(by.id('join-workspace')).tap();
|
||||
await waitFor(element(by.id('new-server-view'))).toBeVisible().withTimeout(60000);
|
||||
await waitFor(element(by.id('new-server-view'))).toBeVisible().withTimeout(5000);
|
||||
await element(by.id('new-server-view-input')).typeText(`${ data.server }\n`);
|
||||
await waitFor(element(by.id('workspace-view'))).toBeVisible().withTimeout(60000);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue