[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 <reinaldonetof@hotmail.com>
This commit is contained in:
Gerzon Z 2022-05-31 12:50:10 -04:00 committed by GitHub
parent c85fd0ba99
commit 11c8510398
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 12 deletions

View File

@ -227,7 +227,7 @@ class Sidebar extends Component<ISidebarProps, ISidebarState> {
theme={theme} theme={theme}
right={<CustomIcon name='edit' size={20} color={themes[theme].titleText} />} right={<CustomIcon name='edit' size={20} color={themes[theme].titleText} />}
onPress={() => this.sidebarNavigate('StatusView')} onPress={() => this.sidebarNavigate('StatusView')}
testID='sidebar-custom-status' testID={`sidebar-custom-status-${user.status}`}
/> />
); );
}; };

View File

@ -3,10 +3,6 @@ const data = require('../../data');
const testuser = data.users.regular; const testuser = data.users.regular;
async function waitForToast() {
await sleep(300);
}
describe('Status screen', () => { describe('Status screen', () => {
before(async () => { before(async () => {
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true }); await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
@ -17,11 +13,11 @@ describe('Status screen', () => {
await waitFor(element(by.id('sidebar-view'))) await waitFor(element(by.id('sidebar-view')))
.toBeVisible() .toBeVisible()
.withTimeout(2000); .withTimeout(2000);
await waitFor(element(by.id('sidebar-custom-status'))) await waitFor(element(by.id('sidebar-custom-status-online')))
.toBeVisible() .toBeVisible()
.withTimeout(2000); .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'))) await waitFor(element(by.id('status-view')))
.toBeVisible() .toBeVisible()
.withTimeout(2000); .withTimeout(2000);
@ -40,19 +36,28 @@ describe('Status screen', () => {
describe('Usage', () => { describe('Usage', () => {
it('should change status', async () => { it('should change status', async () => {
await element(by.id('status-view-busy')).tap(); await element(by.id('status-view-busy')).tap();
await waitFor(element(by.id('status-view-current-busy'))) await element(by.id('status-view-submit')).tap();
.toExist() await sleep(3000); // Wait until the loading hide
await waitFor(element(by.id('rooms-list-view-sidebar')))
.toBeVisible()
.withTimeout(2000); .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 // TODO: flaky
it('should change status text', async () => { it('should change status text', async () => {
await element(by.id('status-view-input')).replaceText('status-text-new'); await element(by.id('status-view-input')).replaceText('status-text-new');
await element(by.id('status-view-submit')).tap(); await element(by.id('status-view-submit')).tap();
await waitForToast(); await sleep(3000); // Wait until the loading hide
await waitFor(element(by.label('status-text-new').withAncestor(by.id('sidebar-custom-status')))) await waitFor(element(by.label('status-text-new')))
.toExist() .toExist()
.withTimeout(2000); .withTimeout(5000);
}); });
}); });
}); });