More tests working on android

This commit is contained in:
Anant Bhasin 2021-06-09 01:53:48 +05:30
parent 095f39d857
commit 97baaa4241
2 changed files with 31 additions and 30 deletions

View File

@ -96,8 +96,8 @@ describe('Create room screen', () => {
it('should get invalid room', async() => {
await element(by.id('create-channel-name')).typeText('general');
await element(by.id('create-channel-submit')).tap();
await waitFor(element(by.text(`A channel with name 'general' exists`))).toExist().withTimeout(60000);
await expect(element(by.text(`A channel with name 'general' exists`))).toExist();
await waitFor(element(by.text(`A channel with name general exists`))).toExist().withTimeout(60000);
await expect(element(by.text(`A channel with name general exists`))).toExist();
await element(by.text('OK')).tap();
});

View File

@ -67,7 +67,7 @@ describe('Room screen', () => {
describe('Messagebox', async() => {
it('should send message', async() => {
await mockMessage('message')
await expect(element(by.label(`${ data.random }message`)).atIndex(0)).toExist();
await expect(element(by.text(`${ data.random }message`)).atIndex(0)).toExist();
});
@ -164,21 +164,21 @@ describe('Room screen', () => {
describe('Message', async() => {
it('should copy permalink', async() => {
await element(by.label(`${ data.random }message`)).atIndex(0).longPress();
await element(by.text(`${ 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('Permalink')).atIndex(0).tap();
await element(by.text('Permalink')).atIndex(0).tap();
// TODO: test clipboard
});
it('should copy message', async() => {
await element(by.label(`${ data.random }message`)).atIndex(0).longPress();
await element(by.text(`${ 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('Copy')).atIndex(0).tap();
await element(by.text('Copy')).atIndex(0).tap();
// TODO: test clipboard
});
@ -187,16 +187,16 @@ describe('Room screen', () => {
await starMessage('message')
await sleep(1000) //https://github.com/RocketChat/Rocket.Chat.ReactNative/issues/2324
await element(by.label(`${ data.random }message`)).atIndex(0).longPress();
await element(by.text(`${ 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', 'slow', 0.5);
await waitFor(element(by.label('Unstar')).atIndex(0)).toBeVisible().withTimeout(6000);
await waitFor(element(by.text('Unstar')).atIndex(0)).toBeVisible().withTimeout(6000);
await element(by.id('action-sheet-handle')).swipe('down', 'fast', 0.8);
});
it('should react to message', async() => {
await element(by.label(`${ data.random }message`)).atIndex(0).longPress();
await element(by.text(`${ 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);
@ -209,7 +209,7 @@ describe('Room screen', () => {
});
it('should react to message with frequently used emoji', async() => {
await element(by.label(`${ data.random }message`)).atIndex(0).longPress();
await element(by.text(`${ 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);
@ -218,19 +218,20 @@ describe('Room screen', () => {
await waitFor(element(by.id('message-reaction-:+1:'))).toBeVisible().withTimeout(60000);
});
it('should show reaction picker on add reaction button pressed and have frequently used emoji', async() => {
it('should show reaction picker on add reaction button pressed and have frequently used emoji, and dismiss review nag', async() => {
await element(by.id('message-add-reaction')).tap();
await waitFor(element(by.id('reaction-picker'))).toExist().withTimeout(2000);
await waitFor(element(by.id('reaction-picker-grinning'))).toExist().withTimeout(2000);
await element(by.id('reaction-picker-😃')).tap();
await waitFor(element(by.id('reaction-picker-grimacing'))).toExist().withTimeout(2000);
await element(by.id('reaction-picker-grimacing')).tap();
await dismissReviewNag();
await waitFor(element(by.id('message-reaction-:grimacing:'))).toExist().withTimeout(60000);
});
it('should ask for review', async() => {
await dismissReviewNag() //TODO: Create a proper test for this elsewhere.
})
// it('should ask for review', async() => {
// //await dismissReviewNag(); //TODO: Create a proper test for this elsewhere.
// })
it('should remove reaction', async() => {
await element(by.id('message-reaction-:grinning:')).tap();
@ -239,23 +240,23 @@ describe('Room screen', () => {
it('should edit message', async() => {
await mockMessage('edit');
await element(by.label(`${ data.random }edit`)).atIndex(0).longPress();
await element(by.text(`${ data.random }edit`)).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('Edit')).atIndex(0).tap();
await element(by.id('messagebox-input')).typeText('ed');
await element(by.text('Edit')).atIndex(0).tap();
await element(by.id('messagebox-input')).replaceText(`${ data.random }edited`);
await element(by.id('messagebox-send-message')).tap();
await waitFor(element(by.label(`${ data.random }edited (edited)`)).atIndex(0)).toExist().withTimeout(60000);
await waitFor(element(by.text(`${ data.random }edited (edited)`)).atIndex(0)).toExist().withTimeout(60000);
});
it('should quote message', async() => {
await mockMessage('quote');
await element(by.label(`${ data.random }quote`)).atIndex(0).longPress();
await element(by.text(`${ data.random }quote`)).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('Quote')).atIndex(0).tap();
await element(by.text('Quote')).atIndex(0).tap();
await element(by.id('messagebox-input')).typeText(`${ data.random }quoted`);
await element(by.id('messagebox-send-message')).tap();
@ -266,32 +267,32 @@ describe('Room screen', () => {
await mockMessage('pin')
await pinMessage('pin')
await waitFor(element(by.label(`${ data.random }pin`)).atIndex(0)).toExist().withTimeout(5000);
await waitFor(element(by.label(`${ data.users.regular.username } Message pinned`)).atIndex(0)).toExist().withTimeout(5000);
await element(by.label(`${ data.random }pin`)).atIndex(0).longPress();
await waitFor(element(by.text(`${ data.random }pin`)).atIndex(0)).toExist().withTimeout(5000);
await waitFor(element(by.text(`${ data.users.regular.username } Message pinned`)).atIndex(0)).toExist().withTimeout(5000);
await element(by.text(`${ data.random }pin`)).atIndex(0).longPress();
await waitFor(element(by.id('action-sheet'))).toExist().withTimeout(1000);
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
await waitFor(element(by.label('Unpin'))).toBeVisible().withTimeout(2000);
await waitFor(element(by.text('Unpin'))).toBeVisible().withTimeout(2000);
await element(by.id('action-sheet-handle')).swipe('down', 'fast', 0.8);
});
it('should delete message', async() => {
await mockMessage('delete')
await waitFor(element(by.label(`${ data.random }delete`)).atIndex(0)).toBeVisible();
await element(by.label(`${ data.random }delete`)).atIndex(0).longPress();
await waitFor(element(by.text(`${ data.random }delete`)).atIndex(0)).toBeVisible();
await element(by.text(`${ data.random }delete`)).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 waitFor(element(by.label('Delete'))).toExist().withTimeout(1000);
await element(by.label('Delete')).atIndex(0).tap();
await waitFor(element(by.text('Delete'))).toExist().withTimeout(1000);
await element(by.text('Delete')).atIndex(0).tap();
const deleteAlertMessage = 'You will not be able to recover this message!';
await waitFor(element(by.text(deleteAlertMessage)).atIndex(0)).toExist().withTimeout(10000);
await element(by.text('Delete')).tap();
await waitFor(element(by.label(`${ data.random }delete`)).atIndex(0)).toNotExist().withTimeout(2000);
await waitFor(element(by.text(`${ data.random }delete`)).atIndex(0)).toNotExist().withTimeout(2000);
});
});
});