fix ios tests

This commit is contained in:
GleidsonDaniel 2022-05-05 15:11:38 -03:00
parent 27c0ac5eca
commit 05f6a1e9f4
2 changed files with 20 additions and 8 deletions

View File

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

View File

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