[FIX] Detox tests (#2433)

* Spotlight issues

* Fix room tests

* Fix roomactions tests
This commit is contained in:
Diego Mello 2020-08-26 16:28:16 -03:00 committed by GitHub
parent cefce62bc5
commit 1d38ff0831
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 6 deletions

View File

@ -129,6 +129,7 @@ const Header = React.memo(({
return (
<TouchableOpacity
testID='room-view-header-actions'
accessibilityLabel={title}
onPress={onPress}
style={styles.container}
disabled={tmid}

View File

@ -66,11 +66,13 @@ describe('Create room screen', () => {
});
it('should select/unselect user', async() => {
await element(by.id('select-users-view-item-rocket.cat')).tap();
// Spotlight issues
await element(by.id('select-users-view-item-rocket.cat')).atIndex(0).tap();
await waitFor(element(by.id('selected-user-rocket.cat'))).toBeVisible().withTimeout(10000);
await element(by.id('selected-user-rocket.cat')).tap();
await waitFor(element(by.id('selected-user-rocket.cat'))).toBeNotVisible().withTimeout(10000);
await element(by.id('select-users-view-item-rocket.cat')).tap();
// Spotlight issues
await element(by.id('select-users-view-item-rocket.cat')).atIndex(0).tap();
await waitFor(element(by.id('selected-user-rocket.cat'))).toBeVisible().withTimeout(10000);
});

View File

@ -298,8 +298,8 @@ describe('Room screen', () => {
});
it('should navigate to thread from thread name', async() => {
await waitFor(element(by.id('room-view-header-actions').and(by.label(`${ mainRoom }`)))).toBeVisible().withTimeout(2000);
await waitFor(element(by.id('room-view-header-actions').and(by.label(`${ data.random }thread`)))).toBeNotVisible().withTimeout(2000);
await waitFor(element(by.id('room-view-header-actions').and(by.label(`${ mainRoom }`)))).toBeVisible().withTimeout(2000);
await waitFor(element(by.id('room-view-header-actions').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 mockMessage('dummymessagebetweenthethread');

View File

@ -14,8 +14,8 @@ async function navigateToRoomActions(type) {
room = data.groups.private.name;
}
await searchRoom(room);
await waitFor(element(by.id(`rooms-list-view-item-${ room }`))).toExist().withTimeout(60000);
await element(by.id(`rooms-list-view-item-${ room }`)).tap();
await waitFor(element(by.id(`rooms-list-view-item-${ room }`)).atIndex(0)).toExist().withTimeout(60000);
await element(by.id(`rooms-list-view-item-${ room }`)).atIndex(0).tap();
await waitFor(element(by.id('room-view'))).toExist().withTimeout(2000);
await element(by.id('room-view-header-actions')).tap();
await waitFor(element(by.id('room-actions-view'))).toExist().withTimeout(5000);
@ -332,6 +332,7 @@ describe('Room actions screen', () => {
const user = data.users.alternate
it('should tap on leave channel and raise alert', async() => {
await element(by.type('UIScrollView')).atIndex(1).scrollTo('bottom');
await waitFor(element(by.id('room-actions-leave-channel'))).toExist().withTimeout(2000);
await element(by.id('room-actions-leave-channel')).tap();
await waitFor(element(by.text('Yes, leave it!'))).toExist().withTimeout(2000);
@ -352,6 +353,7 @@ describe('Room actions screen', () => {
await waitFor(element(by.id(`selected-user-${ user.username }`))).toExist().withTimeout(5000);
await element(by.id('selected-users-view-submit')).tap();
await waitFor(element(by.id('room-actions-view'))).toExist().withTimeout(2000);
await waitFor(element(by.id('room-actions-members'))).toExist().withTimeout(2000);
await element(by.id('room-actions-members')).tap();
await element(by.id('room-members-view-toggle-status')).tap();
await waitFor(element(by.id(`room-members-view-item-${ user.username }`))).toExist().withTimeout(60000);