From 1a63e808613277cd0c3f0ab6f23e888250a3cf5d Mon Sep 17 00:00:00 2001 From: Reinaldo Neto Date: Wed, 15 Sep 2021 13:44:53 -0300 Subject: [PATCH] Fix new server view --- app/i18n/locales/en.json | 3 +- app/stacks/OutsideStack.js | 16 +-------- app/views/NewServerView/ServerInput/index.js | 1 - app/views/NewServerView/index.js | 35 ++++++++++++++++---- e2e/helpers/app.js | 8 ++--- e2e/tests/assorted/07-changeserver.spec.js | 10 ++++-- e2e/tests/assorted/12-i18n.spec.js | 13 +++----- e2e/tests/onboarding/01-onboarding.spec.js | 23 ++++--------- 8 files changed, 50 insertions(+), 59 deletions(-) diff --git a/app/i18n/locales/en.json b/app/i18n/locales/en.json index 114478bb6..d64b28c2d 100644 --- a/app/i18n/locales/en.json +++ b/app/i18n/locales/en.json @@ -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" } \ No newline at end of file diff --git a/app/stacks/OutsideStack.js b/app/stacks/OutsideStack.js index f66e734fe..2a36fbb61 100644 --- a/app/stacks/OutsideStack.js +++ b/app/stacks/OutsideStack.js @@ -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 ( - {root === ROOT_OUTSIDE ? ( - - ) : null} ({ root: state.app.root }); -_OutsideStack.propTypes = { - root: PropTypes.string -}; - const OutsideStack = connect(mapStateToProps)(_OutsideStack); // OutsideStackModal diff --git a/app/views/NewServerView/ServerInput/index.js b/app/views/NewServerView/ServerInput/index.js index 6088e4ef6..f69eaade8 100644 --- a/app/views/NewServerView/ServerInput/index.js +++ b/app/views/NewServerView/ServerInput/index.js @@ -11,7 +11,6 @@ import I18n from '../../../i18n'; const styles = StyleSheet.create({ container: { zIndex: 1, - marginTop: 24, marginBottom: 32 }, inputContainer: { diff --git a/app/views/NewServerView/index.js b/app/views/NewServerView/index.js index 27422dec8..9feb5e7a8 100644 --- a/app/views/NewServerView/index.js +++ b/app/views/NewServerView/index.js @@ -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' > - {I18n.t('Join_your_workspace')} + + {I18n.t('Rocket_Chat')} + {I18n.t('Onboarding_subtitle')} { 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); diff --git a/e2e/tests/assorted/12-i18n.spec.js b/e2e/tests/assorted/12-i18n.spec.js index 1c4a6a9d5..54be6c49f 100644 --- a/e2e/tests/assorted/12-i18n.spec.js +++ b/e2e/tests/assorted/12-i18n.spec.js @@ -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(); // }); }); diff --git a/e2e/tests/onboarding/01-onboarding.spec.js b/e2e/tests/onboarding/01-onboarding.spec.js index a8cad8991..bdb0d06cd 100644 --- a/e2e/tests/onboarding/01-onboarding.spec.js +++ b/e2e/tests/onboarding/01-onboarding.spec.js @@ -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); });