diff --git a/app/views/SidebarView/SidebarItem.tsx b/app/views/SidebarView/SidebarItem.tsx index 8766e8037..7e71a9a53 100644 --- a/app/views/SidebarView/SidebarItem.tsx +++ b/app/views/SidebarView/SidebarItem.tsx @@ -5,6 +5,7 @@ import Touch from '../../utils/touch'; import { themes } from '../../lib/constants'; import { withTheme } from '../../theme'; import styles from './styles'; +import { testProps } from '../../lib/methods/testProps'; interface SidebarItemProps { left: JSX.Element; @@ -19,7 +20,7 @@ interface SidebarItemProps { const Item = React.memo(({ left, right, text, onPress, testID, current, theme }: SidebarItemProps) => ( diff --git a/appium/tests/helpers/index.js b/appium/tests/helpers/index.js index 2f30206ec..5e2332603 100644 --- a/appium/tests/helpers/index.js +++ b/appium/tests/helpers/index.js @@ -6,7 +6,13 @@ export const setValue = async (tag, value) => await $(`~${tag}`).setValue(`${val export const getText = async tag => await $(`~${tag}`).getText(); -export const equal = async (value, prop) => expect(value).to.equal(prop); +export const equal = async (value, text) => expect(value).to.equal(prop); + +export const click = async tag => await $(`~${tag}`).click(); + +export const clickById = async tag => await $(`#${tag}`).click(); + +export const scrollToBottom = async () => await driver.execute('mobile: scroll', { direction: 'down' }); export const setValueAndEnter = async (tag, value) => { if (driver.capabilities.platformName === 'Android') { diff --git a/appium/tests/helpers/login.js b/appium/tests/helpers/login.js new file mode 100644 index 000000000..ba776298c --- /dev/null +++ b/appium/tests/helpers/login.js @@ -0,0 +1,19 @@ +import { click, clickById, scrollToBottom, setValue, setValueAndEnter } from '.'; +import data from '../../../e2e/data'; + +export const login = async () => { + await setValueAndEnter('new-server-view-input', 'mobile'); + await click('workspace-view-login'); + await setValue('login-view-email', 'useronefvtetnpenrsrbowccakq'); + await setValueAndEnter('login-view-password', '123'); +}; + +export const logout = async () => { + await $('//android.view.ViewGroup[@content-desc="rooms-list-view-sidebar"]/android.widget.TextView').click(); //TEMP + await click('sidebar-settings'); + await click('sidebar-settings'); + // await scrollToBottom(); + await click('settings-logout'); + await click('settings-logout'); + await clickById('android:id/button1'); +}; diff --git a/appium/tests/specs/01-onboarding.e2e.js b/appium/tests/specs/01-onboarding.e2e.js new file mode 100644 index 000000000..e5939e961 --- /dev/null +++ b/appium/tests/specs/01-onboarding.e2e.js @@ -0,0 +1,55 @@ +// const data = require('../../../e2e/data'); +// // const { platformTypes } = require('../../../e2e/helpers/app'); + +// describe('Onboarding', () => { +// // let alertButtonType; +// // let textMatcher; +// before(async () => { +// await driver.closeApp(); +// await driver.launchApp(); +// // await $('~new-server-view').toExis +// // await waitFor(element(by.id('new-server-view'))) +// // .toBeVisible() +// // .withTimeout(20000); +// }); + +// // describe('Render', () => { +// // it('should have onboarding screen', async () => { +// // await expect(element(by.id('new-server-view'))).toBeVisible(); +// // }); + +// // it('should have "Join our open workspace"', async () => { +// // await expect(element(by.id('new-server-view-open'))).toBeVisible(); +// // }); +// // }); + +// describe('Usage', () => { +// it('should enter an invalid server and get error', async () => { +// await $('~new-server-view-input').addValue('invalidtest'); +// // await $('new-server-view-input'). +// // await waitFor(element(by[textMatcher]('Oops!'))) +// // .toExist() +// // .withTimeout(10000); +// // await element(by[textMatcher]('OK').and(by.type(alertButtonType))).tap(); +// }); + +// // it('should tap on "Join our open workspace" and navigate', async () => { +// // await element(by.id('new-server-view-open')).tap(); +// // await waitFor(element(by.id('workspace-view'))) +// // .toBeVisible() +// // .withTimeout(60000); +// // }); + +// // it('should enter a valid server without login services and navigate to login', async () => { +// // await device.launchApp({ newInstance: true }); +// // await waitFor(element(by.id('new-server-view'))) +// // .toBeVisible() +// // .withTimeout(5000); +// // await element(by.id('new-server-view-input')).replaceText(data.server); +// // await element(by.id('new-server-view-input')).tapReturnKey(); +// // await waitFor(element(by.id('workspace-view'))) +// // .toBeVisible() +// // .withTimeout(60000); +// // }); +// }); +// }); diff --git a/appium/tests/specs/01-onboarding.spec.js b/appium/tests/specs/01-onboarding.spec.js deleted file mode 100644 index 08339af4e..000000000 --- a/appium/tests/specs/01-onboarding.spec.js +++ /dev/null @@ -1,55 +0,0 @@ -const data = require('../../../e2e/data'); -// const { platformTypes } = require('../../../e2e/helpers/app'); - -describe('Onboarding', () => { - // let alertButtonType; - // let textMatcher; - before(async () => { - await driver.closeApp(); - await driver.launchApp(); - // await $('~new-server-view').toExis - // await waitFor(element(by.id('new-server-view'))) - // .toBeVisible() - // .withTimeout(20000); - }); - - // describe('Render', () => { - // it('should have onboarding screen', async () => { - // await expect(element(by.id('new-server-view'))).toBeVisible(); - // }); - - // it('should have "Join our open workspace"', async () => { - // await expect(element(by.id('new-server-view-open'))).toBeVisible(); - // }); - // }); - - describe('Usage', () => { - it('should enter an invalid server and get error', async () => { - await $('~new-server-view-input').addValue('invalidtest'); - // await $('new-server-view-input'). - // await waitFor(element(by[textMatcher]('Oops!'))) - // .toExist() - // .withTimeout(10000); - // await element(by[textMatcher]('OK').and(by.type(alertButtonType))).tap(); - }); - - // it('should tap on "Join our open workspace" and navigate', async () => { - // await element(by.id('new-server-view-open')).tap(); - // await waitFor(element(by.id('workspace-view'))) - // .toBeVisible() - // .withTimeout(60000); - // }); - - // it('should enter a valid server without login services and navigate to login', async () => { - // await device.launchApp({ newInstance: true }); - // await waitFor(element(by.id('new-server-view'))) - // .toBeVisible() - // .withTimeout(5000); - // await element(by.id('new-server-view-input')).replaceText(data.server); - // await element(by.id('new-server-view-input')).tapReturnKey(); - // await waitFor(element(by.id('workspace-view'))) - // .toBeVisible() - // .withTimeout(60000); - // }); - }); -}); diff --git a/appium/tests/specs/011-onboarding.e2e.js b/appium/tests/specs/011-onboarding.e2e.js new file mode 100644 index 000000000..86beb32cb --- /dev/null +++ b/appium/tests/specs/011-onboarding.e2e.js @@ -0,0 +1,20 @@ +const { launchApp, equal } = require('../helpers'); +const { login, logout } = require('../helpers/login'); + +describe('Onboarding', () => { + before(() => { + launchApp(); + }); + + describe('Login', () => { + it('Login in app', async () => { + await login(); + }); + + it('Logout in app', async () => { + await logout(); + const login = await getText('new-server-view-input'); + equal(login, 'Ex. your-company.rocket.chat'); + }); + }); +}); diff --git a/appium/tests/specs/initial-app-sreen.e2e.js b/appium/tests/specs/initial-app-sreen.e2e.js index bad452d3c..10957c624 100644 --- a/appium/tests/specs/initial-app-sreen.e2e.js +++ b/appium/tests/specs/initial-app-sreen.e2e.js @@ -1,19 +1,24 @@ -const { launchApp, setValue, getText, equal, setValueAndEnter } = require('../helpers'); +// const { setup } = require('../../../e2e/helpers/data_setup'); +// const { launchApp, setValue, getText, equal, setValueAndEnter } = require('../helpers'); -describe('Verify initial app screen', () => { - beforeEach(() => { - launchApp(); - }); +// describe('Verify initial app screen', () => { +// // before(async () => { +// // await setup(); +// // }); - it('set workspace url', async () => { - await setValue('new-server-view-input', 'mobile'); - const value = await getText('new-server-view-input'); - equal(value, 'mobile'); - }); +// beforeEach(() => { +// launchApp(); +// }); - it('set workspace url and login', async () => { - await setValueAndEnter('new-server-view-input', 'mobile'); - const login = await getText('Login'); - equal(login, 'Login'); - }); -}); +// it('set workspace url', async () => { +// await setValue('new-server-view-input', 'mobile'); +// const value = await getText('new-server-view-input'); +// equal(value, 'mobile'); +// }); + +// it('set workspace url and login', async () => { +// await setValueAndEnter('new-server-view-input', 'mobile'); +// const login = await getText('Login'); +// equal(login, 'Login'); +// }); +// }); diff --git a/appium/user.json b/appium/user.json new file mode 100644 index 000000000..1dcd0e712 --- /dev/null +++ b/appium/user.json @@ -0,0 +1,60 @@ +{ + "server": "https://mobile.rocket.chat", + "adminUser": "e2e_admin", + "adminPassword": "Nj8uyGpNX47J6td", + "alternateServer": "https://stable.rocket.chat", + "users": { + "regular": { + "username": "useronefvtetnpenrsrbowccakq", + "password": "123", + "email": "mobile+regularfvtetnpenrsrbowccakq@rocket.chat" + }, + "alternate": { + "username": "usertwofvtetnpenrsrbowccakq", + "password": "123", + "email": "mobile+alternatefvtetnpenrsrbowccakq@rocket.chat", + "totpSecret": "NA4GOMZGHBQSK6KEFRVT62DMGJJGSYZJFZIHO3ZOGVXWCYZ6MMZQ" + }, + "profileChanges": { + "username": "userthreefvtetnpenrsrbowccakq", + "password": "123", + "email": "mobile+profileChangesfvtetnpenrsrbowccakq@rocket.chat" + }, + "existing": { + "username": "existinguserfvtetnpenrsrbowccakq", + "password": "123", + "email": "mobile+existingfvtetnpenrsrbowccakq@rocket.chat" + } + }, + "channels": { + "detoxpublic": { "name": "detox-public" }, + "detoxpublicprotected": { "name": "detox-public-protected", "joinCode": "123" } + }, + "groups": { + "private": { "name": "detox-private-fvtetnpenrsrbowccakq" }, + "alternate": { "name": "detox-alternate-fvtetnpenrsrbowccakq" }, + "alternate2": { "name": "detox-alternate2-fvtetnpenrsrbowccakq" } + }, + "teams": { "private": { "name": "detox-team-fvtetnpenrsrbowccakq" } }, + "registeringUser": { + "username": "newuserfvtetnpenrsrbowccakq", + "password": "passwordfvtetnpenrsrbowccakq", + "email": "mobile+registeringfvtetnpenrsrbowccakq@rocket.chat" + }, + "registeringUser2": { + "username": "newusertwofvtetnpenrsrbowccakq", + "password": "passwordtwofvtetnpenrsrbowccakq", + "email": "mobile+registeringtwofvtetnpenrsrbowccakq@rocket.chat" + }, + "registeringUser3": { + "username": "newuserthreefvtetnpenrsrbowccakq", + "password": "passwordthreefvtetnpenrsrbowccakq", + "email": "mobile+registeringthreefvtetnpenrsrbowccakq@rocket.chat" + }, + "registeringUser4": { + "username": "newuserfourfvtetnpenrsrbowccakq", + "password": "passwordfourfvtetnpenrsrbowccakq", + "email": "mobile+registeringfourfvtetnpenrsrbowccakq@rocket.chat" + }, + "random": "fvtetnpenrsrbowccakq" +}