[ANDROID] AccessibilityLabels and helper fns
This commit is contained in:
parent
1f4920f873
commit
3b42e13489
|
@ -135,6 +135,7 @@ const ActionSheet = React.memo(forwardRef(({ children, theme }, ref) => {
|
|||
onPress={hide}
|
||||
style={[styles.button, { backgroundColor: themes[theme].auxiliaryBackground }]}
|
||||
theme={theme}
|
||||
accessibilityLabel={I18n.t('Cancel')}
|
||||
>
|
||||
<Text style={[styles.text, { color: themes[theme].bodyText }]}>
|
||||
{I18n.t('Cancel')}
|
||||
|
|
|
@ -19,6 +19,7 @@ export const Item = React.memo(({ item, hide, theme }) => {
|
|||
style={[styles.item, { backgroundColor: themes[theme].focusedBackground }]}
|
||||
theme={theme}
|
||||
testID={item.testID}
|
||||
accessibilityLabel={item.title}
|
||||
>
|
||||
<CustomIcon name={item.icon} size={20} color={item.danger ? themes[theme].dangerColor : themes[theme].bodyText} />
|
||||
<View style={styles.titleContainer}>
|
||||
|
|
|
@ -153,6 +153,7 @@ class NewMessageView extends React.Component {
|
|||
style={{ backgroundColor: themes[theme].backgroundColor }}
|
||||
testID={testID}
|
||||
theme={theme}
|
||||
accessibilityLabel={title}
|
||||
>
|
||||
<View style={[first ? sharedStyles.separatorVertical : sharedStyles.separatorBottom, styles.button, { borderColor: themes[theme].separatorColor }]}>
|
||||
<CustomIcon style={[styles.buttonIcon, { color: themes[theme].tintColor }]} size={24} name={icon} />
|
||||
|
|
|
@ -92,6 +92,17 @@ async function dismissReviewNag(){
|
|||
await element(by.text('NO').and(by.type(alertButtonType))).tap(); // Tap `no` on ask for review alert
|
||||
}
|
||||
|
||||
async function mockMessageWithNag(message, isThread = false) {
|
||||
let input = isThread ? 'messagebox-input-thread' : 'messagebox-input';
|
||||
await element(by.id(input)).tap();
|
||||
await element(by.id(input)).typeText(`${ data.random }${ message }`);
|
||||
await element(by.id('messagebox-send-message')).tap();
|
||||
await dismissReviewNag();
|
||||
await waitFor(element(by.text(`${ data.random }${ message }`))).toExist().withTimeout(60000);
|
||||
await expect(element(by.text(`${ data.random }${ message }`))).toExist();
|
||||
await element(by.text(`${ data.random }${ message }`)).atIndex(0).tap();
|
||||
};
|
||||
|
||||
async function tapBack() {
|
||||
await element(by.id('header-back')).atIndex(0).tap();
|
||||
}
|
||||
|
@ -153,5 +164,6 @@ module.exports = {
|
|||
searchRoom,
|
||||
tryTapping,
|
||||
checkServer,
|
||||
closeKeyboard
|
||||
closeKeyboard,
|
||||
mockMessageWithNag
|
||||
};
|
|
@ -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, mockMessageWithNag } = require('../../helpers/app');
|
||||
|
||||
async function navigateToRoom(roomName) {
|
||||
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
|
||||
|
@ -68,11 +68,11 @@ describe('Threads', () => {
|
|||
const thread = `${ data.random }thread`;
|
||||
it('should create thread', async() => {
|
||||
await mockMessage('thread');
|
||||
await element(by.label(thread)).atIndex(0).longPress();
|
||||
await element(by.text(thread)).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('Reply in Thread')).tap();
|
||||
await element(by.text('Reply in Thread')).tap();
|
||||
await element(by.id('messagebox-input')).typeText('replied');
|
||||
await element(by.id('messagebox-send-message')).tap();
|
||||
await waitFor(element(by.id(`message-thread-button-${ thread }`))).toExist().withTimeout(5000);
|
||||
|
@ -105,9 +105,9 @@ describe('Threads', () => {
|
|||
await mockMessage(messageText, true);
|
||||
await tapBack();
|
||||
await waitFor(element(by.id('room-header').and(by.label(`${ mainRoom }`)))).toBeVisible().withTimeout(2000);
|
||||
await waitFor(element(by.id('room-header').and(by.label(`${ data.random }thread`)))).toBeNotVisible().withTimeout(2000);
|
||||
await waitFor(element(by.id('room-header').and(by.text(`${ 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 waitFor(element(by.label(`${ data.random }${ messageText }`)).atIndex(0)).toNotExist().withTimeout(2000);
|
||||
await waitFor(element(by.text(`${ data.random }${ messageText }`)).atIndex(0)).toNotExist().withTimeout(2000);
|
||||
});
|
||||
|
||||
it('should mark send to channel and show on main channel', async() => {
|
||||
|
@ -118,22 +118,21 @@ describe('Threads', () => {
|
|||
await element(by.id('messagebox-send-message')).tap();
|
||||
await tapBack();
|
||||
await waitFor(element(by.id('room-header').and(by.label(`${ mainRoom }`)))).toBeVisible().withTimeout(2000);
|
||||
await waitFor(element(by.id('room-header').and(by.label(`${ data.random }thread`)))).toBeNotVisible().withTimeout(2000);
|
||||
await waitFor(element(by.id('room-header').and(by.text(`${ 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 waitFor(element(by.label(messageText)).atIndex(0)).toExist().withTimeout(2000);
|
||||
});
|
||||
|
||||
it('should navigate to thread from thread name', async() => {
|
||||
const messageText = 'navthreadname';
|
||||
await mockMessage('dummymessagebetweenthethread');
|
||||
await dismissReviewNag() //TODO: Create a proper test for this elsewhere.
|
||||
await mockMessageWithNag('dummymessagebetweenthethread');
|
||||
await element(by.id(`message-thread-button-${ thread }`)).tap();
|
||||
await element(by.id('messagebox-input-thread')).typeText(messageText);
|
||||
await element(by.id('messagebox-send-to-channel')).tap();
|
||||
await element(by.id('messagebox-send-message')).tap();
|
||||
await tapBack();
|
||||
await waitFor(element(by.id('room-header').and(by.label(`${ mainRoom }`)))).toBeVisible().withTimeout(2000);
|
||||
await waitFor(element(by.id('room-header').and(by.label(`${ data.random }thread`)))).toBeNotVisible().withTimeout(2000);
|
||||
await waitFor(element(by.id('room-header').and(by.text(`${ data.random }thread`)))).toBeNotVisible().withTimeout(2000);
|
||||
await waitFor(element(by.id(`message-thread-replied-on-${ thread }`))).toBeVisible().withTimeout(2000);
|
||||
await element(by.id(`message-thread-replied-on-${ thread }`)).tap();
|
||||
await waitFor(element(by.id(`room-view-title-${ thread }`))).toExist().withTimeout(5000);
|
||||
|
|
|
@ -28,8 +28,8 @@ describe('Mark as unread', () => {
|
|||
const message = `${ data.random }message`;
|
||||
const channelName = `@${ data.users.regular.username }`;
|
||||
await sendMessage(data.users.alternate, channelName, message);
|
||||
await waitFor(element(by.label(message)).atIndex(0)).toExist().withTimeout(30000);
|
||||
await element(by.label(message)).atIndex(0).longPress();
|
||||
await waitFor(element(by.text(message)).atIndex(0)).toExist().withTimeout(30000);
|
||||
await element(by.text(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);
|
||||
|
|
Loading…
Reference in New Issue