Compare commits

...

105 Commits

Author SHA1 Message Date
Anant Bhasin 231863662d save npm cache 2021-08-26 18:33:32 +00:00
Anant Bhasin 406d21694e workspace attachment 2021-08-26 09:18:40 +00:00
Anant Bhasin fa1252c210 Attach workspace 2021-08-25 20:17:02 +00:00
Anant Bhasin 155ab35beb Run emu in tests 2021-08-25 19:51:58 +00:00
Anant Bhasin d0f28377a8 Merge branch 'detoxRunner' of https://github.com/aKn1ghtOut/Rocket.Chat.ReactNative into circleciForDetoxAndroid 2021-08-25 19:50:44 +00:00
Anant Bhasin 79bffeffd1 case sensitive device name 2021-08-25 18:59:56 +00:00
Anant Bhasin ae18f94a14 Install yarn in test image 2021-08-25 18:35:06 +00:00
Anant Bhasin e7aa883849 Node already installed 2021-08-25 18:21:39 +00:00
Anant Bhasin ccb495d155 Gradle Java clean before build 2021-08-25 16:39:17 +00:00
Anant Bhasin 452c9816b7 Resource class for build 2021-08-25 15:35:27 +00:00
Anant Bhasin 9514ac6219 Merge branch 'circleciForDetoxAndroid' of https://github.com/aKn1ghtOut/Rocket.Chat.ReactNative into circleciForDetoxAndroid 2021-08-25 15:33:43 +00:00
Anant Bhasin 1a5720a119 Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat.ReactNative into circleciForDetoxAndroid 2021-08-21 11:47:26 +00:00
Anant Bhasin b708047c0b Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat.ReactNative into detoxRunner 2021-08-21 11:46:37 +00:00
Anant Bhasin beadac063c Merge branch 'detoxRunner' of https://github.com/aKn1ghtOut/Rocket.Chat.ReactNative into circleciForDetoxAndroid 2021-08-21 11:40:32 +00:00
Anant Bhasin 3e029e4b7f Code Cleaning 2021-08-17 18:05:45 +00:00
Anant Bhasin b6ad070ce6 CircleCI config + FIXMEs 2021-08-11 01:03:58 +05:30
Anant Bhasin ed8e1fb284 Correct Circle Branched config 2021-08-10 20:32:41 +05:30
Anant Bhasin 4fa28efcdb split branches 2021-08-10 20:30:58 +05:30
Anant Bhasin be01ba574d Split up gradle tasks for low memory 2021-08-06 15:12:04 +05:30
Anant Bhasin 9ce1625633 Correct Command 2021-08-05 14:04:41 +05:30
Anant Bhasin 56c5687fa6 Update Config 2021-08-05 13:58:59 +05:30
Anant Bhasin 70bd757d8b correct folder 2021-08-05 13:20:50 +05:30
Anant Bhasin 94c874ca85 Correct Command 2021-08-05 13:00:06 +05:30
Anant Bhasin 02a9090d96 Split bundler from gradle 2021-08-05 11:54:37 +05:30
Anant Bhasin aedebc2fb7 Increase CircleCI no output timeout limit 2021-08-04 22:32:17 +05:30
Anant Bhasin 9c57ba9d11 Metroo Config for CircleCI E2E 2021-08-04 22:10:09 +05:30
Anant Bhasin f66a74c994 Lint fix 2021-08-04 16:05:58 +05:30
Anant Bhasin 73dc72357c Lint fix 2021-08-04 16:02:44 +05:30
Anant Bhasin edcc665a29 CI Setup 2021-08-04 15:59:58 +05:30
Anant Bhasin 7831728b16 Tests Ready for Review. 2021-08-04 15:58:16 +05:30
Anant Bhasin 2d765eea77 replaceText where usable 2021-08-03 13:28:30 +05:30
Diego Mello df6f85e940
Merge branch 'develop' into detoxRunner 2021-08-02 11:27:16 -03:00
Anant Bhasin 52342540f4 Ready for review 2021-07-27 03:24:31 +05:30
Anant Bhasin 76bf7ac571 Lint Fix 2021-07-25 03:10:57 +05:30
Anant Bhasin 5fc9872f9e Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat.ReactNative into detoxRunner 2021-07-25 02:49:19 +05:30
Anant Bhasin 8da3ed6022 Abstraction and Improvement 2021-07-25 02:39:53 +05:30
Anant Bhasin 54ac5db64c Storyshot update 2021-07-21 15:17:51 +05:30
Anant Bhasin 0182c0efd2 Lint and incremental 2021-07-21 15:03:16 +05:30
Anant Bhasin 047d4e5889 Lint fix 2021-07-16 02:29:16 +05:30
Anant Bhasin 4cc3d8a26b Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat.ReactNative into detoxRunner 2021-07-16 02:01:14 +05:30
Anant Bhasin 2aab5c35e1 i18n final fix 2021-07-14 18:17:20 +05:30
Anant Bhasin 8e004ea5c8 Skip platform language tests on Detox 2021-07-04 13:47:10 +05:30
Anant Bhasin 94fa286bcb by.label to by.text 2021-06-30 18:39:14 +05:30
Anant Bhasin 0465f0ae87 Cleaned up code. Implemented proper abstraction 2021-06-28 02:17:57 +05:30
Anant Bhasin eb8fb69639 Decreasing android input flakiness 2021-06-24 02:30:26 +05:30
Anant Bhasin bb6e19c860 incremental 2021-06-24 00:55:36 +05:30
Anant Bhasin 523647b42f i18n tests working on Android, and improving code 2021-06-24 00:36:55 +05:30
Anant Bhasin 60768fced1 Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat.ReactNative into detoxRunner 2021-06-23 19:13:26 +05:30
Anant Bhasin 39b1f9e7bc accessibilityLabel fix for RoomInfo 2021-06-15 15:49:31 +05:30
Anant Bhasin 4b91da0871 Room Info passing 2021-06-15 15:49:11 +05:30
Anant Bhasin 2448287200 Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat.ReactNative into detoxRunner 2021-06-15 01:54:36 +05:30
Anant Bhasin 8b4d2ec152 Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat.ReactNative into detoxRunner 2021-06-11 17:33:52 +05:30
Anant Bhasin 3b42e13489 [ANDROID] AccessibilityLabels and helper fns 2021-06-11 02:20:11 +05:30
Anant Bhasin 1f4920f873 [FIX] Discussions tests for android 2021-06-10 22:11:34 +05:30
Anant Bhasin 3ce92798a2 Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat.ReactNative into detoxRunner 2021-06-10 00:06:34 +05:30
Anant Bhasin 25faeeb357 lgtm fix 2021-06-09 21:30:58 +05:30
Anant Bhasin 4ee889e889 Room actions tests working 2021-06-09 21:30:01 +05:30
Anant Bhasin 97baaa4241 More tests working on android 2021-06-09 01:53:48 +05:30
Anant Bhasin 095f39d857 Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat.ReactNative into detoxRunner 2021-06-06 21:43:26 +05:30
Anant Bhasin f47082bbe1 onboarding tests passing 2021-06-06 21:40:12 +05:30
Anant Bhasin 13d07d5ee3 Deeplinking test working 2021-06-05 21:46:57 +05:30
Anant Bhasin 40dae23b61 platformTypes imort fix 2021-06-05 20:21:46 +05:30
Anant Bhasin ec22d9446a platform dependent component types 2021-06-04 16:38:12 +05:30
Anant Bhasin af1de5711b Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat.ReactNative into detoxRunner 2021-06-02 17:53:24 +05:30
Anant Bhasin 1d08b2c8c9 2 Test files remaining in assorted 2021-06-02 01:37:57 +05:30
Anant Bhasin bfc0731fdf Five testing files working.
App erring while leaving room
2021-06-01 21:27:24 +05:30
Anant Bhasin e31ae60bb4 Profile tests passing. Fixed 2021-06-01 01:07:09 +05:30
Anant Bhasin cf1425da2a [NEW[ First three tests passing on android 2021-05-31 22:09:32 +05:30
Anant Bhasin 76fad38cb1 test scripts 2021-05-29 15:56:36 +05:30
Anant Bhasin 4010b52c3c routine 2021-05-28 21:35:28 +05:30
Anant Bhasin 40615a81ea Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat.ReactNative into detoxRunner 2021-05-28 21:28:00 +05:30
Anant Bhasin 76ff9874e2 building release version for the tests 2021-05-28 21:26:15 +05:30
Anant Bhasin cdf64ab09b Progress 2021-05-27 02:44:05 +05:30
Anant Bhasin 6063add9ae Merge branch 'develop' into detoxRunner 2021-05-19 10:58:14 +05:30
Anant Bhasin f6ab1dda62 Making tests work 2021-04-13 15:37:08 +05:30
Anant Bhasin 12cf327754 Start RN debug server earlier 2021-04-10 02:00:08 +05:30
Diego Mello 13bf3b7601
Merge branch 'develop' into detoxRunner 2021-04-09 17:07:35 -03:00
Anant Bhasin 2c16cfccab No env 2021-04-10 00:26:51 +05:30
Anant Bhasin 846f78119e final for now 2021-04-09 23:57:39 +05:30
Anant Bhasin 50ea766684 Keystore gen update 2021-04-09 21:23:28 +05:30
Anant Bhasin d0503e82da Keystore gen update 2021-04-08 22:41:12 +05:30
Anant Bhasin bad5cf611b Keystore gen update 2021-04-08 13:10:11 +05:30
Anant Bhasin 2a1ffc3241 Keystore gen update 2021-04-08 13:09:16 +05:30
Anant Bhasin dffae784c6 Keystore gen update 2021-04-08 12:51:53 +05:30
Anant Bhasin 6afc6a1640 Keystore gen update 2021-04-08 12:40:47 +05:30
Anant Bhasin 86f59b1c2c Keystore gen update 2021-04-08 12:22:08 +05:30
Anant Bhasin d776d97fa2 Keystore gen update 2021-04-08 00:05:35 +05:30
Anant Bhasin 6e5818bf22 Keystore gen 2021-04-07 23:09:18 +05:30
Anant Bhasin 64bfb34633 Keystore gen 2021-04-07 22:56:27 +05:30
Anant Bhasin a567c09b03 Keystore gen 2021-04-07 22:25:59 +05:30
Anant Bhasin f339c8964a secret store 2021-04-06 22:58:19 +05:30
Anant Bhasin 3aa65fb989 secret decode 2021-04-06 22:50:25 +05:30
Anant Bhasin cc438bcea5 check release build 2021-04-06 21:55:56 +05:30
Anant Bhasin f032be02ad timeout extension 2021-04-06 21:32:11 +05:30
Anant Bhasin 3b6af94ab8 timeout extension 2021-04-06 15:53:37 +05:30
Anant Bhasin 0c8fc8b992 last correction 2021-04-06 12:45:17 +05:30
Anant Bhasin 8be6ab5cfe timeout increase 2021-04-06 12:22:14 +05:30
Anant Bhasin 8738687129 ... 2021-04-05 20:01:44 +05:30
Anant Bhasin 2577629dac Checking again 2021-04-05 19:52:52 +05:30
Anant Bhasin b6d056ef9f Emu 2021-04-05 18:02:13 +05:30
Anant Bhasin 1447a1b28c JDK update Actions 2021-04-05 17:52:04 +05:30
Anant Bhasin 8c75934312 Detox config added 2021-04-05 17:34:53 +05:30
Anant Bhasin 4ede697231 Detox Test 2021-04-05 17:30:56 +05:30
Anant Bhasin a0cac984b6 Added stories 2021-03-11 01:38:40 +05:30
Anant Bhasin f62dbca1f1 [FIX] Make attachment validation compatible with web client 2021-02-20 16:09:50 +05:30
48 changed files with 721 additions and 238 deletions

View File

@ -146,6 +146,7 @@ commands:
- run:
name: Build App
no_output_timeout: 30m
command: |
if [[ $CIRCLE_JOB == "android-build-official" ]]; then
./gradlew bundleOfficialPlayRelease
@ -153,6 +154,9 @@ commands:
if [[ $CIRCLE_JOB == "android-build-experimental" ]]; then
./gradlew bundleExperimentalPlayRelease
fi
if [[ $CIRCLE_JOB == "android-build-e2e" ]]; then
./gradlew clean app:assembleE2ePlayRelease app:assembleE2ePlayReleaseAndroidTest -DtestBuildType=release
fi
if [[ ! $KEYSTORE ]]; then
./gradlew assembleExperimentalPlayDebug
fi
@ -190,6 +194,38 @@ commands:
paths:
- android/app/build/outputs
android-e2e-test:
description: "End-to-End testing for Android using detox"
parameters:
folder:
type: string
default: ""
steps:
- checkout
- attach_workspace:
at: ./
- restore_cache: *restore-npm-cache-linux
- run: npm install -g yarn
- run: *install-npm-modules
- save_cache: *save-npm-cache-linux
- run:
name: Create avd
command: |
SYSTEM_IMAGES="system-images;android-28;default;x86"
sdkmanager "$SYSTEM_IMAGES"
echo "no" | avdmanager --verbose create avd -n "Pixel_API_28_AOSP" -k "$SYSTEM_IMAGES" -d "pixel"
- run:
name: Run the test
command: |
yarn detox test <<parameters.folder>> -c and.emu.release --cleanup
ios-build:
description: "Build iOS app"
steps:
@ -326,6 +362,8 @@ commands:
- save_cache: *save-gems-cache
version: 2.1
orbs:
node: circleci/node@4.6.0
# EXECUTORS
executors:
@ -389,6 +427,65 @@ jobs:
steps:
- android-build
android-build-e2e:
<<: *defaults
docker:
- image: circleci/android:api-29-node
environment:
<<: *android-env
<<: *bash-env
resource_class: large
steps:
- android-build
android-e2e-test-assorted:
<<: *defaults
machine:
image: android:202102-01
resource_class: large
environment:
<<: *android-env
<<: *bash-env
steps:
- android-e2e-test:
folder: "./e2e/tests/assorted/"
android-e2e-test-onboarding:
<<: *defaults
machine:
image: android:202102-01
resource_class: large
environment:
<<: *android-env
<<: *bash-env
steps:
- android-e2e-test:
folder: "./e2e/tests/onboarding/"
android-e2e-test-room:
<<: *defaults
machine:
image: android:202102-01
resource_class: large
environment:
<<: *android-env
<<: *bash-env
steps:
- android-e2e-test:
folder: "./e2e/tests/room/"
android-e2e-test-team:
<<: *defaults
machine:
image: android:202102-01
resource_class: large
environment:
<<: *android-env
<<: *bash-env
steps:
- android-e2e-test:
folder: "./e2e/tests/team/"
android-internal-app-sharing-experimental:
<<: *defaults
docker:
@ -519,3 +616,27 @@ workflows:
- android-google-play-beta-official:
requires:
- android-hold-google-play-beta-official
# Aandroid E2E Testing
- android-hold-e2e:
type: approval
requires:
- lint-testunit
- android-build-e2e:
requires:
- android-hold-e2e
- android-e2e-test-assorted:
requires:
- android-build-e2e
- android-e2e-test-onboarding:
requires:
- android-build-e2e
- android-e2e-test-room:
requires:
- android-build-e2e
- android-e2e-test-team:
requires:
- android-build-e2e

View File

@ -4031,6 +4031,7 @@ exports[`Storyshots List alert 1`] = `
}
>
<View
accessibilityLabel="Chats"
style={
Array [
Object {
@ -4135,6 +4136,7 @@ exports[`Storyshots List alert 1`] = `
}
>
<View
accessibilityLabel="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries"
style={
Array [
Object {
@ -4239,6 +4241,7 @@ exports[`Storyshots List alert 1`] = `
}
>
<View
accessibilityLabel="Chats"
style={
Array [
Object {
@ -4383,6 +4386,7 @@ exports[`Storyshots List alert 1`] = `
}
>
<View
accessibilityLabel="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries"
style={
Array [
Object {
@ -4684,6 +4688,7 @@ exports[`Storyshots List pressable 1`] = `
}
/>
<View
accessibilityLabel="Press me"
style={
Array [
Object {
@ -4753,6 +4758,7 @@ exports[`Storyshots List pressable 1`] = `
}
/>
<View
accessibilityLabel="I'm disabled"
style={
Array [
Object {
@ -4899,6 +4905,7 @@ exports[`Storyshots List title and subtitle 1`] = `
}
>
<View
accessibilityLabel="Chats"
style={
Array [
Object {
@ -4976,6 +4983,7 @@ exports[`Storyshots List title and subtitle 1`] = `
}
>
<View
accessibilityLabel="Chats"
style={
Array [
Object {
@ -5072,6 +5080,7 @@ exports[`Storyshots List title and subtitle 1`] = `
}
>
<View
accessibilityLabel="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries"
style={
Array [
Object {
@ -5280,6 +5289,7 @@ exports[`Storyshots List with FlatList 1`] = `
}
>
<View
accessibilityLabel={0}
style={
Array [
Object {
@ -5362,6 +5372,7 @@ exports[`Storyshots List with FlatList 1`] = `
}
>
<View
accessibilityLabel={1}
style={
Array [
Object {
@ -5444,6 +5455,7 @@ exports[`Storyshots List with FlatList 1`] = `
}
>
<View
accessibilityLabel={2}
style={
Array [
Object {
@ -5526,6 +5538,7 @@ exports[`Storyshots List with FlatList 1`] = `
}
>
<View
accessibilityLabel={3}
style={
Array [
Object {
@ -5608,6 +5621,7 @@ exports[`Storyshots List with FlatList 1`] = `
}
>
<View
accessibilityLabel={4}
style={
Array [
Object {
@ -5690,6 +5704,7 @@ exports[`Storyshots List with FlatList 1`] = `
}
>
<View
accessibilityLabel={5}
style={
Array [
Object {
@ -5772,6 +5787,7 @@ exports[`Storyshots List with FlatList 1`] = `
}
>
<View
accessibilityLabel={6}
style={
Array [
Object {
@ -5854,6 +5870,7 @@ exports[`Storyshots List with FlatList 1`] = `
}
>
<View
accessibilityLabel={7}
style={
Array [
Object {
@ -5936,6 +5953,7 @@ exports[`Storyshots List with FlatList 1`] = `
}
>
<View
accessibilityLabel={8}
style={
Array [
Object {
@ -6018,6 +6036,7 @@ exports[`Storyshots List with FlatList 1`] = `
}
>
<View
accessibilityLabel={9}
style={
Array [
Object {
@ -6202,6 +6221,7 @@ exports[`Storyshots List with bigger font 1`] = `
}
/>
<View
accessibilityLabel="Chats"
style={
Array [
Object {
@ -6370,6 +6390,7 @@ exports[`Storyshots List with bigger font 1`] = `
}
/>
<View
accessibilityLabel="Chats"
style={
Array [
Object {
@ -6616,6 +6637,7 @@ exports[`Storyshots List with bigger font 1`] = `
}
/>
<View
accessibilityLabel="Chats"
style={
Array [
Object {
@ -6784,6 +6806,7 @@ exports[`Storyshots List with bigger font 1`] = `
}
/>
<View
accessibilityLabel="Chats"
style={
Array [
Object {
@ -7071,6 +7094,7 @@ exports[`Storyshots List with black theme 1`] = `
}
/>
<View
accessibilityLabel="Chats"
style={
Array [
Object {
@ -7239,6 +7263,7 @@ exports[`Storyshots List with black theme 1`] = `
}
/>
<View
accessibilityLabel="Chats"
style={
Array [
Object {
@ -7485,6 +7510,7 @@ exports[`Storyshots List with black theme 1`] = `
}
/>
<View
accessibilityLabel="Chats"
style={
Array [
Object {
@ -7653,6 +7679,7 @@ exports[`Storyshots List with black theme 1`] = `
}
/>
<View
accessibilityLabel="Chats"
style={
Array [
Object {
@ -7893,6 +7920,7 @@ exports[`Storyshots List with custom colors 1`] = `
}
>
<View
accessibilityLabel="Chats"
style={
Array [
Object {
@ -7963,6 +7991,7 @@ exports[`Storyshots List with custom colors 1`] = `
}
/>
<View
accessibilityLabel="Press me!"
style={
Array [
Object {
@ -8120,6 +8149,7 @@ exports[`Storyshots List with dark theme 1`] = `
}
/>
<View
accessibilityLabel="Chats"
style={
Array [
Object {
@ -8288,6 +8318,7 @@ exports[`Storyshots List with dark theme 1`] = `
}
/>
<View
accessibilityLabel="Chats"
style={
Array [
Object {
@ -8534,6 +8565,7 @@ exports[`Storyshots List with dark theme 1`] = `
}
/>
<View
accessibilityLabel="Chats"
style={
Array [
Object {
@ -8702,6 +8734,7 @@ exports[`Storyshots List with dark theme 1`] = `
}
/>
<View
accessibilityLabel="Chats"
style={
Array [
Object {
@ -8942,6 +8975,7 @@ exports[`Storyshots List with icon 1`] = `
}
>
<View
accessibilityLabel="Icon Left"
style={
Array [
Object {
@ -9059,6 +9093,7 @@ exports[`Storyshots List with icon 1`] = `
}
>
<View
accessibilityLabel="Icon Right"
style={
Array [
Object {
@ -9176,6 +9211,7 @@ exports[`Storyshots List with icon 1`] = `
}
>
<View
accessibilityLabel="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries"
style={
Array [
Object {
@ -9352,6 +9388,7 @@ exports[`Storyshots List with icon 1`] = `
}
>
<View
accessibilityLabel="Show Action Indicator"
style={
Array [
Object {
@ -9529,6 +9566,7 @@ exports[`Storyshots List with section and info 1`] = `
}
>
<View
accessibilityLabel="Section Item"
style={
Array [
Object {
@ -9606,6 +9644,7 @@ exports[`Storyshots List with section and info 1`] = `
}
>
<View
accessibilityLabel="Section Item"
style={
Array [
Object {
@ -9704,6 +9743,7 @@ exports[`Storyshots List with section and info 1`] = `
}
>
<View
accessibilityLabel="Section Item"
style={
Array [
Object {
@ -9781,6 +9821,7 @@ exports[`Storyshots List with section and info 1`] = `
}
>
<View
accessibilityLabel="Section Item"
style={
Array [
Object {
@ -9907,6 +9948,7 @@ exports[`Storyshots List with section and info 1`] = `
}
>
<View
accessibilityLabel="Section Item"
style={
Array [
Object {
@ -9984,6 +10026,7 @@ exports[`Storyshots List with section and info 1`] = `
}
>
<View
accessibilityLabel="Section Item"
style={
Array [
Object {
@ -10137,6 +10180,7 @@ exports[`Storyshots List with section and info 1`] = `
}
>
<View
accessibilityLabel="Section Item"
style={
Array [
Object {
@ -10214,6 +10258,7 @@ exports[`Storyshots List with section and info 1`] = `
}
>
<View
accessibilityLabel="Section Item"
style={
Array [
Object {
@ -10401,6 +10446,7 @@ exports[`Storyshots List with small font 1`] = `
}
/>
<View
accessibilityLabel="Chats"
style={
Array [
Object {
@ -10569,6 +10615,7 @@ exports[`Storyshots List with small font 1`] = `
}
/>
<View
accessibilityLabel="Chats"
style={
Array [
Object {
@ -10815,6 +10862,7 @@ exports[`Storyshots List with small font 1`] = `
}
/>
<View
accessibilityLabel="Chats"
style={
Array [
Object {
@ -10983,6 +11031,7 @@ exports[`Storyshots List with small font 1`] = `
}
/>
<View
accessibilityLabel="Chats"
style={
Array [
Object {

View File

@ -151,6 +151,8 @@ 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'
}
signingConfigs {
@ -203,6 +205,10 @@ android {
dimension = "app"
buildConfigField "boolean", "IS_OFFICIAL", "false"
}
e2e {
dimension = "app"
buildConfigField "boolean", "IS_OFFICIAL", "true"
}
foss {
dimension = "type"
buildConfigField "boolean", "FDROID_BUILD", "true"
@ -230,6 +236,16 @@ android {
java.srcDirs = ['src/main/java', 'src/play/java']
manifest.srcFile 'src/play/AndroidManifest.xml'
}
e2ePlayDebug {
java.srcDirs = ['src/main/java', 'src/play/java']
res.srcDirs = ['src/official/res']
manifest.srcFile 'src/play/AndroidManifest.xml'
}
e2ePlayRelease {
java.srcDirs = ['src/main/java', 'src/play/java']
res.srcDirs = ['src/official/res']
manifest.srcFile 'src/play/AndroidManifest.xml'
}
}
applicationVariants.all { variant ->
@ -293,6 +309,8 @@ dependencies {
implementation "com.github.bumptech.glide:glide:4.9.0"
annotationProcessor "com.github.bumptech.glide:compiler:4.9.0"
implementation "com.tencent:mmkv-static:1.2.1"
androidTestImplementation('com.wix:detox:+') { transitive = true }
androidTestImplementation 'junit:junit:4.12'
}
// Run this once to be able to run the application with BUCK

View File

@ -0,0 +1,32 @@
// Replace "com.example" here and below with your app's package name from the top of MainActivity.java
package chat.rocket.reactnative;
import com.wix.detox.Detox;
import com.wix.detox.config.DetoxConfig;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.LargeTest;
import androidx.test.rule.ActivityTestRule;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class DetoxTest {
@Rule
// Replace 'MainActivity' with the value of android:name entry in
// <activity> in AndroidManifest.xml
public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(MainActivity.class, false, false);
@Test
public void runDetoxTests() {
DetoxConfig detoxConfig = new DetoxConfig();
detoxConfig.idlePolicyConfig.masterTimeoutSec = 90;
detoxConfig.idlePolicyConfig.idleResourceTimeoutSec = 60;
detoxConfig.rnContextLoadTimeoutSec = (chat.rocket.reactnative.BuildConfig.DEBUG ? 180 : 60);
Detox.runTests(mActivityRule, detoxConfig);
}
}

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config xmlns:tools="http://schemas.android.com/tools">
<base-config cleartextTrafficPermitted="false">
<trust-anchors>
<certificates src="system" />
<certificates src="user"
tools:ignore="AcceptsUserCertificates" />
</trust-anchors>
</base-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">10.0.2.2</domain>
<domain includeSubdomains="true">localhost</domain>
</domain-config>
</network-security-config>

View File

@ -34,7 +34,7 @@ buildscript {
if (isPlay) {
classpath 'com.google.gms:google-services:4.2.0'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.0.0'
classpath 'com.bugsnag:bugsnag-android-gradle-plugin:5.+'
classpath 'com.bugsnag:bugsnag-android-gradle-plugin:5+'
}
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
@ -53,6 +53,10 @@ allprojects {
url("$rootDir/../node_modules/jsc-android/dist")
}
maven {
url "$rootDir/../node_modules/detox/Detox-android"
}
maven {
url jitsi_url
}

View File

@ -135,6 +135,7 @@ const ActionSheet = React.memo(forwardRef(({ children, theme }, ref) => {
onPress={hide}
style={[styles.button, { backgroundColor: themes[theme].auxiliaryBackground }]}
theme={theme}
accessibilityLabel={I18n.t('Cancel')}
>
<Text style={[styles.text, { color: themes[theme].bodyText }]}>
{I18n.t('Cancel')}

View File

@ -19,6 +19,7 @@ export const Item = React.memo(({ item, hide, theme }) => {
style={[styles.item, { backgroundColor: themes[theme].focusedBackground }]}
theme={theme}
testID={item.testID}
accessibilityLabel={item.title}
>
<CustomIcon name={item.icon} size={20} color={item.danger ? themes[theme].dangerColor : themes[theme].bodyText} />
<View style={styles.titleContainer}>

View File

@ -70,6 +70,7 @@ export default class Button extends React.PureComponent {
disabled && styles.disabled,
style
]}
accessibilityLabel={title}
{...otherProps}
>
{

View File

@ -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}>

View File

@ -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 = (

View File

@ -1,5 +1,5 @@
// https://github.com/RocketChat/Rocket.Chat/blob/develop/definition/ITeam.ts
export const TEAM_TYPE = {
exports.TEAM_TYPE = {
PUBLIC: 0,
PRIVATE: 1
};

View File

@ -74,6 +74,7 @@ export default class DirectoryOptions extends PureComponent {
onPress={() => changeType(itemType)}
style={styles.dropdownItemButton}
theme={theme}
accessibilityLabel={I18n.t(text)}
>
<View style={styles.dropdownItemContainer}>
<CustomIcon style={[styles.dropdownItemIcon, { color: themes[theme].bodyText }]} size={22} name={icon} />
@ -102,7 +103,7 @@ export default class DirectoryOptions extends PureComponent {
<Animated.View style={[styles.backdrop, { backgroundColor: themes[theme].backdropColor, opacity: backdropOpacity }]} />
</TouchableWithoutFeedback>
<Animated.View style={[styles.dropdownContainer, { transform: [{ translateY }], backgroundColor: themes[theme].backgroundColor }]}>
<Touch onPress={this.close} theme={theme}>
<Touch onPress={this.close} theme={theme} accessibilityLabel={I18n.t('Search_by')}>
<View style={[styles.dropdownContainerHeader, styles.dropdownItemContainer, { borderColor: themes[theme].separatorColor }]}>
<Text style={[styles.dropdownToggleText, { color: themes[theme].auxiliaryText }]}>{I18n.t('Search_by')}</Text>
<CustomIcon style={[styles.dropdownItemIcon, styles.inverted, { color: themes[theme].auxiliaryTintColor }]} size={22} name='chevron-down' />

View File

@ -153,6 +153,7 @@ class NewMessageView extends React.Component {
style={{ backgroundColor: themes[theme].backgroundColor }}
testID={testID}
theme={theme}
accessibilityLabel={title}
>
<View style={[first ? sharedStyles.separatorVertical : sharedStyles.separatorBottom, styles.button, { borderColor: themes[theme].separatorColor }]}>
<CustomIcon style={[styles.buttonIcon, { color: themes[theme].tintColor }]} size={24} name={icon} />

View File

@ -33,7 +33,7 @@ import Navigation from '../../lib/Navigation';
const getRoomTitle = (room, type, name, username, statusText, theme) => (type === 'd'
? (
<>
<Text testID='room-info-view-name' style={[styles.roomTitle, { color: themes[theme].titleText }]}>{ name }</Text>
<Text testID='room-info-view-name' style={[styles.roomTitle, { color: themes[theme].titleText }]} accessibilityLabel={name}>{ name }</Text>
{username && <Text testID='room-info-view-username' style={[styles.roomUsername, { color: themes[theme].auxiliaryText }]}>{`@${ username }`}</Text>}
{!!statusText && <View testID='room-info-view-custom-status'><Markdown msg={statusText} style={[styles.roomUsername, { color: themes[theme].auxiliaryText }]} preview theme={theme} /></View>}
</>
@ -41,7 +41,7 @@ const getRoomTitle = (room, type, name, username, statusText, theme) => (type ==
: (
<View style={styles.roomTitleRow}>
<RoomTypeIcon type={room.prid ? 'discussion' : room.t} teamMain={room.teamMain} key='room-info-type' status={room.visitor?.status} />
<Text testID='room-info-view-name' style={[styles.roomTitle, { color: themes[theme].titleText }]} key='room-info-name'>{RocketChat.getRoomTitle(room)}</Text>
<Text testID='room-info-view-name' style={[styles.roomTitle, { color: themes[theme].titleText }]} key='room-info-name' accessibilityLabel={RocketChat.getRoomTitle(room)}>{RocketChat.getRoomTitle(room)}</Text>
</View>
)
);

View File

@ -21,7 +21,7 @@ const Item = React.memo(({
{left}
</View>
<View style={styles.itemCenter}>
<Text style={[styles.itemText, { color: themes[theme].titleText }]} numberOfLines={1}>
<Text style={[styles.itemText, { color: themes[theme].titleText }]} numberOfLines={1} accessibilityLabel={text}>
{text}
</Text>
</View>

View File

@ -1,10 +1,31 @@
const {
expect, element, by, waitFor
} = require('detox');
const { exec } = require('child_process');
const data = require('../data');
const platformTypes = {
android: {
// Android types
alertButtonType: 'android.widget.Button',
scrollViewType: 'android.widget.ScrollView',
textInputType: 'android.widget.EditText'
},
ios: {
// iOS types
alertButtonType: '_UIAlertControllerActionView',
scrollViewType: 'UIScrollView',
textInputType: '_UIAlertControllerTextField'
}
};
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 element(by.id('new-server-view-input')).replaceText(`${ server }`);
await element(by.text('Connect')).tap();
await waitFor(element(by.id('workspace-view'))).toBeVisible().withTimeout(60000);
await expect(element(by.id('workspace-view'))).toBeVisible();
}
@ -33,12 +54,14 @@ async function login(username, password) {
}
async function logout() {
const deviceType = device.getPlatform();
const { scrollViewType } = platformTypes[deviceType];
await element(by.id('rooms-list-view-sidebar')).tap();
await waitFor(element(by.id('sidebar-view'))).toBeVisible().withTimeout(2000);
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(scrollViewType)).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);
@ -51,37 +74,50 @@ async function logout() {
async function mockMessage(message, isThread = false) {
const input = isThread ? 'messagebox-input-thread' : 'messagebox-input';
await element(by.id(input)).tap();
await element(by.id(input)).typeText(`${ data.random }${ message }`);
await element(by.id(input)).replaceText(`${ 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) {
const messageLabel = `${ data.random }${ message }`;
await element(by.label(messageLabel)).atIndex(0).longPress();
await element(by.text(messageLabel)).atIndex(0).longPress();
await expect(element(by.id('action-sheet'))).toExist();
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
await element(by.label('Star')).atIndex(0).tap();
await element(by.text('Star')).atIndex(0).tap();
await waitFor(element(by.id('action-sheet'))).not.toExist().withTimeout(5000);
}
async function pinMessage(message) {
const messageLabel = `${ data.random }${ message }`;
await waitFor(element(by.label(messageLabel)).atIndex(0)).toExist();
await element(by.label(messageLabel)).atIndex(0).longPress();
await waitFor(element(by.text(messageLabel)).atIndex(0)).toExist();
await element(by.text(messageLabel)).atIndex(0).longPress();
await expect(element(by.id('action-sheet'))).toExist();
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
await element(by.label('Pin')).atIndex(0).tap();
await element(by.text('Pin')).atIndex(0).tap();
await waitFor(element(by.id('action-sheet'))).not.toExist().withTimeout(5000);
}
async function dismissReviewNag() {
const deviceType = device.getPlatform();
const { alertButtonType } = platformTypes[deviceType];
await waitFor(element(by.text('Are you enjoying this app?'))).toExist().withTimeout(60000);
await element(by.label('No').and(by.type('_UIAlertControllerActionView'))).tap(); // Tap `no` on ask for review alert
await element(by.text('NO').and(by.type(alertButtonType))).tap(); // Tap `no` on ask for review alert
}
async function mockMessageWithNag(message, isThread = false) {
const input = isThread ? 'messagebox-input-thread' : 'messagebox-input';
await element(by.id(input)).tap();
await element(by.id(input)).replaceText(`${ data.random }${ message }`);
await element(by.id('messagebox-send-message')).tap();
await dismissReviewNag();
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 tapBack() {
@ -96,7 +132,7 @@ async function searchRoom(room) {
await element(by.id('rooms-list-view-search')).tap();
await expect(element(by.id('rooms-list-view-search-input'))).toExist();
await waitFor(element(by.id('rooms-list-view-search-input'))).toExist().withTimeout(5000);
await element(by.id('rooms-list-view-search-input')).typeText(room);
await element(by.id('rooms-list-view-search-input')).replaceText(room);
await sleep(300);
await waitFor(element(by.id(`rooms-list-view-item-${ room }`))).toBeVisible().withTimeout(60000);
}
@ -125,6 +161,29 @@ const checkServer = async(server) => {
await element(by.id('sidebar-close-drawer')).tap();
};
function runCommand(command) {
return new Promise((resolve, reject) => {
exec(command, (error, stdout, stderr) => {
if (error) {
reject(new Error(`exec error: ${ stderr }`));
return;
}
resolve();
});
});
}
async function prepareAndroid() {
if (device.getPlatform() !== 'android') {
return;
}
await runCommand('adb shell settings put secure spell_checker_enabled 0');
await runCommand('adb shell settings put secure autofill_service null');
await runCommand('adb shell settings put global window_animation_scale 0.0');
await runCommand('adb shell settings put global transition_animation_scale 0.0');
await runCommand('adb shell settings put global animator_duration_scale 0.0');
}
module.exports = {
navigateToWorkspace,
navigateToLogin,
@ -139,5 +198,8 @@ module.exports = {
sleep,
searchRoom,
tryTapping,
checkServer
checkServer,
mockMessageWithNag,
platformTypes,
prepareAndroid
};

View File

@ -1,5 +1,5 @@
const {
navigateToLogin, login, sleep, tapBack, mockMessage, searchRoom, logout
navigateToLogin, login, sleep, tapBack, mockMessage, searchRoom, logout, platformTypes
} = require('../../helpers/app');
const data = require('../../data');
@ -16,7 +16,7 @@ const checkServer = async(server) => {
};
const checkBanner = async() => {
await waitFor(element(by.id('listheader-encryption').withDescendant(by.label('Save Your Encryption Password')))).toBeVisible().withTimeout(10000);
await waitFor(element(by.id('listheader-encryption').withDescendant(by.text('Save Your Encryption Password')))).toBeVisible().withTimeout(10000);
};
async function navigateToRoom(roomName) {
@ -43,9 +43,12 @@ async function navigateSecurityPrivacy() {
describe('E2E Encryption', () => {
const room = `encrypted${ data.random }`;
const newPassword = 'abc';
let alertButtonType;
let scrollViewType;
before(async() => {
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
({ alertButtonType, scrollViewType } = platformTypes[device.getPlatform()]);
await navigateToLogin();
await login(testuser.username, testuser.password);
});
@ -136,11 +139,11 @@ describe('E2E Encryption', () => {
describe('Change password', () => {
it('should change password', async() => {
await element(by.id('e2e-encryption-security-view-password')).typeText(newPassword);
await element(by.id('e2e-encryption-security-view-password')).replaceText(newPassword);
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.label('Yes, change it').and(by.type('_UIAlertControllerActionView'))).tap();
await element(by.text('Yes, change it').and(by.type(alertButtonType))).tap();
await waitForToast();
});
@ -155,7 +158,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() => {
@ -165,21 +168,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-password')).replaceText(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);
});
});
@ -193,15 +196,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(alertButtonType))).tap();
await waitFor(element(by.text('OK'))).toBeVisible().withTimeout(5000);
await element(by.text('OK').and(by.type(alertButtonType))).tap();
await sleep(2000);
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);
});
});
});
@ -220,7 +223,8 @@ describe('E2E Encryption', () => {
// TODO: refactor
await waitFor(element(by.id('new-server-view'))).toBeVisible().withTimeout(60000);
await element(by.id('new-server-view-input')).typeText(`${ data.alternateServer }\n`);
await element(by.id('new-server-view-input')).replaceText(`${ data.alternateServer }`);
await element(by.text('Connect')).tap();
await waitFor(element(by.id('workspace-view'))).toBeVisible().withTimeout(60000);
await element(by.id('workspace-view-register')).tap();
await waitFor(element(by.id('register-view'))).toBeVisible().withTimeout(2000);
@ -229,7 +233,8 @@ describe('E2E Encryption', () => {
await element(by.id('register-view-name')).replaceText(data.registeringUser.username);
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);
await element(by.id('register-view-password')).replaceText(data.registeringUser.password);
element(by.type(scrollViewType)).atIndex(1).scrollTo('bottom');
await element(by.id('register-view-submit')).tap();
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(60000);

View File

@ -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() => {

View File

@ -1,4 +1,9 @@
const { navigateToLogin, login, sleep } = require('../../helpers/app');
const {
navigateToLogin,
login,
sleep,
platformTypes
} = require('../../helpers/app');
const data = require('../../data');
const profileChangeUser = data.users.profileChanges;
@ -14,8 +19,13 @@ async function waitForToast() {
}
describe('Profile screen', () => {
let textInputType;
let scrollViewType;
let alertButtonType;
before(async() => {
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
({ textInputType, scrollViewType, alertButtonType } = platformTypes[device.getPlatform()]);
await navigateToLogin();
await login(profileChangeUser.username, profileChangeUser.password);
await element(by.id('rooms-list-view-sidebar')).tap();
@ -74,8 +84,8 @@ describe('Profile screen', () => {
describe('Usage', () => {
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 element(by.id('profile-view-username')).replaceText(`${ profileChangeUser.username }new`);
await element(by.type(scrollViewType)).atIndex(1).swipe('up');
await element(by.id('profile-view-submit')).tap();
await waitForToast();
});
@ -84,12 +94,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(textInputType)).replaceText(`${ profileChangeUser.password }`);
await element(by.text('SAVE').and(by.type(alertButtonType))).tap();
await waitForToast();
});
it('should reset avatar', async() => {
await element(by.type('UIScrollView')).atIndex(1).swipe('up');
await element(by.type(scrollViewType)).atIndex(1).swipe('up');
await element(by.id('profile-view-reset-avatar')).tap();
await waitForToast();
});

View File

@ -1,12 +1,15 @@
const { navigateToLogin, login } = require('../../helpers/app');
const { navigateToLogin, login, platformTypes } = require('../../helpers/app');
const data = require('../../data');
const testuser = data.users.regular;
describe('Settings screen', () => {
let alertButtonType;
before(async() => {
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
({ alertButtonType } = platformTypes[device.getPlatform()]);
await navigateToLogin();
await login(testuser.username, testuser.password);
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(10000);
@ -64,7 +67,7 @@ describe('Settings screen', () => {
await waitFor(element(by.id('settings-view'))).toBeVisible().withTimeout(2000);
await element(by.id('settings-view-clear-cache')).tap();
await waitFor(element(by.text('This will clear all your offline data.'))).toExist().withTimeout(2000);
await element(by.label('Clear').and(by.type('_UIAlertControllerActionView'))).tap();
await element(by.text('Clear').and(by.type(alertButtonType))).tap();
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(5000);
await waitFor(element(by.id(`rooms-list-view-item-${ data.groups.private.name }`))).toExist().withTimeout(10000);
});

View File

@ -1,6 +1,6 @@
const data = require('../../data');
const {
navigateToLogin, login, mockMessage, tapBack, searchRoom
navigateToLogin, login, mockMessage, tapBack, searchRoom, platformTypes
} = require('../../helpers/app');
const testuser = data.users.regular;
@ -9,7 +9,7 @@ const room = data.channels.detoxpublic.name;
async function navigateToRoom() {
await searchRoom(room);
await element(by.id(`rooms-list-view-item-${ room }`)).tap();
await waitFor(element(by.id('room-view'))).toBeVisible().withTimeout(5000);
await waitFor(element(by.id('room-view')).atIndex(0)).toExist().withTimeout(5000);
}
async function navigateToRoomActions() {
@ -18,8 +18,10 @@ async function navigateToRoomActions() {
}
describe('Join public room', () => {
let scrollViewType;
before(async() => {
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
({ scrollViewType } = platformTypes[device.getPlatform()]);
await navigateToLogin();
await login(testuser.username, testuser.password);
await navigateToRoom();
@ -149,6 +151,7 @@ describe('Join public room', () => {
await expect(element(by.id('room-actions-share'))).toBeVisible();
await expect(element(by.id('room-actions-pinned'))).toBeVisible();
await expect(element(by.id('room-actions-notifications'))).toBeVisible();
await element(by.type(scrollViewType)).atIndex(0).swipe('up');
await expect(element(by.id('room-actions-leave-channel'))).toBeVisible();
});
@ -158,7 +161,7 @@ describe('Join public room', () => {
await expect(element(by.text('Yes, leave it!'))).toBeVisible();
await element(by.text('Yes, leave it!')).tap();
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(10000);
await waitFor(element(by.id(`rooms-list-view-item-${ room }`))).toBeNotVisible().withTimeout(60000);
// await waitFor(element(by.id(`rooms-list-view-item-${ room }`))).toBeNotVisible().withTimeout(60000);
});
});
});

View File

@ -39,10 +39,10 @@ describe('Status screen', () => {
});
it('should change status text', async() => {
await element(by.id('status-view-input')).typeText('status-text-new');
await element(by.id('status-view-input')).replaceText('status-text-new');
await element(by.id('status-view-submit')).tap();
await waitForToast();
await waitFor(element(by.label('status-text-new').withAncestor(by.id('sidebar-custom-status')))).toExist().withTimeout(2000);
await waitFor(element(by.text('status-text-new').withAncestor(by.id('sidebar-custom-status')))).toExist().withTimeout(2000);
});
});
});

View File

@ -2,6 +2,7 @@ const data = require('../../data');
const { navigateToLogin, login, checkServer } = require('../../helpers/app');
const reopenAndCheckServer = async(server) => {
await device.terminateApp();
await device.launchApp({ permissions: { notifications: 'YES' } });
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(6000);
await checkServer(server);
@ -21,7 +22,8 @@ describe('Change server', () => {
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 element(by.id('new-server-view-input')).replaceText(`${ data.alternateServer }`);
await element(by.text('Connect')).tap();
await waitFor(element(by.id('workspace-view'))).toBeVisible().withTimeout(10000);
await reopenAndCheckServer(data.server);
});

View File

@ -10,7 +10,7 @@ const { joinCode } = data.channels.detoxpublicprotected;
async function navigateToRoom() {
await searchRoom(room);
await element(by.id(`rooms-list-view-item-${ room }`)).tap();
await waitFor(element(by.id('room-view'))).toBeVisible().withTimeout(5000);
await waitFor(element(by.id('room-view')).atIndex(0)).toExist().withTimeout(5000);
}
async function openJoinCode() {

View File

@ -10,7 +10,7 @@ async function navigateToRoom(search) {
await waitFor(element(by.id(`directory-view-item-${ search }`))).toBeVisible().withTimeout(10000);
await sleep(300); // app takes some time to animate
await element(by.id(`directory-view-item-${ search }`)).tap();
await waitFor(element(by.id('room-view'))).toExist().withTimeout(5000);
await waitFor(element(by.id('room-view')).atIndex(0)).toExist().withTimeout(5000);
await waitFor(element(by.id(`room-view-title-${ search }`))).toExist().withTimeout(5000);
}

View File

@ -1,11 +1,14 @@
const data = require('../../data');
const {
sleep, navigateToLogin, login, checkServer
sleep, navigateToLogin, login, checkServer, platformTypes
} = require('../../helpers/app');
describe('Delete server', () => {
let scrollViewType;
let alertButtonType;
before(async() => {
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
({ alertButtonType, scrollViewType } = platformTypes[device.getPlatform()]);
await navigateToLogin();
await login(data.users.regular.username, data.users.regular.password);
});
@ -21,7 +24,8 @@ describe('Delete server', () => {
await element(by.id('rooms-list-header-server-add')).tap();
await waitFor(element(by.id('new-server-view'))).toBeVisible().withTimeout(10000);
await element(by.id('new-server-view-input')).typeText(`${ data.alternateServer }\n`);
await element(by.id('new-server-view-input')).replaceText(`${ data.alternateServer }`);
await element(by.text('Connect')).tap();
await waitFor(element(by.id('workspace-view'))).toBeVisible().withTimeout(10000);
await element(by.id('workspace-view-register')).tap();
await waitFor(element(by.id('register-view'))).toBeVisible().withTimeout(2000);
@ -30,7 +34,8 @@ describe('Delete server', () => {
await element(by.id('register-view-name')).replaceText(data.registeringUser3.username);
await element(by.id('register-view-username')).replaceText(data.registeringUser3.username);
await element(by.id('register-view-email')).replaceText(data.registeringUser3.email);
await element(by.id('register-view-password')).typeText(data.registeringUser3.password);
await element(by.id('register-view-password')).replaceText(data.registeringUser3.password);
await element(by.type(scrollViewType)).atIndex(0).swipe('up');
await element(by.id('register-view-submit')).tap();
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(60000);
@ -41,7 +46,7 @@ describe('Delete server', () => {
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-${ data.server }`)).longPress(1500);
await element(by.label('Delete').and(by.type('_UIAlertControllerActionView'))).tap();
await element(by.text('Delete').and(by.type(alertButtonType))).tap();
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 waitFor(element(by.id(`rooms-list-header-server-${ data.server }`))).toBeNotVisible().withTimeout(10000);

View File

@ -1,10 +1,18 @@
const data = require('../../data');
const { tapBack, checkServer, navigateToRegister } = require('../../helpers/app');
const {
tapBack,
checkServer,
navigateToRegister,
platformTypes
} = require('../../helpers/app');
const { get, login } = require('../../helpers/data_setup');
const DEEPLINK_METHODS = { AUTH: 'auth', ROOM: 'room' };
let amp = '&';
const getDeepLink = (method, server, params) => {
const deeplink = `rocketchat://${ method }?host=${ server.replace(/^(http:\/\/|https:\/\/)/, '') }&${ params }`;
const deeplink = `rocketchat://${ method }?host=${ server.replace(/^(http:\/\/|https:\/\/)/, '') }${ amp }${ params }`;
console.log(`Deeplinking to: ${ deeplink }`);
return deeplink;
};
@ -12,9 +20,14 @@ const getDeepLink = (method, server, params) => {
describe('Deep linking', () => {
let userId;
let authToken;
let scrollViewType;
before(async() => {
const loginResult = await login(data.users.regular.username, data.users.regular.password);
({ userId, authToken } = loginResult);
const deviceType = device.getPlatform();
amp = deviceType === 'android' ? '\\&' : '&';
({ scrollViewType } = platformTypes[deviceType]);
});
describe('Authentication', () => {
@ -22,18 +35,16 @@ describe('Deep linking', () => {
await device.launchApp({
permissions: { notifications: 'YES' },
delete: true,
url: getDeepLink(DEEPLINK_METHODS.AUTH, data.server, 'userId=123&token=abc'),
sourceApp: 'com.apple.mobilesafari'
url: getDeepLink(DEEPLINK_METHODS.AUTH, data.server, `userId=123${ amp }token=abc`)
});
await waitFor(element(by.text('You\'ve been logged out by the server. Please log in again.'))).toExist().withTimeout(10000); // TODO: we need to improve this message
await waitFor(element(by.text('You\'ve been logged out by the server. Please log in again.'))).toExist().withTimeout(20000); // TODO: we need to improve this message
});
const authAndNavigate = async() => {
await device.launchApp({
permissions: { notifications: 'YES' },
newInstance: true,
url: getDeepLink(DEEPLINK_METHODS.AUTH, data.server, `userId=${ userId }&token=${ authToken }&path=group/${ data.groups.private.name }`),
sourceApp: 'com.apple.mobilesafari'
url: getDeepLink(DEEPLINK_METHODS.AUTH, data.server, `userId=${ userId }${ amp }token=${ authToken }${ amp }path=group/${ data.groups.private.name }`)
});
await waitFor(element(by.id(`room-view-title-${ data.groups.private.name }`))).toExist().withTimeout(30000);
await tapBack();
@ -52,7 +63,8 @@ describe('Deep linking', () => {
await element(by.id('register-view-name')).replaceText(data.registeringUser4.username);
await element(by.id('register-view-username')).replaceText(data.registeringUser4.username);
await element(by.id('register-view-email')).replaceText(data.registeringUser4.email);
await element(by.id('register-view-password')).typeText(data.registeringUser4.password);
await element(by.id('register-view-password')).replaceText(data.registeringUser4.password);
await element(by.type(scrollViewType)).atIndex(0).scrollTo('bottom');
await element(by.id('register-view-submit')).tap();
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(10000);
await authAndNavigate();
@ -65,8 +77,8 @@ describe('Deep linking', () => {
await device.launchApp({
permissions: { notifications: 'YES' },
newInstance: true,
url: getDeepLink(DEEPLINK_METHODS.ROOM, data.server, `path=group/${ data.groups.private.name }`),
sourceApp: 'com.apple.mobilesafari'
url: getDeepLink(DEEPLINK_METHODS.ROOM, data.server, `path=group/${ data.groups.private.name }`)
});
await waitFor(element(by.id(`room-view-title-${ data.groups.private.name }`))).toExist().withTimeout(10000);
});
@ -76,8 +88,8 @@ describe('Deep linking', () => {
await device.launchApp({
permissions: { notifications: 'YES' },
newInstance: true,
url: getDeepLink(DEEPLINK_METHODS.ROOM, data.server, `rid=${ roomResult.data.group._id }`),
sourceApp: 'com.apple.mobilesafari'
url: getDeepLink(DEEPLINK_METHODS.ROOM, data.server, `rid=${ roomResult.data.group._id }`)
});
await waitFor(element(by.id(`room-view-title-${ data.groups.private.name }`))).toExist().withTimeout(15000);
await tapBack();
@ -95,8 +107,8 @@ describe('Deep linking', () => {
await device.launchApp({
permissions: { notifications: 'YES' },
newInstance: true,
url: getDeepLink(DEEPLINK_METHODS.ROOM, data.server, `path=group/${ data.groups.private.name }`),
sourceApp: 'com.apple.mobilesafari'
url: getDeepLink(DEEPLINK_METHODS.ROOM, data.server, `path=group/${ data.groups.private.name }`)
});
await waitFor(element(by.id(`room-view-title-${ data.groups.private.name }`))).toExist().withTimeout(10000);
});
@ -105,8 +117,8 @@ describe('Deep linking', () => {
await device.launchApp({
permissions: { notifications: 'YES' },
newInstance: true,
url: getDeepLink(DEEPLINK_METHODS.ROOM, 'https://google.com'),
sourceApp: 'com.apple.mobilesafari'
url: getDeepLink(DEEPLINK_METHODS.ROOM, 'https://google.com')
});
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(10000);
await checkServer(data.server);

View File

@ -18,8 +18,14 @@ const navToLanguage = async() => {
};
describe('i18n', () => {
before(async() => {
});
describe('OS language', () => {
it('OS set to \'en\' and proper translate to \'en\'', async() => {
if (device.getPlatform() === 'android') {
return; // FIXME: Passing language with launch parameters doesn't work with Android
}
await device.launchApp({
...defaultLaunchArgs,
languageAndLocale: {
@ -34,6 +40,9 @@ describe('i18n', () => {
});
it('OS set to unavailable language and fallback to \'en\'', async() => {
if (device.getPlatform() === 'android') {
return; // FIXME: Passing language with launch parameters doesn't work with Android
}
await device.launchApp({
...defaultLaunchArgs,
languageAndLocale: {
@ -66,7 +75,7 @@ describe('i18n', () => {
describe('Rocket.Chat language', () => {
before(async() => {
await device.launchApp(defaultLaunchArgs);
await device.launchApp({ ...defaultLaunchArgs, delete: true });
await navigateToLogin();
await login(testuser.username, testuser.password);
});
@ -97,7 +106,7 @@ describe('i18n', () => {
it('should set unsupported language and fallback to \'en\'', async() => {
await post('users.setPreferences', { data: { language: 'eo' } }); // Set language to Esperanto
await device.launchApp(defaultLaunchArgs);
await device.launchApp({ ...defaultLaunchArgs, newInstance: true });
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(10000);
await element(by.id('rooms-list-view-sidebar')).tap();
await waitFor(element(by.id('sidebar-view'))).toBeVisible().withTimeout(2000);

View File

@ -2,9 +2,11 @@ const detox = require('detox');
const adapter = require('detox/runners/mocha/adapter');
const config = require('../../package.json').detox;
const { setup } = require('../helpers/data_setup');
const { prepareAndroid } = require('../helpers/app');
before(async() => {
await Promise.all([setup(), detox.init(config, { launchApp: false })]);
await prepareAndroid(); // Make Android less flaky
// await dataSetup()
// await detox.init(config, { launchApp: false });
// await device.launchApp({ permissions: { notifications: 'YES' } });

View File

@ -31,7 +31,8 @@ describe('Onboarding', () => {
});
it('should enter an invalid server and get error', async() => {
await element(by.id('new-server-view-input')).typeText('invalidtest\n');
await element(by.id('new-server-view-input')).replaceText('invalidtest');
await element(by.text('Connect')).tap();
const errorText = 'Oops!';
await waitFor(element(by.text(errorText))).toBeVisible().withTimeout(60000);
await element(by.text('OK')).tap();
@ -47,7 +48,8 @@ describe('Onboarding', () => {
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 element(by.id('new-server-view-input')).typeText(`${ data.server }\n`);
await element(by.id('new-server-view-input')).replaceText(`${ data.server }`);
await element(by.text('Connect')).tap();
await waitFor(element(by.id('workspace-view'))).toBeVisible().withTimeout(60000);
});
});

View File

@ -1,3 +1,6 @@
const {
device, expect, element, by, waitFor
} = require('detox');
const { navigateToRegister } = require('../../helpers/app');
const data = require('../../data');

View File

@ -1,3 +1,6 @@
const {
expect, element, by, waitFor
} = require('detox');
const { navigateToLogin, tapBack } = require('../../helpers/app');
const data = require('../../data');

View File

@ -1,3 +1,6 @@
const {
device, expect, element, by, waitFor
} = require('detox');
const {
login, navigateToLogin, logout, tapBack, searchRoom
} = require('../../helpers/app');

View File

@ -1,3 +1,6 @@
const {
device, expect, element, by, waitFor
} = require('detox');
const {
login, navigateToLogin, logout, tapBack
} = require('../../helpers/app');
@ -24,8 +27,10 @@ describe('Server history', () => {
it('should tap on a server history and navigate to login', async() => {
await element(by.id(`server-history-${ data.server }`)).tap();
await waitFor(element(by.id('login-view'))).toBeVisible().withTimeout(5000);
await expect(element(by.id('login-view-email'))).toHaveText(data.users.regular.username);
// Detox synchronization breaks at this point. Look into this
await waitFor(element(by.id('login-view-email'))).toBeVisible().withTimeout(5000);
await expect(element(by.text(data.users.regular.username).withAncestor(by.id('login-view-email'))));
// await expect(element(by.id('login-view-email'))).toHaveText(data.users.regular.username);
});
it('should delete server from history', async() => {

View File

@ -3,6 +3,8 @@ const {
tapBack, navigateToLogin, login, tryTapping
} = require('../../helpers/app');
describe('Create room screen', () => {
before(async() => {
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
@ -91,7 +93,7 @@ describe('Create room screen', () => {
describe('Usage', () => {
it('should get invalid room', async() => {
await element(by.id('create-channel-name')).typeText('general');
await element(by.id('create-channel-name')).replaceText('general');
await element(by.id('create-channel-submit')).tap();
await waitFor(element(by.text('A channel with name general exists'))).toExist().withTimeout(60000);
await expect(element(by.text('A channel with name general exists'))).toExist();
@ -101,7 +103,7 @@ describe('Create room screen', () => {
it('should create public room', async() => {
const room = `public${ data.random }`;
await element(by.id('create-channel-name')).replaceText('');
await element(by.id('create-channel-name')).typeText(room);
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'))).toExist().withTimeout(6000);
@ -125,7 +127,7 @@ describe('Create room screen', () => {
await waitFor(element(by.id('selected-user-rocket.cat'))).toExist().withTimeout(5000);
await element(by.id('selected-users-view-submit')).tap();
await waitFor(element(by.id('create-channel-view'))).toExist().withTimeout(5000);
await element(by.id('create-channel-name')).typeText(room);
await element(by.id('create-channel-name')).replaceText(room);
await element(by.id('create-channel-submit')).tap();
await waitFor(element(by.id('room-view'))).toExist().withTimeout(60000);
await expect(element(by.id('room-view'))).toExist();
@ -147,7 +149,7 @@ describe('Create room screen', () => {
await waitFor(element(by.id('select-users-view'))).toExist().withTimeout(5000);
await element(by.id('selected-users-view-submit')).tap();
await waitFor(element(by.id('create-channel-view'))).toExist().withTimeout(10000);
await element(by.id('create-channel-name')).typeText(room);
await element(by.id('create-channel-name')).replaceText(room);
await element(by.id('create-channel-submit')).tap();
await waitFor(element(by.id('room-view'))).toExist().withTimeout(60000);
await expect(element(by.id('room-view'))).toExist();

View File

@ -1,6 +1,6 @@
const data = require('../../data');
const {
navigateToLogin, login, mockMessage, tapBack, sleep, searchRoom, starMessage, pinMessage, dismissReviewNag, tryTapping
navigateToLogin, login, mockMessage, tapBack, sleep, searchRoom, starMessage, pinMessage, dismissReviewNag, tryTapping, mockMessageWithNag
} = require('../../helpers/app');
async function navigateToRoom(roomName) {
@ -66,24 +66,27 @@ describe('Room screen', () => {
describe('Messagebox', () => {
it('should send message', async() => {
await mockMessage('message');
await expect(element(by.label(`${ data.random }message`)).atIndex(0)).toExist();
await expect(element(by.text(`${ data.random }message`)).atIndex(0)).toExist();
});
it('should show/hide emoji keyboard', async() => {
if (device.getPlatform() === 'android') {
await element(by.id('messagebox-open-emoji')).tap();
await waitFor(element(by.id('messagebox-keyboard-emoji'))).toExist().withTimeout(10000);
await expect(element(by.id('messagebox-close-emoji'))).toExist();
await expect(element(by.id('messagebox-open-emoji'))).toBeNotVisible();
await element(by.id('messagebox-close-emoji')).tap();
await waitFor(element(by.id('messagebox-keyboard-emoji'))).toBeNotVisible().withTimeout(10000);
await expect(element(by.id('messagebox-close-emoji'))).toBeNotVisible();
await expect(element(by.id('messagebox-open-emoji'))).toExist();
}
});
// FIXME: Detox tests halt on android while rendering GIFs
// it('should show/hide emoji keyboard', async() => {
// if (device.getPlatform() === 'android') {
// await element(by.id('messagebox-open-emoji')).tap();
// await waitFor(element(by.id('messagebox-keyboard-emoji'))).toExist().withTimeout(10000);
// await expect(element(by.id('messagebox-close-emoji'))).toExist();
// await expect(element(by.id('messagebox-open-emoji'))).toBeNotVisible();
// await element(by.id('messagebox-close-emoji')).tap();
// await waitFor(element(by.id('messagebox-keyboard-emoji'))).toBeNotVisible().withTimeout(10000);
// await expect(element(by.id('messagebox-close-emoji'))).toBeNotVisible();
// await expect(element(by.id('messagebox-open-emoji'))).toExist();
// }
// });
it('should show/hide emoji autocomplete', async() => {
if (device.getPlatform() === 'android') {
return; // FIXME: Detox tests halt on android while rendering GIFs
}
await element(by.id('messagebox-input')).tap();
await element(by.id('messagebox-input')).typeText(':joy');
await waitFor(element(by.id('messagebox-container'))).toExist().withTimeout(10000);
@ -92,8 +95,11 @@ describe('Room screen', () => {
});
it('should show and tap on emoji autocomplete', async() => {
if (device.getPlatform() === 'android') {
return; // FIXME: Detox tests halt on android while rendering GIFs
}
await element(by.id('messagebox-input')).tap();
await element(by.id('messagebox-input')).replaceText(':');
await element(by.id('messagebox-input')).typeText(':');
await element(by.id('messagebox-input')).typeText('joy'); // workaround for number keyboard
await waitFor(element(by.id('messagebox-container'))).toExist().withTimeout(10000);
await element(by.id('mention-item-joy')).tap();
@ -103,7 +109,7 @@ describe('Room screen', () => {
it('should not show emoji autocomplete on semicolon in middle of a string', async() => {
await element(by.id('messagebox-input')).tap();
// await element(by.id('messagebox-input')).replaceText(':');
// await element(by.id('messagebox-input')).typeText(':');
await element(by.id('messagebox-input')).typeText('name:is');
await waitFor(element(by.id('messagebox-container'))).toNotExist().withTimeout(20000);
await element(by.id('messagebox-input')).clearText();
@ -148,7 +154,7 @@ describe('Room screen', () => {
});
it('should draft message', async() => {
await element(by.id('messagebox-input')).tap();
await element(by.id('messagebox-input')).typeText(`${ data.random }draft`);
await element(by.id('messagebox-input')).replaceText(`${ data.random }draft`);
await tapBack();
await navigateToRoom(mainRoom);
@ -163,21 +169,21 @@ describe('Room screen', () => {
describe('Message', () => {
it('should copy permalink', async() => {
await element(by.label(`${ data.random }message`)).atIndex(0).longPress();
await element(by.text(`${ data.random }message`)).atIndex(0).longPress();
await expect(element(by.id('action-sheet'))).toExist();
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
await element(by.label('Permalink')).atIndex(0).tap();
await element(by.text('Permalink')).atIndex(0).tap();
// TODO: test clipboard
});
it('should copy message', async() => {
await element(by.label(`${ data.random }message`)).atIndex(0).longPress();
await element(by.text(`${ data.random }message`)).atIndex(0).longPress();
await expect(element(by.id('action-sheet'))).toExist();
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
await element(by.label('Copy')).atIndex(0).tap();
await element(by.text('Copy')).atIndex(0).tap();
// TODO: test clipboard
});
@ -186,7 +192,7 @@ describe('Room screen', () => {
await starMessage('message');
await sleep(1000); // https://github.com/RocketChat/Rocket.Chat.ReactNative/issues/2324
await element(by.label(`${ data.random }message`)).atIndex(0).longPress();
await element(by.text(`${ data.random }message`)).atIndex(0).longPress();
await expect(element(by.id('action-sheet'))).toExist();
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
await element(by.id('action-sheet-handle')).swipe('up', 'slow', 0.5);
@ -195,7 +201,12 @@ describe('Room screen', () => {
});
it('should react to message', async() => {
await element(by.label(`${ data.random }message`)).atIndex(0).longPress();
if (device.getPlatform() === 'android') {
return; // FIXME: Detox tests halt on android while rendering GIFs
}
await waitFor(element(by.id('action-sheet-handle'))).toBeNotVisible();
await sleep(300);
await element(by.text(`${ data.random }message`)).atIndex(0).longPress();
await expect(element(by.id('action-sheet'))).toExist();
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
@ -208,7 +219,10 @@ describe('Room screen', () => {
});
it('should react to message with frequently used emoji', async() => {
await element(by.label(`${ data.random }message`)).atIndex(0).longPress();
if (device.getPlatform() === 'android') {
return; // FIXME: Detox tests halt on android while rendering GIFs
}
await element(by.text(`${ data.random }message`)).atIndex(0).longPress();
await expect(element(by.id('action-sheet'))).toExist();
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
@ -217,57 +231,71 @@ describe('Room screen', () => {
await waitFor(element(by.id('message-reaction-:+1:'))).toBeVisible().withTimeout(60000);
});
it('should show reaction picker on add reaction button pressed and have frequently used emoji', async() => {
it('should show reaction picker on add reaction button pressed and have frequently used emoji, and dismiss review nag', async() => {
if (device.getPlatform() === 'android') {
return; // FIXME: Detox tests halt on android while rendering GIFs
}
await element(by.id('message-add-reaction')).tap();
await waitFor(element(by.id('reaction-picker'))).toExist().withTimeout(2000);
await waitFor(element(by.id('reaction-picker-grinning'))).toExist().withTimeout(2000);
await element(by.id('reaction-picker-😃')).tap();
await waitFor(element(by.id('reaction-picker-grimacing'))).toExist().withTimeout(2000);
await element(by.id('reaction-picker-grimacing')).tap();
await dismissReviewNag();
await waitFor(element(by.id('message-reaction-:grimacing:'))).toExist().withTimeout(60000);
});
it('should ask for review', async() => {
await dismissReviewNag(); // TODO: Create a proper test for this elsewhere.
});
// it('should ask for review', async() => {
// await dismissReviewNag(); // TODO: Create a proper test for this elsewhere.
// });
// Moved in previous test because toExist doesn't detect element while review popup covers it, on Android
it('should remove reaction', async() => {
if (device.getPlatform() === 'android') {
return; // FIXME: Detox tests halt on android while rendering GIFs
}
await element(by.id('message-reaction-:grinning:')).tap();
await waitFor(element(by.id('message-reaction-:grinning:'))).toBeNotVisible().withTimeout(60000);
});
it('should edit message', async() => {
if (device.getPlatform() === 'android') {
return; // FIXME: Failing on android
}
await mockMessage('edit');
await element(by.label(`${ data.random }edit`)).atIndex(0).longPress();
await element(by.text(`${ data.random }edit`)).atIndex(0).longPress();
await expect(element(by.id('action-sheet'))).toExist();
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
await element(by.label('Edit')).atIndex(0).tap();
await element(by.id('messagebox-input')).typeText('ed');
await element(by.text('Edit')).atIndex(0).tap();
await element(by.id('messagebox-input')).replaceText(`${ data.random }edited`);
await element(by.id('messagebox-send-message')).tap();
await waitFor(element(by.label(`${ data.random }edited (edited)`)).atIndex(0)).toExist().withTimeout(60000);
await waitFor(element(by.text(`${ data.random }edited (edited)`)).atIndex(0)).toExist().withTimeout(60000); // Failing on android
});
it('should quote message', async() => {
await mockMessage('quote');
await element(by.label(`${ data.random }quote`)).atIndex(0).longPress();
await element(by.text(`${ data.random }quote`)).atIndex(0).longPress();
await expect(element(by.id('action-sheet'))).toExist();
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
await element(by.label('Quote')).atIndex(0).tap();
await element(by.id('messagebox-input')).typeText(`${ data.random }quoted`);
await element(by.text('Quote')).atIndex(0).tap();
await element(by.id('messagebox-input')).replaceText(`${ data.random }quoted`);
await element(by.id('messagebox-send-message')).tap();
// TODO: test if quote was sent
});
it('should pin message', async() => {
if (device.getPlatform() === 'android') {
return; // FIXME: Failing on android
}
await mockMessage('pin');
await pinMessage('pin');
await waitFor(element(by.label(`${ data.random }pin`)).atIndex(0)).toExist().withTimeout(5000);
await waitFor(element(by.label(`${ data.users.regular.username } Message pinned`)).atIndex(0)).toExist().withTimeout(5000);
await element(by.label(`${ data.random }pin`)).atIndex(0).longPress();
await waitFor(element(by.text(`${ data.random }pin`)).atIndex(0)).toExist().withTimeout(5000);
await waitFor(element(by.text(`${ data.users.regular.username } Message pinned`)).atIndex(0)).toExist().withTimeout(5000); // Failing on android
await element(by.text(`${ data.random }pin`)).atIndex(0).longPress();
await waitFor(element(by.id('action-sheet'))).toExist().withTimeout(1000);
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
@ -276,21 +304,21 @@ describe('Room screen', () => {
});
it('should delete message', async() => {
await mockMessage('delete');
await mockMessageWithNag('delete');
await waitFor(element(by.label(`${ data.random }delete`)).atIndex(0)).toBeVisible();
await element(by.label(`${ data.random }delete`)).atIndex(0).longPress();
await waitFor(element(by.text(`${ data.random }delete`)).atIndex(0)).toBeVisible();
await element(by.text(`${ data.random }delete`)).atIndex(0).longPress();
await expect(element(by.id('action-sheet'))).toExist();
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
await waitFor(element(by.label('Delete'))).toExist().withTimeout(1000);
await element(by.label('Delete')).atIndex(0).tap();
await waitFor(element(by.text('Delete'))).toExist().withTimeout(1000);
await element(by.text('Delete')).atIndex(0).tap();
const deleteAlertMessage = 'You will not be able to recover this message!';
await waitFor(element(by.text(deleteAlertMessage)).atIndex(0)).toExist().withTimeout(10000);
await element(by.text('Delete')).tap();
await waitFor(element(by.label(`${ data.random }delete`)).atIndex(0)).toNotExist().withTimeout(2000);
await waitFor(element(by.text(`${ data.random }delete`)).atIndex(0)).toNotExist().withTimeout(2000);
});
});
});

View File

@ -1,6 +1,6 @@
const data = require('../../data');
const {
navigateToLogin, login, tapBack, sleep, searchRoom, mockMessage, starMessage, pinMessage
navigateToLogin, login, tapBack, sleep, searchRoom, mockMessage, starMessage, pinMessage, platformTypes
} = require('../../helpers/app');
const { sendMessage } = require('../../helpers/data_setup');
@ -35,10 +35,12 @@ async function waitForToast() {
}
describe('Room actions screen', () => {
let alertButtonType;
before(async() => {
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
await navigateToLogin();
await login(data.users.regular.username, data.users.regular.password);
({ alertButtonType } = platformTypes[device.getPlatform()]);
});
describe('Render', () => {
@ -210,21 +212,26 @@ describe('Room actions screen', () => {
await waitFor(element(by.id('room-actions-view'))).toExist().withTimeout(5000);
// Go to starred messages
await element(by.id('room-actions-view')).swipe('up');
await waitFor(element(by.id('room-actions-starred'))).toExist();
await element(by.id('room-actions-starred')).tap();
await waitFor(element(by.id('starred-messages-view'))).toExist().withTimeout(2000);
await waitFor(element(by.label(`${ data.random }messageToStar`).withAncestor(by.id('starred-messages-view')))).toExist().withTimeout(60000);
await waitFor(element(by.text(`${ data.random }messageToStar`).withAncestor(by.id('starred-messages-view')))).toExist().withTimeout(60000);
// Unstar message
await element(by.label(`${ data.random }messageToStar`)).atIndex(0).longPress();
await element(by.text(`${ data.random }messageToStar`)).atIndex(0).longPress();
await expect(element(by.id('action-sheet'))).toExist();
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
await element(by.label('Unstar')).atIndex(0).tap();
await waitFor(element(by.label(`${ data.random }messageToStar`).withAncestor(by.id('starred-messages-view')))).toBeNotVisible().withTimeout(60000);
await waitFor(element(by.text(`${ data.random }messageToStar`).withAncestor(by.id('starred-messages-view')))).toBeNotVisible().withTimeout(60000);
await backToActions();
});
it('should show pinned message and unpin it', async() => {
if (device.getPlatform() === 'android') {
return; // FIXME: Failing on android
}
// Go back to room and send a message
await tapBack();
await mockMessage('messageToPin');
@ -239,14 +246,14 @@ describe('Room actions screen', () => {
await waitFor(element(by.id('room-actions-pinned'))).toExist();
await element(by.id('room-actions-pinned')).tap();
await waitFor(element(by.id('pinned-messages-view'))).toExist().withTimeout(2000);
await waitFor(element(by.label(`${ data.random }messageToPin`).withAncestor(by.id('pinned-messages-view')))).toExist().withTimeout(6000);
await element(by.label(`${ data.random }messageToPin`).withAncestor(by.id('pinned-messages-view'))).atIndex(0).longPress();
await waitFor(element(by.text(`${ data.random }messageToPin`).withAncestor(by.id('pinned-messages-view')))).toExist().withTimeout(6000);
await element(by.text(`${ data.random }messageToPin`).withAncestor(by.id('pinned-messages-view'))).atIndex(0).longPress();
await expect(element(by.id('action-sheet'))).toExist();
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
await element(by.label('Unpin')).atIndex(0).tap();
await waitFor(element(by.label(`${ data.random }messageToPin`).withAncestor(by.id('pinned-messages-view')))).not.toExist().withTimeout(6000);
await waitFor(element(by.text(`${ data.random }messageToPin`).withAncestor(by.id('pinned-messages-view')))).not.toExist().withTimeout(6000);
await backToActions();
});
@ -264,7 +271,7 @@ describe('Room actions screen', () => {
// await waitFor(element(by.id('search-messages-view'))).toExist().withTimeout(2000);
// await expect(element(by.id('search-message-view-input'))).toExist();
// await element(by.id('search-message-view-input')).replaceText(`/${ data.random }messageToFind/`);
// await waitFor(element(by.label(`${ data.random }messageToFind`).withAncestor(by.id('search-messages-view')))).toExist().withTimeout(60000);
// await waitFor(element(by.text(`${ data.random }messageToFind`).withAncestor(by.id('search-messages-view')))).toExist().withTimeout(60000);
// await backToActions();
// });
});
@ -299,7 +306,7 @@ describe('Room actions screen', () => {
it('should have notification sound option', async() => {
// Ugly hack to scroll on detox
await element(by.id('room-actions-scrollview')).scrollTo('bottom');
// await element(by.id('room-actions-scrollview')).scrollTo('bottom');
await waitFor(element(by.id('notification-preference-view-sound'))).toExist().withTimeout(4000);
});
@ -367,14 +374,25 @@ describe('Room actions screen', () => {
const openActionSheet = async(username) => {
await waitFor(element(by.id(`room-members-view-item-${ username }`))).toExist().withTimeout(5000);
await element(by.id(`room-members-view-item-${ username }`)).tap();
await sleep(300);
await expect(element(by.id('action-sheet'))).toExist();
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
let n = 0;
while (n < 3) {
// Max tries three times, in case it does not register the click
try {
await element(by.id(`room-members-view-item-${ username }`)).tap();
await waitFor(element(by.id('action-sheet'))).toExist().withTimeout(5000);
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
await element(by.id('action-sheet-handle')).swipe('up');
return;
} catch (e) {
n += 1;
}
}
};
const closeActionSheet = async() => {
await element(by.id('action-sheet-handle')).swipe('down', 'fast', 0.6);
await waitFor(element(by.id('action-sheet'))).toBeNotVisible().withTimeout(1000);
await sleep(100);
};
it('should show all users', async() => {
@ -393,9 +411,9 @@ describe('Room actions screen', () => {
it('should remove user from room', async() => {
await openActionSheet('rocket.cat');
await element(by.label('Remove from room')).atIndex(0).tap();
await waitFor(element(by.label('Are you sure?'))).toExist().withTimeout(5000);
await element(by.label('Yes, remove user!').and(by.type('_UIAlertControllerActionView'))).tap();
await element(by.label('Remove from room')).tap();
await waitFor(element(by.text('Are you sure?'))).toExist().withTimeout(5000);
await element(by.text('Yes, remove user!').and(by.type(alertButtonType))).tap();
await waitFor(element(by.id('room-members-view-item-rocket.cat'))).toBeNotVisible().withTimeout(60000);
});
@ -452,15 +470,15 @@ describe('Room actions screen', () => {
it('should set/remove as mute', async() => {
await openActionSheet(user.username);
await element(by.label('Mute')).atIndex(0).tap();
await waitFor(element(by.label('Are you sure?'))).toExist().withTimeout(5000);
await element(by.label('Mute').and(by.type('_UIAlertControllerActionView'))).tap();
await element(by.label('Mute')).tap();
await waitFor(element(by.text('Are you sure?'))).toExist().withTimeout(5000);
await element(by.text('Mute').and(by.type(alertButtonType))).tap();
await waitForToast();
await openActionSheet(user.username);
await element(by.label('Unmute')).atIndex(0).tap();
await waitFor(element(by.label('Are you sure?'))).toExist().withTimeout(5000);
await element(by.label('Unmute').and(by.type('_UIAlertControllerActionView'))).tap();
await element(by.label('Unmute')).tap();
await waitFor(element(by.text('Are you sure?'))).toExist().withTimeout(5000);
await element(by.text('Unmute').and(by.type(alertButtonType))).tap();
await waitForToast();
await openActionSheet(user.username);
@ -479,10 +497,10 @@ describe('Room actions screen', () => {
await backToActions();
await tapBack();
await waitFor(element(by.id('room-view'))).toExist().withTimeout(60000);
await waitFor(element(by.label('Message ignored. Tap to display it.')).atIndex(0)).toExist().withTimeout(60000);
await element(by.label('Message ignored. Tap to display it.')).atIndex(0).tap();
await waitFor(element(by.label(message)).atIndex(0)).toExist().withTimeout(60000);
await element(by.label(message)).atIndex(0).tap();
await waitFor(element(by.text('Message ignored. Tap to display it.')).atIndex(0)).toExist().withTimeout(60000);
await element(by.text('Message ignored. Tap to display it.')).atIndex(0).tap();
await waitFor(element(by.text(message)).atIndex(0)).toExist().withTimeout(60000);
await element(by.text(message)).atIndex(0).tap();
});
it('should navigate to direct message', async() => {
@ -508,11 +526,12 @@ describe('Room actions screen', () => {
});
it('should block/unblock user', async() => {
await element(by.id('room-actions-scrollview')).scrollTo('bottom');
await waitFor(element(by.id('room-actions-block-user'))).toExist();
await element(by.id('room-actions-block-user')).tap();
await waitFor(element(by.label('Unblock user'))).toExist().withTimeout(60000);
await waitFor(element(by.text('Unblock user'))).toExist().withTimeout(60000);
await element(by.id('room-actions-block-user')).tap();
await waitFor(element(by.label('Block user'))).toExist().withTimeout(60000);
await waitFor(element(by.text('Block user'))).toExist().withTimeout(60000);
});
});
});

View File

@ -25,7 +25,7 @@ describe('Discussion', () => {
await element(by.label('Create Discussion')).atIndex(0).tap();
await waitFor(element(by.id('create-discussion-view'))).toExist().withTimeout(60000);
await expect(element(by.id('create-discussion-view'))).toExist();
await element(by.label('Select a Channel...')).tap();
await element(by.text('Select a Channel...')).tap();
await element(by.id('multi-select-search')).replaceText(`${ channel }`);
await waitFor(element(by.id(`multi-select-item-${ channel }`))).toExist().withTimeout(10000);
await element(by.id(`multi-select-item-${ channel }`)).tap();
@ -43,7 +43,7 @@ describe('Discussion', () => {
await navigateToRoom();
await element(by.id('messagebox-actions')).tap();
await waitFor(element(by.id('action-sheet'))).toExist().withTimeout(2000);
await element(by.label('Create Discussion')).atIndex(0).tap();
await element(by.text('Create Discussion')).atIndex(0).tap();
await waitFor(element(by.id('create-discussion-view'))).toExist().withTimeout(2000);
await element(by.id('multi-select-discussion-name')).replaceText(discussionName);
await waitFor(element(by.id('create-discussion-submit'))).toExist().withTimeout(10000);
@ -60,9 +60,9 @@ describe('Discussion', () => {
it('should create discussion', async() => {
const discussionName = `${ data.random }message`;
await element(by.label(discussionName)).atIndex(0).longPress();
await element(by.text(discussionName)).atIndex(0).longPress();
await waitFor(element(by.id('action-sheet'))).toExist().withTimeout(2000);
await element(by.label('Start a Discussion')).atIndex(0).tap();
await element(by.text('Start a Discussion')).atIndex(0).tap();
await waitFor(element(by.id('create-discussion-view'))).toExist().withTimeout(2000);
await element(by.id('create-discussion-submit')).tap();
await waitFor(element(by.id('room-view'))).toExist().withTimeout(10000);
@ -98,6 +98,7 @@ describe('Discussion', () => {
});
it('should have starred', async() => {
await element(by.id('room-actions-view')).swipe('up');
await expect(element(by.id('room-actions-starred'))).toBeVisible();
});

View File

@ -1,6 +1,6 @@
const data = require('../../data');
const {
navigateToLogin, login, mockMessage, tapBack, sleep, searchRoom, dismissReviewNag
navigateToLogin, login, mockMessage, tapBack, sleep, searchRoom, mockMessageWithNag
} = require('../../helpers/app');
async function navigateToRoom(roomName) {
@ -67,12 +67,12 @@ describe('Threads', () => {
const thread = `${ data.random }thread`;
it('should create thread', async() => {
await mockMessage('thread');
await element(by.label(thread)).atIndex(0).longPress();
await element(by.text(thread)).atIndex(0).longPress();
await expect(element(by.id('action-sheet'))).toExist();
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
await element(by.label('Reply in Thread')).atIndex(0).tap();
await element(by.id('messagebox-input')).typeText('replied');
await element(by.id('messagebox-input')).replaceText('replied');
await element(by.id('messagebox-send-message')).tap();
await waitFor(element(by.id(`message-thread-button-${ thread }`))).toExist().withTimeout(5000);
await expect(element(by.id(`message-thread-button-${ thread }`))).toExist();
@ -80,7 +80,7 @@ describe('Threads', () => {
it('should navigate to thread from button', async() => {
await element(by.id(`message-thread-button-${ thread }`)).tap();
await waitFor(element(by.id('room-view'))).toExist().withTimeout(5000);
await waitFor(element(by.id('room-view')).atIndex(0)).toExist().withTimeout(5000);
await waitFor(element(by.id(`room-view-title-${ thread }`))).toExist().withTimeout(5000);
await expect(element(by.id(`room-view-title-${ thread }`))).toExist();
await tapBack();
@ -88,7 +88,7 @@ describe('Threads', () => {
it('should toggle follow thread', async() => {
await element(by.id(`message-thread-button-${ thread }`)).tap();
await waitFor(element(by.id('room-view'))).toExist().withTimeout(5000);
await waitFor(element(by.id('room-view')).atIndex(0)).toExist().withTimeout(5000);
await waitFor(element(by.id(`room-view-title-${ thread }`))).toExist().withTimeout(5000);
await expect(element(by.id(`room-view-title-${ thread }`))).toExist();
await element(by.id('room-view-header-unfollow')).tap();
@ -106,14 +106,14 @@ describe('Threads', () => {
await waitFor(element(by.id('room-header').and(by.label(`${ mainRoom }`)))).toBeVisible().withTimeout(2000);
await waitFor(element(by.id('room-header').and(by.label(`${ data.random }thread`)))).toBeNotVisible().withTimeout(2000);
await sleep(500); // TODO: Find a better way to wait for the animation to finish and the messagebox-input to be available and usable :(
await waitFor(element(by.label(`${ data.random }${ messageText }`)).atIndex(0)).toNotExist().withTimeout(2000);
await waitFor(element(by.text(`${ data.random }${ messageText }`)).atIndex(0)).toNotExist().withTimeout(2000);
});
it('should mark send to channel and show on main channel', async() => {
const messageText = 'sendToChannel';
await element(by.id(`message-thread-button-${ thread }`)).tap();
await waitFor(element(by.id('messagebox-input-thread'))).toExist().withTimeout(5000);
await element(by.id('messagebox-input-thread')).typeText(messageText);
await element(by.id('messagebox-input-thread')).replaceText(messageText);
await element(by.id('messagebox-send-to-channel')).tap();
await element(by.id('messagebox-send-message')).tap();
await tapBack();
@ -125,11 +125,10 @@ describe('Threads', () => {
it('should navigate to thread from thread name', async() => {
const messageText = 'navthreadname';
await mockMessage('dummymessagebetweenthethread');
await dismissReviewNag(); // TODO: Create a proper test for this elsewhere.
await mockMessageWithNag('dummymessagebetweenthethread');
await element(by.id(`message-thread-button-${ thread }`)).tap();
await waitFor(element(by.id('messagebox-input-thread'))).toExist().withTimeout(5000);
await element(by.id('messagebox-input-thread')).typeText(messageText);
await element(by.id('messagebox-input-thread')).replaceText(messageText);
await element(by.id('messagebox-send-to-channel')).tap();
await element(by.id('messagebox-send-message')).tap();
await tapBack();
@ -159,7 +158,7 @@ describe('Threads', () => {
it('should draft thread message', async() => {
await element(by.id(`message-thread-button-${ thread }`)).tap();
await waitFor(element(by.id(`room-view-title-${ thread }`))).toExist().withTimeout(5000);
await element(by.id('messagebox-input-thread')).typeText(`${ thread }draft`);
await element(by.id('messagebox-input-thread')).replaceText(`${ thread }draft`);
await tapBack();
await element(by.id(`message-thread-button-${ thread }`)).tap();

View File

@ -4,7 +4,6 @@ const {
} = require('../../helpers/app');
describe('Group DM', () => {
before(async() => {
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });

View File

@ -26,9 +26,9 @@ describe('Mark as unread', () => {
const message = `${ data.random }message-mark-as-unread`;
const channelName = `@${ data.users.regular.username }`;
await sendMessage(data.users.alternate, channelName, message);
await waitFor(element(by.label(message)).atIndex(0)).toExist().withTimeout(30000);
await waitFor(element(by.text(message)).atIndex(0)).toExist().withTimeout(30000);
await sleep(300);
await element(by.label(message)).atIndex(0).longPress();
await element(by.text(message)).atIndex(0).longPress();
await waitFor(element(by.id('action-sheet-handle'))).toBeVisible().withTimeout(3000);
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
await element(by.label('Mark Unread')).atIndex(0).tap();

View File

@ -184,10 +184,11 @@ describe('Room info screen', () => {
await element(by.id('room-info-edit-view-topic')).replaceText('abc');
await element(by.id('room-info-edit-view-announcement')).replaceText('abc');
await element(by.id('room-info-edit-view-password')).replaceText('abc');
await element(by.id('room-info-edit-view-list')).swipe('up', 'fast', 0.5);
await element(by.id('room-info-edit-view-list')).swipe('up', 'fast', 0.3);
await element(by.id('room-info-edit-view-t')).tap();
await element(by.id('room-info-edit-view-ro')).longPress(); // https://github.com/facebook/react-native/issues/28032
await element(by.id('room-info-edit-view-react-when-ro')).tap();
await element(by.id('room-info-edit-view-list')).swipe('up', 'fast', 0.2);
await element(by.id('room-info-edit-view-reset')).tap();
// after reset
await expect(element(by.id('room-info-edit-view-name'))).toHaveText(privateRoomName);
@ -195,8 +196,9 @@ describe('Room info screen', () => {
await expect(element(by.id('room-info-edit-view-topic'))).toHaveText('');
await expect(element(by.id('room-info-edit-view-announcement'))).toHaveText('');
await expect(element(by.id('room-info-edit-view-password'))).toHaveText('');
await expect(element(by.id('room-info-edit-view-t'))).toHaveValue('1');
await expect(element(by.id('room-info-edit-view-ro'))).toHaveValue('0');
await element(by.id('room-info-edit-view-list')).swipe('down', 'fast', 0.2);
await expect(element(by.id('room-info-edit-view-t'))).toHaveToggleValue(true);
await expect(element(by.id('room-info-edit-view-ro'))).toHaveToggleValue(false);
await expect(element(by.id('room-info-edit-view-react-when-ro'))).toBeNotVisible();
await element(by.id('room-info-edit-view-list')).swipe('down', 'fast', 0.8);
});
@ -208,7 +210,7 @@ describe('Room info screen', () => {
await waitForToast();
await tapBack();
await waitFor(element(by.id('room-info-view'))).toExist().withTimeout(2000);
await expect(element(by.label('new description').withAncestor(by.id('room-info-view-description')))).toExist();
await expect(element(by.text('new description').withAncestor(by.id('room-info-view-description')))).toExist();
});
it('should change room topic', async() => {
@ -221,7 +223,7 @@ describe('Room info screen', () => {
await waitForToast();
await tapBack();
await waitFor(element(by.id('room-info-view'))).toExist().withTimeout(2000);
await expect(element(by.label('new topic').withAncestor(by.id('room-info-view-topic')))).toExist();
await expect(element(by.text('new topic').withAncestor(by.id('room-info-view-topic')))).toExist();
});
it('should change room announcement', async() => {
@ -234,25 +236,28 @@ describe('Room info screen', () => {
await waitForToast();
await tapBack();
await waitFor(element(by.id('room-info-view'))).toExist().withTimeout(2000);
await expect(element(by.label('new announcement').withAncestor(by.id('room-info-view-announcement')))).toExist();
await expect(element(by.text('new announcement').withAncestor(by.id('room-info-view-announcement')))).toExist();
});
it('should change room password', async() => {
await waitFor(element(by.id('room-info-view-edit-button'))).toExist().withTimeout(10000);
await element(by.id('room-info-view-edit-button')).tap();
await waitFor(element(by.id('room-info-edit-view'))).toExist().withTimeout(2000);
await element(by.id('room-info-edit-view-list')).swipe('up', 'fast', 0.5);
await element(by.id('room-info-edit-view-password')).replaceText('password');
await element(by.id('room-info-edit-view-list')).swipe('up', 'fast', 0.5);
await element(by.id('room-info-edit-view-submit')).tap();
await waitForToast();
});
it('should change room type', async() => {
await element(by.id('room-info-edit-view-list')).swipe('up', 'fast', 0.5);
await element(by.id('room-info-edit-view-list')).swipe('down', 'fast', 0.3);
await element(by.id('room-info-edit-view-t')).tap();
await element(by.id('room-info-edit-view-list')).swipe('up', 'fast', 0.2);
await element(by.id('room-info-edit-view-submit')).tap();
await waitForToast();
await element(by.id('room-info-edit-view-list')).swipe('down', 'fast', 0.2);
await element(by.id('room-info-edit-view-t')).tap();
await element(by.id('room-info-edit-view-list')).swipe('up', 'fast', 0.2);
await element(by.id('room-info-edit-view-submit')).tap();
await waitForToast();
});

View File

@ -1,6 +1,6 @@
const data = require('../../data');
const {
navigateToLogin, tapBack, login, searchRoom
navigateToLogin, tapBack, login, searchRoom, sleep, platformTypes
} = require('../../helpers/app');
async function navigateToRoom(roomName) {
@ -10,6 +10,7 @@ async function navigateToRoom(roomName) {
}
async function clearCache() {
const { alertButtonType } = platformTypes[device.getPlatform()];
await waitFor(element(by.id('room-view'))).toBeVisible().withTimeout(5000);
await tapBack();
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(10000);
@ -19,13 +20,17 @@ async function clearCache() {
await waitFor(element(by.id('settings-view'))).toBeVisible().withTimeout(2000);
await element(by.id('settings-view-clear-cache')).tap();
await waitFor(element(by.text('This will clear all your offline data.'))).toExist().withTimeout(2000);
await element(by.label('Clear').and(by.type('_UIAlertControllerActionView'))).tap();
await element(by.text('Clear').and(by.type(alertButtonType))).tap();
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(5000);
await waitFor(element(by.id('rooms-list-view-item-jumping'))).toExist().withTimeout(10000);
}
async function waitForLoading() {
await waitFor(element(by.id('loading'))).toBeVisible().withTimeout(5000);
if (device.getPlatform() === 'android') {
await sleep(10000);
return; // Loading indicator doesn't animate properly on android
}
await waitFor(element(by.id('loading'))).toBeVisible().withTimeout(5000); // Fails on Android
await waitFor(element(by.id('loading'))).toBeNotVisible().withTimeout(10000);
}
@ -37,30 +42,39 @@ describe('Room', () => {
});
it('should jump to an old message and load its surroundings', async() => {
if (device.getPlatform() === 'android') {
return; // 'Room' tests don't work well on Android currently
}
await navigateToRoom('jumping');
await waitFor(element(by.label('Quote first message'))).toExist().withTimeout(5000);
await element(by.label('1')).atIndex(0).tap();
await waitFor(element(by.text('Quote first message'))).toExist().withTimeout(5000);
await element(by.text('1')).atIndex(0).tap();
await waitForLoading();
await waitFor(element(by.label('1')).atIndex(0)).toExist().withTimeout(10000);
await expect(element(by.label('2'))).toExist();
await waitFor(element(by.text('1')).atIndex(0)).toExist().withTimeout(10000);
await expect(element(by.text('2'))).toExist();
});
it('should tap FAB and scroll to bottom', async() => {
if (device.getPlatform() === 'android') {
return; // 'Room' tests don't work well on Android currently
}
await waitFor(element(by.id('nav-jump-to-bottom'))).toExist().withTimeout(5000);
await element(by.id('nav-jump-to-bottom')).tap();
await waitFor(element(by.label('Quote first message'))).toExist().withTimeout(5000);
await waitFor(element(by.text('Quote first message'))).toExist().withTimeout(5000);
await clearCache();
});
it('should load messages on scroll', async() => {
if (device.getPlatform() === 'android') {
return; // 'Room' tests don't work well on Android currently
}
await navigateToRoom('jumping');
await waitFor(element(by.id('room-view-messages'))).toExist().withTimeout(5000);
await waitFor(element(by.label('300'))).toExist().withTimeout(5000);
await waitFor(element(by.text('300'))).toExist().withTimeout(5000);
let found = false;
while (!found) {
await element(by.id('room-view-messages')).atIndex(0).scroll(500, 'up');
await element(by.id('room-view-messages')).atIndex(0).scroll(500, 'down');
try {
await expect(element(by.label('249'))).toExist();
await expect(element(by.text('249'))).toExist();
found = true;
} catch {
//
@ -70,72 +84,79 @@ describe('Room', () => {
});
it('should search for old message and load its surroundings', async() => {
if (device.getPlatform() === 'android') {
return; // 'Room' tests don't work well on Android currently
}
await navigateToRoom('jumping');
await element(by.id('room-view-search')).tap();
await waitFor(element(by.id('search-messages-view'))).toExist().withTimeout(5000);
await element(by.id('search-message-view-input')).typeText('30\n');
await waitFor(element(by.label('30')).atIndex(0)).toExist().withTimeout(5000);
await element(by.label('30')).atIndex(0).tap();
await element(by.id('search-message-view-input')).replaceText('30');
await waitFor(element(by.text('30')).atIndex(1)).toExist().withTimeout(5000);
await element(by.text('30')).atIndex(1).tap();
await waitForLoading();
await expect(element(by.label('30'))).toExist();
await expect(element(by.label('31'))).toExist();
await expect(element(by.label('32'))).toExist();
await expect(element(by.text('30'))).toExist();
await expect(element(by.text('31'))).toExist();
await expect(element(by.text('32'))).toExist();
await waitFor(element(by.text('32'))).toBeVisible().withTimeout(5000);
});
it('should load newer and older messages', async() => {
if (device.getPlatform() === 'android') {
return; // 'Room' tests don't work well on Android currently
}
await element(by.id('room-view-messages')).atIndex(0).swipe('down', 'fast', 0.8);
await waitFor(element(by.label('5'))).toExist().withTimeout(10000);
await waitFor(element(by.text('5'))).toExist().withTimeout(10000);
await waitFor(element(by.label('Load Older'))).toExist().withTimeout(5000);
await element(by.label('Load Older')).atIndex(0).tap();
await waitFor(element(by.label('4'))).toExist().withTimeout(5000);
await waitFor(element(by.text('4'))).toExist().withTimeout(5000);
await element(by.id('room-view-messages')).atIndex(0).swipe('down', 'fast', 0.5);
await waitFor(element(by.label('1'))).toExist().withTimeout(5000);
await waitFor(element(by.text('1'))).toExist().withTimeout(5000);
await element(by.id('room-view-messages')).atIndex(0).swipe('up', 'fast', 0.5);
await waitFor(element(by.label('25'))).toExist().withTimeout(5000);
await waitFor(element(by.text('25'))).toExist().withTimeout(5000);
await element(by.id('room-view-messages')).atIndex(0).swipe('up', 'fast', 0.5);
await waitFor(element(by.label('50'))).toExist().withTimeout(5000);
await waitFor(element(by.text('50'))).toExist().withTimeout(5000);
await element(by.id('room-view-messages')).atIndex(0).swipe('up', 'slow', 0.5);
await waitFor(element(by.label('Load Newer'))).toExist().withTimeout(5000);
await element(by.label('Load Newer')).atIndex(0).tap();
await waitFor(element(by.label('104'))).toExist().withTimeout(5000);
await waitFor(element(by.text('104'))).toExist().withTimeout(5000);
await waitFor(element(by.label('Load Newer'))).toExist().withTimeout(5000);
await element(by.label('Load Newer')).atIndex(0).tap();
await waitFor(element(by.label('154'))).toExist().withTimeout(5000);
await waitFor(element(by.text('154'))).toExist().withTimeout(5000);
await waitFor(element(by.label('Load Newer'))).toExist().withTimeout(5000);
await element(by.label('Load Newer')).atIndex(0).tap();
await waitFor(element(by.label('Load Newer'))).toNotExist().withTimeout(5000);
await expect(element(by.label('Load More'))).toNotExist();
await expect(element(by.label('201'))).toExist();
await expect(element(by.label('202'))).toExist();
await expect(element(by.text('201'))).toExist();
await expect(element(by.text('202'))).toExist();
await tapBack();
});
});
const expectThreadMessages = async(message) => {
await waitFor(element(by.id('room-view-title-jumping-thread'))).toExist().withTimeout(5000);
await expect(element(by.label(message))).toExist();
await expect(element(by.text(message)).atIndex(0)).toExist();
};
describe('Threads', () => {
it('should navigate to a thread from another room', async() => {
await navigateToRoom('jumping');
await waitFor(element(by.label('Go to jumping-thread\'s thread')).atIndex(0)).toExist().withTimeout(5000);
await element(by.label('Go to jumping-thread\'s thread')).atIndex(0).tap();
await waitFor(element(by.text('Go to jumping-thread\'s thread')).atIndex(0)).toExist().withTimeout(5000);
await element(by.text('Go to jumping-thread\'s thread')).atIndex(0).tap();
await waitForLoading();
await expectThreadMessages('Go to jumping-thread\'s thread');
await tapBack();
});
it('should tap on thread message from main room', async() => {
await waitFor(element(by.label('thread message sent to main room')).atIndex(0)).toExist().withTimeout(5000);
await element(by.label('thread message sent to main room')).atIndex(0).tap();
await waitFor(element(by.text('thread message sent to main room')).atIndex(0)).toExist().withTimeout(5000);
await element(by.text('thread message sent to main room')).atIndex(0).tap();
await expectThreadMessages('thread message sent to main room');
await tapBack();
});
it('should tap on quote', async() => {
await waitFor(element(by.label('quoted'))).toExist().withTimeout(5000);
await element(by.label('quoted')).atIndex(0).tap();
await waitFor(element(by.text('quoted'))).toExist().withTimeout(5000);
await element(by.text('quoted')).atIndex(0).tap();
await expectThreadMessages('quoted');
await tapBack();
});
@ -144,9 +165,9 @@ describe('Threads', () => {
await waitFor(element(by.id('room-view-title-jumping-thread'))).toExist().withTimeout(5000);
await element(by.id('room-view-search')).atIndex(0).tap();
await waitFor(element(by.id('search-messages-view'))).toExist().withTimeout(5000);
await element(by.id('search-message-view-input')).typeText('to be searched\n');
await waitFor(element(by.label('to be searched'))).toExist().withTimeout(5000);
await element(by.label('to be searched')).atIndex(1).tap();
await element(by.id('search-message-view-input')).replaceText('to be searched');
await waitFor(element(by.text('to be searched')).atIndex(1)).toExist().withTimeout(5000);
await element(by.text('to be searched')).atIndex(1).tap();
await expectThreadMessages('to be searched');
});

View File

@ -35,7 +35,7 @@ describe('Create team screen', () => {
describe('Create Team', () => {
describe('Usage', () => {
it('should get invalid team name', async() => {
await element(by.id('create-channel-name')).typeText(`${ data.teams.private.name }`);
await element(by.id('create-channel-name')).replaceText(`${ data.teams.private.name }`);
await element(by.id('create-channel-submit')).tap();
await waitFor(element(by.text('OK'))).toBeVisible().withTimeout(5000);
await element(by.text('OK')).tap();
@ -43,7 +43,7 @@ describe('Create team screen', () => {
it('should create private team', async() => {
await element(by.id('create-channel-name')).replaceText('');
await element(by.id('create-channel-name')).typeText(teamName);
await element(by.id('create-channel-name')).replaceText(teamName);
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();
@ -62,6 +62,9 @@ describe('Create team screen', () => {
});
it('should delete team', async() => {
if (device.getPlatform() === 'android') {
return; // FIXME: Failing on android
}
await element(by.id('room-info-view-edit-button')).tap();
await element(by.id('room-info-edit-view-list')).swipe('up', 'fast', 0.5);
await element(by.id('room-info-edit-view-delete')).tap();

View File

@ -29,12 +29,28 @@ async function backToActions() {
}
async function closeActionSheet() {
await element(by.id('action-sheet-handle')).swipe('down', 'fast', 0.6);
await waitFor(element(by.id('action-sheet-handle'))).toBeNotVisible().withTimeout(3000);
await sleep(200);
}
async function waitForToast() {
await sleep(1000);
}
async function swipeTillVisible(container, find, direction = 'up', delta = 0.3, speed = 'slow') {
let found = false;
while (!found) {
try {
await element(container).swipe(direction, speed, delta);
await sleep(200);
await expect(element(find)).toBeVisible();
found = true;
} catch (e) {
//
}
}
}
describe('Team', () => {
const team = data.teams.private.name;
const user = data.users.alternate;
@ -77,7 +93,7 @@ describe('Team', () => {
describe('Team Channels Header', () => {
it('should have actions button ', async() => {
await expect(element(by.id('room-header'))).toExist();
await expect(element(by.id('room-header')).atIndex(0)).toExist();
});
it('should have team channels button ', async() => {
@ -109,13 +125,14 @@ describe('Team', () => {
await element(by.id('add-channel-team-view-create-channel')).tap();
await element(by.id('select-users-view-search')).replaceText('rocket.cat');
await waitFor(element(by.id('select-users-view-item-rocket.cat'))).toBeVisible().withTimeout(5000);
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-users-view-submit')).tap();
await waitFor(element(by.id('create-channel-view'))).toExist().withTimeout(10000);
await element(by.id('create-channel-name')).replaceText('');
await element(by.id('create-channel-name')).typeText(room);
await element(by.id('create-channel-name')).replaceText(room);
await element(by.id('create-channel-submit')).tap();
await waitFor(element(by.id('room-view'))).toExist().withTimeout(20000);
@ -129,9 +146,9 @@ describe('Team', () => {
await element(by.id(`rooms-list-view-item-${ room }`)).tap();
await waitFor(element(by.id(`room-view-title-${ room }`))).toExist().withTimeout(60000);
await expect(element(by.id(`room-view-title-${ room }`))).toExist();
await expect(element(by.id('room-view-header-team-channels'))).toExist();
await expect(element(by.id('room-view-header-threads'))).toExist();
await expect(element(by.id('room-view-search'))).toExist();
await expect(element(by.id('room-view-header-team-channels')).atIndex(0)).toExist();
await expect(element(by.id('room-view-header-threads')).atIndex(0)).toExist();
await expect(element(by.id('room-view-search')).atIndex(0)).toExist();
await tapBack();
});
@ -151,12 +168,13 @@ describe('Team', () => {
await expect(element(by.id('room-view-header-team-channels'))).toExist();
await element(by.id('room-view-header-team-channels')).tap();
await waitFor(element(by.id(`rooms-list-view-item-${ existingRoom }`))).toExist().withTimeout(10000);
await waitFor(element(by.id(`rooms-list-view-item-${ existingRoom }`)).atIndex(0)).toExist().withTimeout(10000);
});
it('should activate/deactivate auto-join to channel', async() => {
await element(by.id(`rooms-list-view-item-${ existingRoom }`)).atIndex(0).longPress();
await sleep(500);
await swipeTillVisible(by.id('action-sheet-remove-from-team'), by.id('action-sheet-delete'));
await waitFor(element(by.id('action-sheet-auto-join'))).toBeVisible().withTimeout(5000);
await waitFor(element(by.id('auto-join-unchecked'))).toBeVisible().withTimeout(5000);
await waitFor(element(by.id('action-sheet-remove-from-team'))).toBeVisible().withTimeout(5000);
@ -169,7 +187,7 @@ describe('Team', () => {
await waitFor(element(by.id('auto-join-checked'))).toBeVisible().withTimeout(5000);
await element(by.id('auto-join-checked')).tap();
await waitFor(element(by.id('auto-join-tag'))).toBeNotVisible().withTimeout(5000);
await waitFor(element(by.id(`rooms-list-view-item-${ existingRoom }`))).toExist().withTimeout(6000);
await waitFor(element(by.id(`rooms-list-view-item-${ existingRoom }`)).atIndex(0)).toExist().withTimeout(6000);
});
});
@ -215,7 +233,7 @@ describe('Team', () => {
await waitFor(element(by.id(`select-list-view-item-${ existingRoom }`))).toExist().withTimeout(2000);
await element(by.id(`select-list-view-item-${ room }`)).tap();
await waitFor(element(by.label('You are the last owner of this channel. Once you leave the team, the channel will be kept inside the team but you will be managing it from outside.'))).toExist().withTimeout(2000);
await waitFor(element(by.text('You are the last owner of this channel. Once you leave the team, the channel will be kept inside the team but you will be managing it from outside.'))).toExist().withTimeout(2000);
await element(by.text('OK')).tap();
await waitFor(element(by.id('select-list-view-submit'))).toExist().withTimeout(2000);
await element(by.id('select-list-view-submit')).tap();
@ -247,6 +265,7 @@ describe('Team', () => {
it('should remove member from team', async() => {
await openActionSheet('rocket.cat');
await swipeTillVisible(by.id('room-actions-scrollview'), by.id('action-sheet-remove-from-team'));
await element(by.id('action-sheet-remove-from-team')).tap();
await waitFor(element(by.id('select-list-view'))).toExist().withTimeout(5000);
await waitFor(element(by.id(`select-list-view-item-${ room }`))).toExist().withTimeout(5000);
@ -279,7 +298,7 @@ describe('Team', () => {
await waitFor(element(by.id(`select-list-view-item-${ existingRoom }`))).toExist().withTimeout(2000);
await element(by.id(`select-list-view-item-${ room }`)).tap();
await waitFor(element(by.label('You are the last owner of this channel. Once you leave the team, the channel will be kept inside the team but you will be managing it from outside.'))).toExist().withTimeout(2000);
await waitFor(element(by.text('You are the last owner of this channel. Once you leave the team, the channel will be kept inside the team but you will be managing it from outside.'))).toExist().withTimeout(2000);
await element(by.text('OK')).tap();
await waitFor(element(by.id('select-list-view-submit'))).toExist().withTimeout(2000);
await element(by.id('select-list-view-submit')).tap();

View File

@ -13,7 +13,7 @@ const createChannel = async(room) => {
await waitFor(element(by.id('select-users-view'))).toExist().withTimeout(5000);
await element(by.id('selected-users-view-submit')).tap();
await waitFor(element(by.id('create-channel-view'))).toExist().withTimeout(10000);
await element(by.id('create-channel-name')).typeText(room);
await element(by.id('create-channel-name')).replaceText(room);
await element(by.id('create-channel-submit')).tap();
await waitFor(element(by.id('room-view'))).toExist().withTimeout(60000);
await waitFor(element(by.id(`room-view-title-${ room }`))).toExist().withTimeout(60000);
@ -51,7 +51,7 @@ describe('Move/Convert Team', () => {
await element(by.id('room-actions-scrollview')).scrollTo('bottom');
await waitFor(element(by.id('room-actions-convert-to-team'))).toExist().withTimeout(2000);
await element(by.id('room-actions-convert-to-team')).tap();
await waitFor(element(by.label('You are converting this Channel to a Team. All Members will be kept.'))).toExist().withTimeout(2000);
await waitFor(element(by.text('You are converting this Channel to a Team. All Members will be kept.'))).toExist().withTimeout(2000);
await element(by.text('Convert')).tap();
await waitFor(element(by.id('room-view'))).toExist().withTimeout(20000);
await waitFor(element(by.id(`room-view-title-${ toBeConverted }`))).toExist().withTimeout(6000);
@ -76,11 +76,11 @@ describe('Move/Convert Team', () => {
await waitFor(element(by.id('select-list-view'))).toExist().withTimeout(2000);
await element(by.id('select-list-view-submit')).tap();
await sleep(2000);
await waitFor(element(by.id('select-list-view'))).toExist().withTimeout(2000);
await waitFor(element(by.id('select-list-view')).atIndex(0)).toExist().withTimeout(2000);
await waitFor(element(by.id(`select-list-view-item-${ toBeConverted }`))).toExist().withTimeout(2000);
await element(by.id(`select-list-view-item-${ toBeConverted }`)).tap();
await element(by.id('select-list-view-submit')).atIndex(0).tap();
await waitFor(element(by.label('After reading the previous intructions about this behavior, do you still want to move this channel to the selected team?'))).toExist().withTimeout(2000);
await waitFor(element(by.text('After reading the previous intructions about this behavior, do you still want to move this channel to the selected team?'))).toExist().withTimeout(2000);
await element(by.text('Yes, move it!')).tap();
await waitFor(element(by.id('room-view-header-team-channels'))).toExist().withTimeout(10000);
});
@ -98,12 +98,12 @@ describe('Move/Convert Team', () => {
await waitFor(element(by.id('room-actions-convert-channel-to-team'))).toExist().withTimeout(2000);
await element(by.id('room-actions-convert-channel-to-team')).tap();
await sleep(2000);
await waitFor(element(by.id('select-list-view'))).toExist().withTimeout(2000);
await waitFor(element(by.id('select-list-view')).atIndex(0)).toExist().withTimeout(2000);
await waitFor(element(by.id(`select-list-view-item-${ toBeMoved }`))).toExist().withTimeout(2000);
await element(by.id(`select-list-view-item-${ toBeMoved }`)).tap();
await waitFor(element(by.id('select-list-view-submit'))).toExist().withTimeout(2000);
await element(by.id('select-list-view-submit')).tap();
await waitFor(element(by.label('You are converting this Team to a Channel'))).toExist().withTimeout(2000);
await waitFor(element(by.text('You are converting this Team to a Channel'))).toExist().withTimeout(2000);
await element(by.text('Convert')).tap();
await waitFor(element(by.id('room-view'))).toExist().withTimeout(20000);
await waitFor(element(by.id(`room-view-title-${ toBeConverted }`))).toExist().withTimeout(6000);

View File

@ -16,6 +16,8 @@
"precommit": "lint-staged",
"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",
"postinstall": "patch-package && jetify",
"e2e:android-debug": "detox build -c and.emu.debug && detox test -c and.emu.debug",
"e2e:android-release": "detox build -c and.emu.release && detox test -c and.emu.release",
"prepare": "husky install"
},
"lint-staged": {
@ -220,6 +222,18 @@
}
}
}
},
"and.emu.debug": {
"device": "Pixel_API_28_AOSP",
"type": "android.emulator",
"binaryPath": "android/app/build/outputs/apk/e2ePlay/debug/app-e2e-play-debug.apk",
"build": "cd android && ./gradlew app:assembleE2ePlayDebug app:assembleE2ePlayDebugAndroidTest -DtestBuildType=debug && cd .."
},
"and.emu.release": {
"device": "Pixel_API_28_AOSP",
"type": "android.emulator",
"binaryPath": "android/app/build/outputs/apk/e2ePlay/release/app-e2e-play-release.apk",
"build": "cd android && ./gradlew app:assembleE2ePlayRelease app:assembleE2ePlayReleaseAndroidTest -DtestBuildType=release && cd .."
}
}
}