From 168a70ad81ef225e64feeb6a06cfbe20a2fdb545 Mon Sep 17 00:00:00 2001 From: GleidsonDaniel Date: Fri, 8 Apr 2022 10:54:10 -0300 Subject: [PATCH] create withTest function --- app/lib/methods/withTest.ts | 4 ++++ app/views/NewServerView/ServerInput/index.tsx | 4 ++-- appium/tests/specs/initial-app-sreen.e2e.js | 6 +++--- 3 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 app/lib/methods/withTest.ts diff --git a/app/lib/methods/withTest.ts b/app/lib/methods/withTest.ts new file mode 100644 index 000000000..3f6cdccee --- /dev/null +++ b/app/lib/methods/withTest.ts @@ -0,0 +1,4 @@ +export const withTest = (testID: string): { testID: string; accessibilityLabel: string } => ({ + testID, + accessibilityLabel: testID +}); diff --git a/app/views/NewServerView/ServerInput/index.tsx b/app/views/NewServerView/ServerInput/index.tsx index ddb7e6772..c296f0141 100644 --- a/app/views/NewServerView/ServerInput/index.tsx +++ b/app/views/NewServerView/ServerInput/index.tsx @@ -7,6 +7,7 @@ import { themes } from '../../../lib/constants'; import I18n from '../../../i18n'; import { TServerHistoryModel } from '../../../definitions/IServerHistory'; import Item from './Item'; +import { withTest } from '../../../lib/methods/withTest'; const styles = StyleSheet.create({ container: { @@ -56,7 +57,6 @@ const ServerInput = ({ value={text} returnKeyType='send' onChangeText={onChangeText} - testID='new-server-view-input' onSubmitEditing={onSubmit} clearButtonMode='while-editing' keyboardType='url' @@ -64,7 +64,7 @@ const ServerInput = ({ theme={theme} onFocus={() => setFocused(true)} onBlur={() => setFocused(false)} - accessibilityLabel='enter-workspace-url' + {...withTest('new-server-view-input')} /> {focused && serversHistory?.length ? ( { }); it('set workspace url', async () => { - await $('~enter-workspace-url').setValue('mobile'); - const status = await $('~enter-workspace-url').getText(); + await $('~new-server-view-input').setValue('mobile'); + const status = await $('~new-server-view-input').getText(); expect(status).to.equal('mobile'); }); 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(); const register = await $('//android.widget.TextView[@content-desc="Create an account"]').getText(); expect(register).to.equal('Create an account');