verdnatura-chat/appium/tests/helpers/index.js

24 lines
743 B
JavaScript
Raw Normal View History

2022-04-08 19:43:13 +00:00
const { expect } = require('chai');
export const launchApp = async () => await driver.launchApp();
export const setValue = async (tag, value) => await $(`~${tag}`).setValue(`${value}`);
export const getText = async tag => await $(`~${tag}`).getText();
2022-04-08 21:19:28 +00:00
export const equal = async (value, text) => expect(value).to.equal(prop);
export const click = async tag => await $(`~${tag}`).click();
2022-04-28 20:11:04 +00:00
export const clickById = async tag => await $(`id=${tag}`).click();
2022-04-08 19:43:13 +00:00
export const setValueAndEnter = async (tag, value) => {
if (driver.capabilities.platformName === 'Android') {
await $(`~${tag}`).click();
await $(`~${tag}`).setValue(value);
await $(`~${tag}`).pressKeyCode(66);
} else {
await $(`~${tag}`).setValue(`${value} \n`);
}
};