diff --git a/e2e/helpers/app.js b/e2e/helpers/app.js index d88996395..bfeae8d4d 100644 --- a/e2e/helpers/app.js +++ b/e2e/helpers/app.js @@ -84,7 +84,7 @@ async function pinMessage(message){ async function dismissReviewNag(){ 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('android.widget.Button'))).tap(); // Tap `no` on ask for review alert } async function tapBack() { diff --git a/e2e/helpers/platformTypes.js b/e2e/helpers/platformTypes.js new file mode 100644 index 000000000..af95e29d4 --- /dev/null +++ b/e2e/helpers/platformTypes.js @@ -0,0 +1,13 @@ +const { device } = require('detox'); + +export default device.getPlatform() === 'android' ? { + //Android types + alertButtonType: 'android.widget.Button', + scrollViewType: 'android.widget.ScrollView', + textInputType: 'android.widget.EditText', +} : { + //iOS types + alertButtonType: '_UIAlertControllerActionView', + scrollViewType: 'UIScrollView', + textInputType: '_UIAlertControllerTextField' +}; \ No newline at end of file diff --git a/e2e/tests/assorted/04-setting.spec.js b/e2e/tests/assorted/04-setting.spec.js index 14bdbe71f..966c86314 100644 --- a/e2e/tests/assorted/04-setting.spec.js +++ b/e2e/tests/assorted/04-setting.spec.js @@ -67,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('android.widget.Button'))).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); }) diff --git a/e2e/tests/assorted/05-joinpublicroom.spec.js b/e2e/tests/assorted/05-joinpublicroom.spec.js index 9b92d33b3..9e4319c0d 100644 --- a/e2e/tests/assorted/05-joinpublicroom.spec.js +++ b/e2e/tests/assorted/05-joinpublicroom.spec.js @@ -98,9 +98,9 @@ describe('Join public room', () => { await expect(element(by.id('room-actions-starred'))).toBeVisible(); }); - it('should have search', async() => { - await expect(element(by.id('room-actions-search'))).toBeVisible(); - }); + // it('should have search', async() => { + // await expect(element(by.id('room-actions-search'))).toBeVisible(); + // }); it('should have share', async() => { await expect(element(by.id('room-actions-share'))).toBeVisible(); @@ -150,11 +150,12 @@ describe('Join public room', () => { await expect(element(by.id('room-actions-files'))).toBeVisible(); await expect(element(by.id('room-actions-mentioned'))).toBeVisible(); await expect(element(by.id('room-actions-starred'))).toBeVisible(); - await expect(element(by.id('room-actions-search'))).toBeVisible(); - await element(by.type('UIScrollView')).atIndex(1).swipe('down'); + // await expect(element(by.id('room-actions-search'))).toBeVisible(); + await element(by.type('android.widget.ScrollView')).atIndex(1).swipe('down'); 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('android.widget.ScrollView')).atIndex(0).swipe('up'); await expect(element(by.id('room-actions-leave-channel'))).toBeVisible(); }); diff --git a/e2e/tests/assorted/06-status.spec.js b/e2e/tests/assorted/06-status.spec.js index 52c6f9b98..6d3053167 100644 --- a/e2e/tests/assorted/06-status.spec.js +++ b/e2e/tests/assorted/06-status.spec.js @@ -44,7 +44,7 @@ describe('Status screen', () => { await element(by.id('status-view-input')).typeText('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); }); }); }); \ No newline at end of file diff --git a/e2e/tests/assorted/10-deleteserver.spec.js b/e2e/tests/assorted/10-deleteserver.spec.js index 8e260fd70..ad797817e 100644 --- a/e2e/tests/assorted/10-deleteserver.spec.js +++ b/e2e/tests/assorted/10-deleteserver.spec.js @@ -42,7 +42,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('android.widget.Button'))).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); diff --git a/e2e/tests/room/03-roomactions.spec.js b/e2e/tests/room/03-roomactions.spec.js index fcfc86711..b013552aa 100644 --- a/e2e/tests/room/03-roomactions.spec.js +++ b/e2e/tests/room/03-roomactions.spec.js @@ -395,7 +395,7 @@ describe('Room actions screen', () => { await openActionSheet('rocket.cat'); await element(by.label('Remove from room')).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.text('Yes, remove user!').and(by.type('android.widget.Button'))).tap(); await waitFor(element(by.id('room-members-view-item-rocket.cat'))).toBeNotVisible().withTimeout(60000); }); @@ -466,13 +466,13 @@ describe('Room actions screen', () => { await openActionSheet(user.username); await element(by.label('Mute')).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.text('Mute').and(by.type('android.widget.Button'))).tap(); await waitForToast(); await openActionSheet(user.username); await element(by.label('Unmute')).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.text('Unmute').and(by.type('android.widget.Button'))).tap(); await waitForToast(); await openActionSheet(user.username); diff --git a/e2e/tests/room/04-discussion.spec.js b/e2e/tests/room/04-discussion.spec.js index e5705b26b..680c0e9dd 100644 --- a/e2e/tests/room/04-discussion.spec.js +++ b/e2e/tests/room/04-discussion.spec.js @@ -107,7 +107,7 @@ describe('Discussion', () => { }); it('should have share', async() => { - await element(by.type('UIScrollView')).atIndex(1).swipe('up'); + await element(by.type('android.widget.ScrollView')).atIndex(1).swipe('up'); await expect(element(by.id('room-actions-share'))).toBeVisible(); }); @@ -124,7 +124,7 @@ describe('Discussion', () => { }); it('should navigate to RoomActionView', async() => { - await element(by.type('UIScrollView')).atIndex(1).swipe('down'); + await element(by.type('android.widget.ScrollView')).atIndex(1).swipe('down'); await expect(element(by.id('room-actions-info'))).toBeVisible(); await element(by.id('room-actions-info')).tap(); await waitFor(element(by.id('room-info-view'))).toExist().withTimeout(60000);