add helpers
This commit is contained in:
parent
31a02d3db3
commit
f42d9fcd95
|
@ -0,0 +1,19 @@
|
|||
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();
|
||||
|
||||
export const equal = async (value, prop) => expect(value).to.equal(prop);
|
||||
|
||||
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`);
|
||||
}
|
||||
};
|
|
@ -0,0 +1,19 @@
|
|||
const { launchApp, setValue, getText, equal, setValueAndEnter } = require('../helpers');
|
||||
|
||||
describe('Verify initial app screen', () => {
|
||||
beforeEach(() => {
|
||||
launchApp();
|
||||
});
|
||||
|
||||
it('set workspace url', async () => {
|
||||
await setValue('new-server-view-input', 'mobile');
|
||||
const value = await getText('new-server-view-input');
|
||||
equal(value, 'mobile');
|
||||
});
|
||||
|
||||
it('set workspace url and login', async () => {
|
||||
await setValueAndEnter('new-server-view-input', 'mobile');
|
||||
const login = await getText('Login');
|
||||
equal(login, 'Login');
|
||||
});
|
||||
});
|
|
@ -1,20 +0,0 @@
|
|||
// const { expect } = require('chai');
|
||||
|
||||
describe('Verify initial app screen', () => {
|
||||
beforeEach(() => {
|
||||
driver.launchApp();
|
||||
});
|
||||
|
||||
it('set workspace url', async () => {
|
||||
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 $('~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');
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue