[TESTS] Add e2e tests for mark message as unread (#2953)

* [E2E TEST] Add e2e tests for mark message as unread

* fixed test for draft message

* change test name

* move test to other file

* Remove unnecessary tests

* Rename file

* Update jest tests

Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
Gung Wah 2021-03-19 00:52:47 +08:00 committed by GitHub
parent 2ea7e9d3f9
commit 1eaf4b802b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 219 additions and 14 deletions

View File

@ -40818,17 +40818,44 @@ exports[`Storyshots Message list message 1`] = `
Object {
"backgroundColor": "transparent",
"fontFamily": "System",
"fontSize": 14,
"fontSize": 16,
"fontWeight": "400",
"textAlign": "left",
},
undefined,
Object {
"color": "#2f343d",
},
]
}
>
Value 1
<Text
accessibilityLabel="Value 1"
style={
Array [
Object {
"backgroundColor": "transparent",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
"textAlign": "left",
},
Array [
Object {},
Object {
"alignItems": "flex-start",
"flexDirection": "row",
"flexWrap": "wrap",
"justifyContent": "flex-start",
"marginBottom": 0,
"marginTop": 0,
},
],
]
}
>
Value 1
</Text>
</Text>
</View>
<View
@ -40868,17 +40895,44 @@ exports[`Storyshots Message list message 1`] = `
Object {
"backgroundColor": "transparent",
"fontFamily": "System",
"fontSize": 14,
"fontSize": 16,
"fontWeight": "400",
"textAlign": "left",
},
undefined,
Object {
"color": "#2f343d",
},
]
}
>
Value 2
<Text
accessibilityLabel="Value 2"
style={
Array [
Object {
"backgroundColor": "transparent",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
"textAlign": "left",
},
Array [
Object {},
Object {
"alignItems": "flex-start",
"flexDirection": "row",
"flexWrap": "wrap",
"justifyContent": "flex-start",
"marginBottom": 0,
"marginTop": 0,
},
],
]
}
>
Value 2
</Text>
</Text>
</View>
</View>
@ -40965,17 +41019,44 @@ exports[`Storyshots Message list message 1`] = `
Object {
"backgroundColor": "transparent",
"fontFamily": "System",
"fontSize": 14,
"fontSize": 16,
"fontWeight": "400",
"textAlign": "left",
},
undefined,
Object {
"color": "#2f343d",
},
]
}
>
Value 1
<Text
accessibilityLabel="Value 1"
style={
Array [
Object {
"backgroundColor": "transparent",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
"textAlign": "left",
},
Array [
Object {},
Object {
"alignItems": "flex-start",
"flexDirection": "row",
"flexWrap": "wrap",
"justifyContent": "flex-start",
"marginBottom": 0,
"marginTop": 0,
},
],
]
}
>
Value 1
</Text>
</Text>
</View>
<View
@ -41015,17 +41096,44 @@ exports[`Storyshots Message list message 1`] = `
Object {
"backgroundColor": "transparent",
"fontFamily": "System",
"fontSize": 14,
"fontSize": 16,
"fontWeight": "400",
"textAlign": "left",
},
undefined,
Object {
"color": "#2f343d",
},
]
}
>
Value 2
<Text
accessibilityLabel="Value 2"
style={
Array [
Object {
"backgroundColor": "transparent",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
"textAlign": "left",
},
Array [
Object {},
Object {
"alignItems": "flex-start",
"flexDirection": "row",
"flexWrap": "wrap",
"justifyContent": "flex-start",
"marginBottom": 0,
"marginTop": 0,
},
],
]
}
>
Value 2
</Text>
</Text>
</View>
</View>
@ -41112,17 +41220,44 @@ exports[`Storyshots Message list message 1`] = `
Object {
"backgroundColor": "transparent",
"fontFamily": "System",
"fontSize": 14,
"fontSize": 16,
"fontWeight": "400",
"textAlign": "left",
},
undefined,
Object {
"color": "#2f343d",
},
]
}
>
Value 1
<Text
accessibilityLabel="Value 1"
style={
Array [
Object {
"backgroundColor": "transparent",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
"textAlign": "left",
},
Array [
Object {},
Object {
"alignItems": "flex-start",
"flexDirection": "row",
"flexWrap": "wrap",
"justifyContent": "flex-start",
"marginBottom": 0,
"marginTop": 0,
},
],
]
}
>
Value 1
</Text>
</Text>
</View>
<View
@ -41162,17 +41297,44 @@ exports[`Storyshots Message list message 1`] = `
Object {
"backgroundColor": "transparent",
"fontFamily": "System",
"fontSize": 14,
"fontSize": 16,
"fontWeight": "400",
"textAlign": "left",
},
undefined,
Object {
"color": "#2f343d",
},
]
}
>
Value 2
<Text
accessibilityLabel="Value 2"
style={
Array [
Object {
"backgroundColor": "transparent",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
"textAlign": "left",
},
Array [
Object {},
Object {
"alignItems": "flex-start",
"flexDirection": "row",
"flexWrap": "wrap",
"justifyContent": "flex-start",
"marginBottom": 0,
"marginTop": 0,
},
],
]
}
>
Value 2
</Text>
</Text>
</View>
</View>

View File

@ -97,7 +97,6 @@ const sendMessage = async (user, groupname, msg) => {
await login(user.username, user.password);
await rocketchat.post('chat.postMessage', { channel: `#${groupname}`, msg });
} catch (infoError) {
console.log(JSON.stringify(createError))
console.log(JSON.stringify(infoError))
throw "Failed to find or create private group"
}

View File

@ -2,7 +2,7 @@ const {
device, expect, element, by, waitFor
} = require('detox');
const data = require('../../data');
const { navigateToLogin, login, mockMessage, tapBack, sleep, searchRoom, starMessage, pinMessage, dismissReviewNag, tryTapping } = require('../../helpers/app');
const { navigateToLogin, login, mockMessage, tapBack, sleep, searchRoom, starMessage, pinMessage, dismissReviewNag, tryTapping, logout } = require('../../helpers/app');
async function navigateToRoom(roomName) {
await searchRoom(`${ roomName }`);

View File

@ -0,0 +1,44 @@
const {
device, expect, element, by, waitFor
} = require('detox');
const data = require('../../data');
const { navigateToLogin, login, mockMessage, tapBack, searchRoom, logout } = require('../../helpers/app');
async function navigateToRoom(user) {
await searchRoom(`${ user }`);
await waitFor(element(by.id(`rooms-list-view-item-${ user }`))).toExist().withTimeout(60000);
await element(by.id(`rooms-list-view-item-${ user }`)).tap();
await waitFor(element(by.id('room-view'))).toBeVisible().withTimeout(5000);
}
describe('Mark as unread', () => {
const user = data.users.alternate.username
before(async() => {
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
await navigateToLogin();
await login(data.users.regular.username, data.users.regular.password);
await navigateToRoom(user);
});
describe('Usage', async() => {
describe('Mark message as unread', async() => {
it('should mark message as unread', async() => {
await mockMessage('message')
await expect(element(by.label(`${ data.random }message`)).atIndex(0)).toExist();
await tapBack();
await logout();
await navigateToLogin();
await login(data.users.alternate.username, data.users.alternate.password);
await navigateToRoom(data.users.regular.username);
await element(by.label(`${ 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('Mark Unread')).tap();
await waitFor(element(by.id('rooms-list-view'))).toExist().withTimeout(5000);
await expect(element(by.id(`rooms-list-view-item-${data.users.regular.username}`))).toExist();
});
});
});
});