work on helpers

This commit is contained in:
GleidsonDaniel 2022-04-08 18:19:28 -03:00
parent f42d9fcd95
commit 57d8e3dee3
8 changed files with 184 additions and 73 deletions

View File

@ -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) => (
<Touch
key={testID}
testID={testID}
{...testProps(testID)}
onPress={onPress}
theme={theme}
style={[styles.item, current && { backgroundColor: themes[theme].borderColor }]}>

View File

@ -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') {

View File

@ -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');
};

View File

@ -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);
// // });
// });
// });

View File

@ -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);
// });
});
});

View File

@ -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');
});
});
});

View File

@ -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');
// });
// });

60
appium/user.json Normal file
View File

@ -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"
}