[NEW[ First three tests passing on android
This commit is contained in:
parent
76fad38cb1
commit
cf1425da2a
|
@ -151,6 +151,7 @@ android {
|
|||
missingDimensionStrategy "RNNotifications.reactNativeVersion", "reactNative60" // See note below!
|
||||
}
|
||||
resValue "string", "rn_config_reader_custom_package", "chat.rocket.reactnative"
|
||||
testBuildType System.getProperty('testBuildType', 'debug')
|
||||
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ const styles = StyleSheet.create({
|
|||
const Content = React.memo(({
|
||||
title, subtitle, disabled, testID, left, right, color, theme, translateTitle, translateSubtitle, showActionIndicator, fontScale, alert
|
||||
}) => (
|
||||
<View style={[styles.container, disabled && styles.disabled, { height: BASE_HEIGHT * fontScale }]} testID={testID}>
|
||||
<View style={[styles.container, disabled && styles.disabled, { height: BASE_HEIGHT * fontScale }]} testID={testID} accessibilityLabel={title}>
|
||||
{left
|
||||
? (
|
||||
<View style={styles.leftContainer}>
|
||||
|
|
|
@ -43,7 +43,7 @@ const Content = React.memo((props) => {
|
|||
if (props.tmid && !props.msg) {
|
||||
content = <Text style={[styles.text, { color: themes[props.theme].bodyText }]}>{I18n.t('Sent_an_attachment')}</Text>;
|
||||
} else if (props.isEncrypted) {
|
||||
content = <Text style={[styles.textInfo, { color: themes[props.theme].auxiliaryText }]}>{I18n.t('Encrypted_message')}</Text>;
|
||||
content = <Text style={[styles.textInfo, { color: themes[props.theme].auxiliaryText }]} accessibilityLabel={I18n.t('Encrypted_message')}>{I18n.t('Encrypted_message')}</Text>;
|
||||
} else {
|
||||
const { baseUrl, user, onLinkPress } = useContext(MessageContext);
|
||||
content = (
|
||||
|
|
|
@ -16,7 +16,7 @@ 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);
|
||||
await waitFor(element(by.id('login-view'))).toBeVisible().withTimeout(4000);
|
||||
await expect(element(by.id('login-view'))).toBeVisible();
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ async function logout() {
|
|||
await waitFor(element(by.id('sidebar-settings'))).toBeVisible().withTimeout(2000);
|
||||
await element(by.id('sidebar-settings')).tap();
|
||||
await waitFor(element(by.id('settings-view'))).toBeVisible().withTimeout(2000);
|
||||
await element(by.type('UIScrollView')).atIndex(1).scrollTo('bottom');
|
||||
await element(by.type('android.widget.ScrollView')).atIndex(1).scrollTo('bottom');
|
||||
await element(by.id('settings-logout')).tap();
|
||||
const logoutAlertMessage = 'You will be logged out of this application.';
|
||||
await waitFor(element(by.text(logoutAlertMessage)).atIndex(0)).toExist().withTimeout(10000);
|
||||
|
@ -56,9 +56,9 @@ async function mockMessage(message, isThread = false) {
|
|||
await element(by.id(input)).tap();
|
||||
await element(by.id(input)).typeText(`${ data.random }${ message }`);
|
||||
await element(by.id('messagebox-send-message')).tap();
|
||||
await waitFor(element(by.label(`${ data.random }${ message }`))).toExist().withTimeout(60000);
|
||||
await expect(element(by.label(`${ data.random }${ message }`))).toExist();
|
||||
await element(by.label(`${ data.random }${ message }`)).atIndex(0).tap();
|
||||
await waitFor(element(by.text(`${ data.random }${ message }`))).toExist().withTimeout(60000);
|
||||
await expect(element(by.text(`${ data.random }${ message }`))).toExist();
|
||||
await element(by.text(`${ data.random }${ message }`)).atIndex(0).tap();
|
||||
};
|
||||
|
||||
async function starMessage(message){
|
||||
|
|
|
@ -130,8 +130,8 @@ describe('E2E Encryption', () => {
|
|||
it('should have items', async() => {
|
||||
await waitFor(element(by.id('e2e-encryption-security-view'))).toBeVisible().withTimeout(2000);
|
||||
await expect(element(by.id('e2e-encryption-security-view-password'))).toExist();
|
||||
await expect(element(by.id('e2e-encryption-security-view-change-password').and(by.text('Save Changes')))).toExist();
|
||||
await expect(element(by.id('e2e-encryption-security-view-reset-key').and(by.text('Reset E2E Key')))).toExist();
|
||||
await expect(element(by.id('e2e-encryption-security-view-change-password').and(by.label('Save Changes')))).toExist();
|
||||
await expect(element(by.id('e2e-encryption-security-view-reset-key').and(by.label('Reset E2E Key')))).toExist();
|
||||
});
|
||||
})
|
||||
|
||||
|
@ -141,7 +141,7 @@ describe('E2E Encryption', () => {
|
|||
await element(by.id('e2e-encryption-security-view-change-password')).tap();
|
||||
await waitFor(element(by.text('Are you sure?'))).toExist().withTimeout(2000);
|
||||
await expect(element(by.text('Make sure you\'ve saved it carefully somewhere else.'))).toExist();
|
||||
await element(by.text('Yes, change it').and(by.type('_UIAlertControllerActionView'))).tap();
|
||||
await element(by.text('Yes, change it').and(by.type('android.widget.Button'))).tap();
|
||||
await waitForToast();
|
||||
});
|
||||
|
||||
|
@ -156,7 +156,7 @@ describe('E2E Encryption', () => {
|
|||
await element(by.id('sidebar-chats')).tap();
|
||||
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(2000);
|
||||
await navigateToRoom(room);
|
||||
await waitFor(element(by.label(`${ data.random }message`)).atIndex(0)).toExist().withTimeout(2000);
|
||||
await waitFor(element(by.text(`${ data.random }message`)).atIndex(0)).toExist().withTimeout(2000);
|
||||
});
|
||||
|
||||
it('should logout, login and messages should be encrypted', async() => {
|
||||
|
@ -166,21 +166,21 @@ describe('E2E Encryption', () => {
|
|||
await navigateToLogin();
|
||||
await login(testuser.username, testuser.password);
|
||||
await navigateToRoom(room);
|
||||
await waitFor(element(by.label(`${ data.random }message`)).atIndex(0)).not.toExist().withTimeout(2000);
|
||||
await expect(element(by.label('Encrypted message')).atIndex(0)).toExist();
|
||||
await waitFor(element(by.text(`${ data.random }message`)).atIndex(0)).not.toExist().withTimeout(2000);
|
||||
await expect(element(by.text('Encrypted message')).atIndex(0)).toExist();
|
||||
});
|
||||
|
||||
it('should enter new e2e password and messages should be decrypted', async() => {
|
||||
await tapBack();
|
||||
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(2000);
|
||||
await waitFor(element(by.id('listheader-encryption').withDescendant(by.label('Enter Your E2E Password')))).toBeVisible().withTimeout(2000);
|
||||
await element(by.id('listheader-encryption').withDescendant(by.label('Enter Your E2E Password'))).tap();
|
||||
await waitFor(element(by.id('listheader-encryption').withDescendant(by.text('Enter Your E2E Password')))).toBeVisible().withTimeout(2000);
|
||||
await element(by.id('listheader-encryption').withDescendant(by.text('Enter Your E2E Password'))).tap();
|
||||
await waitFor(element(by.id('e2e-enter-your-password-view'))).toBeVisible().withTimeout(2000);
|
||||
await element(by.id('e2e-enter-your-password-view-password')).typeText(newPassword);
|
||||
await element(by.id('e2e-enter-your-password-view-confirm')).tap();
|
||||
await waitFor(element(by.id('listheader-encryption'))).not.toExist().withTimeout(10000);
|
||||
await navigateToRoom(room);
|
||||
await waitFor(element(by.label(`${ data.random }message`)).atIndex(0)).toExist().withTimeout(2000);
|
||||
await waitFor(element(by.text(`${ data.random }message`)).atIndex(0)).toExist().withTimeout(2000);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -194,15 +194,15 @@ describe('E2E Encryption', () => {
|
|||
await element(by.id('e2e-encryption-security-view-reset-key').and(by.label('Reset E2E Key'))).tap();
|
||||
await waitFor(element(by.text('Are you sure?'))).toExist().withTimeout(2000);
|
||||
await expect(element(by.text('You\'re going to be logged out.'))).toExist();
|
||||
await element(by.label('Yes, reset it').and(by.type('UILabel'))).tap();
|
||||
await element(by.text('Yes, reset it').and(by.type('android.widget.Button'))).tap();
|
||||
await sleep(2000)
|
||||
await waitFor(element(by.text('OK').and(by.type('android.widget.Button')))).toExist().withTimeout(2000);
|
||||
await element(by.text('OK').and(by.type('android.widget.Button'))).tap();
|
||||
await waitFor(element(by.id('workspace-view'))).toBeVisible().withTimeout(10000);
|
||||
await waitFor(element(by.text('You\'ve been logged out by the server. Please log in again.'))).toExist().withTimeout(2000);
|
||||
await element(by.label('OK').and(by.type('_UIAlertControllerActionView'))).tap();
|
||||
await element(by.id('workspace-view-login')).tap();
|
||||
await waitFor(element(by.id('login-view'))).toBeVisible().withTimeout(2000);
|
||||
await login(testuser.username, testuser.password);
|
||||
await waitFor(element(by.id('listheader-encryption').withDescendant(by.label('Save Your Encryption Password')))).toBeVisible().withTimeout(2000);
|
||||
await waitFor(element(by.id('listheader-encryption').withDescendant(by.text('Save Your Encryption Password')))).toBeVisible().withTimeout(2000);
|
||||
})
|
||||
});
|
||||
});
|
||||
|
@ -231,6 +231,7 @@ describe('E2E Encryption', () => {
|
|||
await element(by.id('register-view-username')).replaceText(data.registeringUser.username);
|
||||
await element(by.id('register-view-email')).replaceText(data.registeringUser.email);
|
||||
await element(by.id('register-view-password')).typeText(data.registeringUser.password);
|
||||
element(by.type('android.widget.ScrollView')).atIndex(1).scrollTo('bottom');
|
||||
await element(by.id('register-view-submit')).tap();
|
||||
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(60000);
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ describe('Broadcast room', () => {
|
|||
});
|
||||
|
||||
it('should have the message created earlier', async() => {
|
||||
await waitFor(element(by.label(`${ data.random }message`))).toExist().withTimeout(60000);
|
||||
await waitFor(element(by.text(`${ data.random }message`))).toExist().withTimeout(60000);
|
||||
});
|
||||
|
||||
it('should have reply button', async() => {
|
||||
|
|
|
@ -78,7 +78,8 @@ describe('Profile screen', () => {
|
|||
it('should change name and username', async() => {
|
||||
await element(by.id('profile-view-name')).replaceText(`${ profileChangeUser.username }new`);
|
||||
await element(by.id('profile-view-username')).typeText(`${ profileChangeUser.username }new`);
|
||||
await element(by.type('UIScrollView')).atIndex(1).swipe('up');
|
||||
await device.pressBack();
|
||||
await element(by.type('android.widget.ScrollView')).atIndex(1).swipe('up');
|
||||
await element(by.id('profile-view-submit')).tap();
|
||||
await waitForToast();
|
||||
});
|
||||
|
@ -87,12 +88,13 @@ describe('Profile screen', () => {
|
|||
await element(by.id('profile-view-email')).replaceText(`mobile+profileChangesNew${ data.random }@rocket.chat`);
|
||||
await element(by.id('profile-view-new-password')).replaceText(`${ profileChangeUser.password }new`);
|
||||
await element(by.id('profile-view-submit')).tap();
|
||||
await element(by.type('_UIAlertControllerTextField')).typeText(`${ profileChangeUser.password }\n`)
|
||||
await element(by.type('android.widget.EditText')).typeText(`${ profileChangeUser.password }\n`);
|
||||
await element(by.label('SAVE')).tap();
|
||||
await waitForToast();
|
||||
});
|
||||
|
||||
it('should reset avatar', async() => {
|
||||
await element(by.type('UIScrollView')).atIndex(1).swipe('up');
|
||||
await element(by.type('android.widget.ScrollView')).atIndex(1).swipe('up');
|
||||
await element(by.id('profile-view-reset-avatar')).tap();
|
||||
await waitForToast();
|
||||
});
|
||||
|
|
22
package.json
22
package.json
|
@ -17,8 +17,10 @@
|
|||
"generate-source-maps-ios": "react-native bundle --platform ios --dev false --entry-file index.js --bundle-output ios-release.bundle --sourcemap-output ios-release.bundle.map",
|
||||
"generate-source-maps-android": "bugsnag-sourcemaps",
|
||||
"postinstall": "patch-package && jetify",
|
||||
"detoxAD": "cd android && ./gradlew assembleExperimentalPlayDebugAndroidTest && cd .. && detox test -c android.experimental.play.emu.debug",
|
||||
"detoxAR": "cd android && ./gradlew assembleExperimentalPlayReleaseAndroidTest && cd .. && detox test -c android.experimental.play.emu.release"
|
||||
"detoxAD": "detox build -c android.experimental.play.dev.debug && detox test -c android.experimental.play.dev.debug",
|
||||
"detoxAR": "detox build -c android.experimental.play.dev.release && cd .. && detox test -c android.experimental.play.dev.release",
|
||||
"detoxADEmu": "detox build -c android.experimental.play.emu.debug && detox test -c android.experimental.play.emu.debug",
|
||||
"detoxAREmu": "detox build -c android.experimental.play.emu.release && cd .. && detox test -c android.experimental.play.emu.release"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
|
@ -232,13 +234,25 @@
|
|||
"device": "Pixel_API_28_AOSP",
|
||||
"type": "android.emulator",
|
||||
"binaryPath": "android/app/build/outputs/apk/experimentalPlay/debug/app-experimental-play-debug.apk",
|
||||
"build": "cd android && ./gradlew app:assembleExperimentalPlayDebug app:assembleAndroidTest -DtestBuildType=debug && cd .."
|
||||
"build": "cd android && ./gradlew app:assembleExperimentalPlayDebug app:assembleExperimentalPlayDebugAndroidTest -DtestBuildType=debug && cd .."
|
||||
},
|
||||
"android.experimental.play.emu.release": {
|
||||
"device": "Pixel_API_28_AOSP",
|
||||
"type": "android.emulator",
|
||||
"binaryPath": "android/app/build/outputs/apk/experimentalPlay/release/app-experimental-play-release.apk",
|
||||
"build": "cd android && ./gradlew app:assembleExperimentalPlayRelease app:assembleAndroidTest -DtestBuildType=release && cd .."
|
||||
"build": "cd android && ./gradlew app:assembleExperimentalPlayRelease app:assembleExperimentalPlayReleaseAndroidTest -DtestBuildType=release && cd .."
|
||||
},
|
||||
"android.experimental.play.dev.debug": {
|
||||
"device": "CVH7N15C14003503",
|
||||
"type": "android.attached",
|
||||
"binaryPath": "android/app/build/outputs/apk/experimentalPlay/debug/app-experimental-play-debug.apk",
|
||||
"build": "cd android && ./gradlew app:assembleExperimentalPlayDebug app:assembleExperimentalPlayDebugAndroidTest -DtestBuildType=debug && cd .."
|
||||
},
|
||||
"android.experimental.play.dev.release": {
|
||||
"device": "CVH7N15C14003503",
|
||||
"type": "android.attached",
|
||||
"binaryPath": "android/app/build/outputs/apk/experimentalPlay/release/app-experimental-play-release.apk",
|
||||
"build": "cd android && ./gradlew app:assembleExperimentalPlayRelease app:assembleExperimentalPlayReleaseAndroidTest -DtestBuildType=release && cd .."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue