Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 8 commits into from
Mar 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
186 changes: 174 additions & 12 deletions __tests__/__snapshots__/Storyshots.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion e2e/helpers/data_setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/room/02-room.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }`);
Expand Down
44 changes: 44 additions & 0 deletions e2e/tests/room/06-markasunread.spec.js
Original file line number Diff line number Diff line change
@@ -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();
});
});
});
});