create withTest function
This commit is contained in:
parent
81832aea8f
commit
168a70ad81
|
@ -0,0 +1,4 @@
|
||||||
|
export const withTest = (testID: string): { testID: string; accessibilityLabel: string } => ({
|
||||||
|
testID,
|
||||||
|
accessibilityLabel: testID
|
||||||
|
});
|
|
@ -7,6 +7,7 @@ import { themes } from '../../../lib/constants';
|
||||||
import I18n from '../../../i18n';
|
import I18n from '../../../i18n';
|
||||||
import { TServerHistoryModel } from '../../../definitions/IServerHistory';
|
import { TServerHistoryModel } from '../../../definitions/IServerHistory';
|
||||||
import Item from './Item';
|
import Item from './Item';
|
||||||
|
import { withTest } from '../../../lib/methods/withTest';
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
|
@ -56,7 +57,6 @@ const ServerInput = ({
|
||||||
value={text}
|
value={text}
|
||||||
returnKeyType='send'
|
returnKeyType='send'
|
||||||
onChangeText={onChangeText}
|
onChangeText={onChangeText}
|
||||||
testID='new-server-view-input'
|
|
||||||
onSubmitEditing={onSubmit}
|
onSubmitEditing={onSubmit}
|
||||||
clearButtonMode='while-editing'
|
clearButtonMode='while-editing'
|
||||||
keyboardType='url'
|
keyboardType='url'
|
||||||
|
@ -64,7 +64,7 @@ const ServerInput = ({
|
||||||
theme={theme}
|
theme={theme}
|
||||||
onFocus={() => setFocused(true)}
|
onFocus={() => setFocused(true)}
|
||||||
onBlur={() => setFocused(false)}
|
onBlur={() => setFocused(false)}
|
||||||
accessibilityLabel='enter-workspace-url'
|
{...withTest('new-server-view-input')}
|
||||||
/>
|
/>
|
||||||
{focused && serversHistory?.length ? (
|
{focused && serversHistory?.length ? (
|
||||||
<View
|
<View
|
||||||
|
|
|
@ -6,13 +6,13 @@ describe('Verify initial app screen', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('set workspace url', async () => {
|
it('set workspace url', async () => {
|
||||||
await $('~enter-workspace-url').setValue('mobile');
|
await $('~new-server-view-input').setValue('mobile');
|
||||||
const status = await $('~enter-workspace-url').getText();
|
const status = await $('~new-server-view-input').getText();
|
||||||
expect(status).to.equal('mobile');
|
expect(status).to.equal('mobile');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('set workspace url and login', async () => {
|
it('set workspace url and login', async () => {
|
||||||
await $('~enter-workspace-url').setValue('mobile');
|
await $('~new-server-view-input').setValue('mobile');
|
||||||
await $('~new-server-view-button').click();
|
await $('~new-server-view-button').click();
|
||||||
const register = await $('//android.widget.TextView[@content-desc="Create an account"]').getText();
|
const register = await $('//android.widget.TextView[@content-desc="Create an account"]').getText();
|
||||||
expect(register).to.equal('Create an account');
|
expect(register).to.equal('Create an account');
|
||||||
|
|
Loading…
Reference in New Issue