From 05f6a1e9f42410e13df5491948cf68f525ec8b79 Mon Sep 17 00:00:00 2001 From: GleidsonDaniel Date: Thu, 5 May 2022 15:11:38 -0300 Subject: [PATCH] fix ios tests --- appium/tests/helpers/index.js | 23 ++++++++++++++++++----- appium/tests/helpers/login.js | 5 ++--- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/appium/tests/helpers/index.js b/appium/tests/helpers/index.js index fafa9cc8b..7f25c55e5 100644 --- a/appium/tests/helpers/index.js +++ b/appium/tests/helpers/index.js @@ -12,17 +12,30 @@ export const click = async tag => await $(`~${tag}`).click(); export const clickById = async tag => await $(`id=${tag}`).click(); -export const openDrawer = async () => - await $('//android.view.ViewGroup[@content-desc="rooms-list-view-sidebar"]/android.widget.TextView').click(); //TEMP +export const isAndroid = () => driver.capabilities.platformName === 'Android'; -export const clickAlert = async tag => await clickById('android:id/button1'); +export const openDrawer = async () => { + if (isAndroid()) { + await $('//android.view.ViewGroup[@content-desc="rooms-list-view-sidebar"]/android.widget.TextView').click(); //TEMP + } else { + await $('[name="rooms-list-view-sidebar"]').click(); + } +}; + +export const clickAlert = async tag => { + if (isAndroid()) { + await clickById('android:id/button1'); + } else { + await $(`[name="${tag}"]`).click(); + } +}; export const setValueAndEnter = async (tag, value) => { - if (driver.capabilities.platformName === 'Android') { + if (isAndroid()) { await $(`~${tag}`).click(); await $(`~${tag}`).setValue(value); await $(`~${tag}`).pressKeyCode(66); } else { - await $(`~${tag}`).setValue(`${value} \n`); + await $(`~${tag}`).setValue(`${value}\n`); } }; diff --git a/appium/tests/helpers/login.js b/appium/tests/helpers/login.js index d82578632..83b59fd5c 100644 --- a/appium/tests/helpers/login.js +++ b/appium/tests/helpers/login.js @@ -1,11 +1,10 @@ import { click, clickAlert, openDrawer, setValue, setValueAndEnter } from '.'; import { swipeDown } from './gestures'; -// 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 setValue('login-view-email', 'useroneqqshjglvfnkzamfqvgnb'); await setValueAndEnter('login-view-password', '123'); }; @@ -14,5 +13,5 @@ export const logout = async () => { await click('sidebar-settings'); await swipeDown(20); await click('settings-logout'); - await clickAlert(); + await clickAlert('Sair'); // iOS is text };