Detox/E2E: Fix some specs and comments (#4919)
* Detox/E2E: Fix some specs and comments * Fix lint
This commit is contained in:
parent
cb4d875b13
commit
0db46f2003
9 changed files with 57 additions and 42 deletions
|
|
@ -33,10 +33,10 @@ describe('Autocomplete', () => {
|
|||
// * Expect autocomplete to render
|
||||
await expect(element(by.id('autocomplete.at_mention.list'))).toExist();
|
||||
|
||||
// Go to previous screen
|
||||
// # Go to previous screen
|
||||
await element(by.id('screen.back.button')).tap();
|
||||
|
||||
// close channel info screen
|
||||
// # Close channel info screen
|
||||
await element(by.id('screen.channel_info.close')).tap();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ describe('Autocomplete', () => {
|
|||
// # Tap the send button
|
||||
await element(by.id('send_button')).tap();
|
||||
|
||||
// Explicitly wait on Android before verifying error message
|
||||
// # Explicitly wait on Android before verifying error message
|
||||
if (isAndroid()) {
|
||||
await wait(timeouts.ONE_SEC);
|
||||
}
|
||||
|
|
@ -40,8 +40,11 @@ describe('Autocomplete', () => {
|
|||
// # Open edit screen
|
||||
await element(by.text(message)).longPress();
|
||||
|
||||
const slide = element(by.id('slide_up_panel'));
|
||||
await slide.swipe('up');
|
||||
// # Swipe up panel on Android
|
||||
if (isAndroid()) {
|
||||
const slide = element(by.id('slide_up_panel'));
|
||||
await slide.swipe('up');
|
||||
}
|
||||
|
||||
const edit = element(by.text('Edit'));
|
||||
await edit.tap();
|
||||
|
|
@ -53,6 +56,7 @@ describe('Autocomplete', () => {
|
|||
// * Expect at_mention autocomplete to render
|
||||
await expect(element(by.id('autocomplete.at_mention.list'))).toExist();
|
||||
|
||||
// # Close edit post screen
|
||||
await element(by.id('edit_post.close')).tap();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -67,6 +67,9 @@ describe('Channels', () => {
|
|||
// * Expect to see channel header and purpose in channel info
|
||||
await expect(element(by.text(expectedChannelHeader))).toBeVisible();
|
||||
await expect(element(by.text(expectedPurpose))).toBeVisible();
|
||||
|
||||
// # Close channel info screen
|
||||
await element(by.id('screen.channel_info.close')).tap();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ describe('in-app Notification', () => {
|
|||
await element(by.id('reaction_picker.open')).tap();
|
||||
await element(by.id('screen.add_reaction.close')).tap();
|
||||
|
||||
// # Skip on Android for now
|
||||
if (isAndroid()) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Skipping on Android until https://github.com/wix/Detox/issues/2141');
|
||||
|
|
@ -94,7 +95,7 @@ describe('in-app Notification', () => {
|
|||
await device.sendUserNotification(testNotification);
|
||||
await wait(timeouts.HALF_SEC);
|
||||
|
||||
// * in-app notification shows
|
||||
// * Verify in-app notification is shown
|
||||
await expect(element(by.id('in_app_notification'))).toBeVisible();
|
||||
await expect(element(by.id('in_app_notification.icon'))).toBeVisible();
|
||||
await expect(element(by.id('in_app_notification.title'))).toHaveText(testChannel.name);
|
||||
|
|
@ -103,7 +104,7 @@ describe('in-app Notification', () => {
|
|||
// # Wait for some profiles to load
|
||||
await wait(5 * timeouts.ONE_SEC);
|
||||
|
||||
// * in-app notification hides
|
||||
// * Verify in-app notification is hidden
|
||||
await expect(element(by.id('in_app_notification'))).not.toBeVisible();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -42,11 +42,12 @@ describe('Select channel', () => {
|
|||
await element(by.id('channel_drawer.button')).tap();
|
||||
await element(by.text(newChannel.display_name).withAncestor(by.id('channels_list'))).tap();
|
||||
|
||||
// * Selected channel should remain the same
|
||||
// * Drawer should not be visible on Android
|
||||
if (isAndroid()) {
|
||||
// * drawer should not be visible on Android
|
||||
await expect(element(by.id('main_sidebar'))).not.toBeVisible();
|
||||
}
|
||||
|
||||
// * Selected channel should remain the same
|
||||
await expect(element(by.id('channel.nav_bar.title'))).toHaveText(newChannel.display_name);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -22,17 +22,23 @@ describe('Messaging', () => {
|
|||
});
|
||||
|
||||
it('should post a message on tap to paper send button', async () => {
|
||||
// * Verify channel screen and post input exist and send button to not exist
|
||||
await expect(element(by.id('channel_screen'))).toBeVisible();
|
||||
await expect(element(by.id('post_input'))).toExist();
|
||||
await expect(element(by.id('send_button'))).not.toExist();
|
||||
|
||||
// # Tap on post input
|
||||
await element(by.id('post_input')).tap();
|
||||
|
||||
// # Type text on post input
|
||||
const text = Date.now().toString();
|
||||
await element(by.id('post_input')).typeText(text);
|
||||
|
||||
// # Tap send button
|
||||
await expect(element(by.id('send_button'))).toBeVisible();
|
||||
await element(by.id('send_button')).tap();
|
||||
|
||||
// * Verify text to exist
|
||||
await expect(element(by.text(text))).toExist();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -46,10 +46,10 @@ describe('Messaging', () => {
|
|||
await expect(disabledSendButton).toExist();
|
||||
await disabledSendButton.multiTap(3);
|
||||
|
||||
// # Check that message is successfully posted
|
||||
// * Check that message is successfully posted
|
||||
await expect(element(by.text(message))).toExist();
|
||||
|
||||
// # Check that no duplicate message is saved.
|
||||
// * Check that no duplicate message is saved.
|
||||
const {channel} = await Channel.apiGetChannelByName(team.name, 'town-square');
|
||||
const {posts} = await Post.apiGetPostsInChannel(channel.id);
|
||||
jestExpect(posts.length).toEqual(3);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ describe('On boarding', () => {
|
|||
});
|
||||
|
||||
it('should show Select server screen on initial load', async () => {
|
||||
// Verify basic elements on Select Server screen
|
||||
// * Verify basic elements on Select Server screen
|
||||
await expect(element(by.id('select_server_screen'))).toBeVisible();
|
||||
await expect(element(by.id('server_url_input'))).toBeVisible();
|
||||
await expect(element(by.id('connect_button'))).toBeVisible();
|
||||
|
|
@ -64,26 +64,26 @@ describe('On boarding', () => {
|
|||
it('should show error on invalid server URL', async () => {
|
||||
await expect(element(by.id('select_server_screen'))).toBeVisible();
|
||||
|
||||
// Enter invalid server URL
|
||||
// # Enter invalid server URL
|
||||
const input = element(by.id('server_url_input'));
|
||||
await input.clearText();
|
||||
await input.typeText('http://invalid:8065');
|
||||
|
||||
// Tap anywhere to hide keyboard
|
||||
// # Tap anywhere to hide keyboard
|
||||
await element(by.text('Enter Server URL')).tap();
|
||||
|
||||
// Verify that the error message does not exist
|
||||
// * Verify that the error message does not exist
|
||||
await waitFor(element(by.id('error_text'))).not.toExist().withTimeout(timeouts.HALF_SEC);
|
||||
|
||||
// Tap connect button
|
||||
// # Tap connect button
|
||||
await element(by.id('connect_button')).tap();
|
||||
|
||||
// Explicitly wait on Android before verifying error message
|
||||
// # Explicitly wait on Android before verifying error message
|
||||
if (isAndroid()) {
|
||||
await wait(timeouts.TWO_SEC);
|
||||
}
|
||||
|
||||
// Verify error message
|
||||
// * Verify error message
|
||||
await waitFor(element(by.id('error_text'))).toBeVisible().withTimeout(timeouts.ONE_SEC);
|
||||
await expect(element(by.id('error_text'))).toHaveText('Cannot connect to the server. Please check your server URL and internet connection.');
|
||||
});
|
||||
|
|
@ -91,20 +91,20 @@ describe('On boarding', () => {
|
|||
it('should move to Login screen on valid server URL', async () => {
|
||||
await expect(element(by.id('select_server_screen'))).toBeVisible();
|
||||
|
||||
// Enter valid server URL
|
||||
// # Enter valid server URL
|
||||
await element(by.id('server_url_input')).replaceText(serverUrl);
|
||||
|
||||
// Tap connect button
|
||||
// # Tap connect button
|
||||
await element(by.id('connect_button')).tap();
|
||||
|
||||
// Verify that it goes into Login screen
|
||||
// * Verify that it goes into Login screen
|
||||
await expect(element(by.id('login_screen'))).toBeVisible();
|
||||
});
|
||||
|
||||
it('should match elements on Login screen', async () => {
|
||||
await fulfillSelectServerScreen(serverUrl);
|
||||
|
||||
// Verify basic elements on Login screen
|
||||
// * Verify basic elements on Login screen
|
||||
await expect(element(by.id('login_screen'))).toBeVisible();
|
||||
|
||||
await expect(element(by.id('username_input'))).toBeVisible();
|
||||
|
|
@ -118,30 +118,30 @@ describe('On boarding', () => {
|
|||
|
||||
await expect(element(by.id('login_screen'))).toBeVisible();
|
||||
|
||||
// On Login screen, enter invalid username
|
||||
// # On Login screen, enter invalid username
|
||||
await element(by.id('username_input')).typeText('any');
|
||||
|
||||
// Tap anywhere to hide keyboard
|
||||
// # Tap anywhere to hide keyboard
|
||||
await element(by.text(config.TeamSettings.SiteName)).tap();
|
||||
|
||||
// Tap "Sign in" button
|
||||
// # Tap "Sign in" button
|
||||
await element(by.id('signin_button')).tap();
|
||||
|
||||
// Verify that the error message is shown as expected
|
||||
// * Verify that the error message is shown as expected
|
||||
await expect(element(by.id('error_text'))).toBeVisible();
|
||||
await expect(element(by.id('error_text'))).toHaveText('Please enter your password');
|
||||
|
||||
// Clear input to username and enter invalid password
|
||||
// # Clear input to username and enter invalid password
|
||||
await element(by.id('username_input')).replaceText('');
|
||||
await element(by.id('password_input')).typeText('any');
|
||||
|
||||
// Tap anywhere to hide keyboard
|
||||
// # Tap anywhere to hide keyboard
|
||||
await element(by.text(config.TeamSettings.SiteName)).tap();
|
||||
|
||||
// Tap "Sign in" button
|
||||
// # Tap "Sign in" button
|
||||
await element(by.id('signin_button')).tap();
|
||||
|
||||
// Verify that the error message is shown as expected
|
||||
// * Verify that the error message is shown as expected
|
||||
await expect(element(by.id('error_text'))).toBeVisible();
|
||||
await expect(element(by.id('error_text'))).toHaveText('Please enter your email or username');
|
||||
});
|
||||
|
|
@ -151,22 +151,22 @@ describe('On boarding', () => {
|
|||
|
||||
await expect(element(by.id('login_screen'))).toBeVisible();
|
||||
|
||||
// Enter invalid username
|
||||
// # Enter invalid username
|
||||
await element(by.id('username_input')).replaceText('any');
|
||||
|
||||
// Tap anywhere to hide keyboard
|
||||
// # Tap anywhere to hide keyboard
|
||||
await element(by.text(config.TeamSettings.SiteName)).tap();
|
||||
|
||||
// Enter invalid password
|
||||
// # Enter invalid password
|
||||
await element(by.id('password_input')).replaceText('any');
|
||||
|
||||
// Tap anywhere to hide keyboard
|
||||
// # Tap anywhere to hide keyboard
|
||||
await element(by.text(config.TeamSettings.SiteName)).tap();
|
||||
|
||||
// Tap "Sign in" button
|
||||
// # Tap "Sign in" button
|
||||
await element(by.id('signin_button')).tap();
|
||||
|
||||
// Verify that the error message is shown as expected
|
||||
// * Verify that the error message is shown as expected
|
||||
await expect(element(by.id('error_text'))).toBeVisible();
|
||||
await expect(element(by.id('error_text'))).toHaveText('Enter a valid email or username and/or password.');
|
||||
});
|
||||
|
|
@ -176,27 +176,27 @@ describe('On boarding', () => {
|
|||
|
||||
await expect(element(by.id('login_screen'))).toBeVisible();
|
||||
|
||||
// Enter valid username
|
||||
// # Enter valid username
|
||||
await element(by.id('username_input')).replaceText(user.username);
|
||||
|
||||
// # Tap anywhere to hide keyboard
|
||||
await element(by.text(config.TeamSettings.SiteName)).tap();
|
||||
|
||||
// Enter valid password
|
||||
// # Enter valid password
|
||||
await element(by.id('password_input')).replaceText(user.password);
|
||||
|
||||
// # Tap anywhere to hide keyboard
|
||||
await element(by.text(config.TeamSettings.SiteName)).tap();
|
||||
|
||||
// Tap "Sign in" button
|
||||
// # Tap "Sign in" button
|
||||
await element(by.id('signin_button')).tap();
|
||||
|
||||
// Verify that it goes into Channel screen
|
||||
// * Verify that it goes into Channel screen
|
||||
await expect(element(by.id('channel_screen'))).toBeVisible();
|
||||
});
|
||||
|
||||
it('should directly go into Channel screen on reload', async () => {
|
||||
// On reload and after successful login, verify that it goes straight into Channel screen
|
||||
// # On reload and after successful login, verify that it goes straight into Channel screen
|
||||
await expect(element(by.id('channel_screen'))).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ describe('Unread channels', () => {
|
|||
// # Open channel drawer (with at least one unread channel)
|
||||
await element(by.id('channel_drawer.button')).tap();
|
||||
|
||||
// # Verify unread channel(s) display at top of channel list (with mentions first, if any), in alphabetical order, with title "Unreads"
|
||||
// * Verify unread channel(s) display at top of channel list (with mentions first, if any), in alphabetical order, with title "Unreads"
|
||||
await expect(element(by.text('UNREADS'))).toBeVisible();
|
||||
await expect(element(by.id('channel_item.display_name').withAncestor(by.id('channels_list'))).atIndex(0)).toHaveText(aChannel.display_name);
|
||||
await expect(element(by.id('channel_item.display_name').withAncestor(by.id('channels_list'))).atIndex(1)).toHaveText(newChannel.display_name);
|
||||
|
|
|
|||
Loading…
Reference in a new issue