From 11c85103988f72276527e35ceb56342e0a1df7ef Mon Sep 17 00:00:00 2001 From: Gerzon Z Date: Tue, 31 May 2022 12:50:10 -0400 Subject: [PATCH] [FIX] User status update (#3961) * update: `setCustomStatus` function * update: `StatusView`'s `setCustomStatus` * update: `setCustomStatus` function * update: `StatusView`'s `setCustomStatus` * refactor: `submit` function remove: setCustomStatus update: logEvent * remove: failed request logic * fix detox test Co-authored-by: Reinaldo Neto --- app/views/SidebarView/index.tsx | 2 +- e2e/tests/assorted/06-status.spec.js | 27 ++++++++++++++++----------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/app/views/SidebarView/index.tsx b/app/views/SidebarView/index.tsx index 5a354e0a..70a46f38 100644 --- a/app/views/SidebarView/index.tsx +++ b/app/views/SidebarView/index.tsx @@ -227,7 +227,7 @@ class Sidebar extends Component { theme={theme} right={} onPress={() => this.sidebarNavigate('StatusView')} - testID='sidebar-custom-status' + testID={`sidebar-custom-status-${user.status}`} /> ); }; diff --git a/e2e/tests/assorted/06-status.spec.js b/e2e/tests/assorted/06-status.spec.js index 4a6af055..e903f97e 100644 --- a/e2e/tests/assorted/06-status.spec.js +++ b/e2e/tests/assorted/06-status.spec.js @@ -3,10 +3,6 @@ const data = require('../../data'); const testuser = data.users.regular; -async function waitForToast() { - await sleep(300); -} - describe('Status screen', () => { before(async () => { await device.launchApp({ permissions: { notifications: 'YES' }, delete: true }); @@ -17,11 +13,11 @@ describe('Status screen', () => { await waitFor(element(by.id('sidebar-view'))) .toBeVisible() .withTimeout(2000); - await waitFor(element(by.id('sidebar-custom-status'))) + await waitFor(element(by.id('sidebar-custom-status-online'))) .toBeVisible() .withTimeout(2000); - await element(by.id('sidebar-custom-status')).tap(); + await element(by.id('sidebar-custom-status-online')).tap(); await waitFor(element(by.id('status-view'))) .toBeVisible() .withTimeout(2000); @@ -40,19 +36,28 @@ describe('Status screen', () => { describe('Usage', () => { it('should change status', async () => { await element(by.id('status-view-busy')).tap(); - await waitFor(element(by.id('status-view-current-busy'))) - .toExist() + await element(by.id('status-view-submit')).tap(); + await sleep(3000); // Wait until the loading hide + await waitFor(element(by.id('rooms-list-view-sidebar'))) + .toBeVisible() .withTimeout(2000); + await waitFor(element(by.id('sidebar-view'))) + .toBeVisible() + .withTimeout(2000); + await waitFor(element(by.id('sidebar-custom-status-busy'))) + .toBeVisible() + .withTimeout(2000); + await element(by.id('sidebar-custom-status-busy')).tap(); }); // TODO: flaky it('should change status text', async () => { 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')))) + await sleep(3000); // Wait until the loading hide + await waitFor(element(by.label('status-text-new'))) .toExist() - .withTimeout(2000); + .withTimeout(5000); }); }); });