How to use the detox.element function in detox

To help you get started, we’ve selected a few detox examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github flow-typed / flow-typed / definitions / npm / detox_v7.x.x / test_detox_v7.x.x.js View on Github external
waitFor(element(by.id("UniqueId204"))).whileElement("someID");
waitFor(element(by.id("UniqueId204"))).whileElement(by.id("ScrollView630"));
// $ExpectError
waitFor(element(by.id("UniqueId204"))).withTimeout(false);
waitFor(element(by.id("UniqueId204"))).withTimeout(1000);

// Example tests
const e2e = {
  NATIVE_BUTTON: "NATIVE_BUTTON",
  WELCOME_VIEW: "WELCOME_VIEW"
};

const welcome = element(by.id(e2e.WELCOME_VIEW));
expect(welcome).toBeVisible();
const welcome_text = "Shake your phone to open the developer menu.";
expect(element(by.text(welcome_text))).toBeVisible();
const btn = element(by.id(e2e.NATIVE_BUTTON));
btn.tap();
github RocketChat / Rocket.Chat.ReactNative / e2e / 04-createuser.spec.js View on Github external
async function navigateToRegister() {
	await waitFor(element(by.id('onboarding-view'))).toBeVisible().withTimeout(2000);
	await element(by.id('connect-server-button')).tap();
	await waitFor(element(by.id('new-server-view'))).toBeVisible().withTimeout(60000);
	await element(by.id('new-server-view-input')).replaceText(data.server);
	await element(by.id('new-server-view-button')).tap();
	// we're assuming the server don't have login services and the navigation will jump to login
	await waitFor(element(by.id('login-view'))).toBeVisible().withTimeout(60000);
	await element(by.id('login-view-register')).tap();
	await waitFor(element(by.id('register-view'))).toBeVisible().withTimeout(2000);
}
github RocketChat / Rocket.Chat.ReactNative / e2e / 06-roomslist.spec.js View on Github external
// await expect(element(by.id('rooms-list-view-search'))).toBeVisible();

			await waitFor(element(by.id('rooms-list-view-search'))).toExist().withTimeout(2000);

			await element(by.id('rooms-list-view-search')).replaceText('rocket.cat');
			await sleep(2000);
			await waitFor(element(by.id('rooms-list-view-item-rocket.cat'))).toBeVisible().withTimeout(60000);
			await expect(element(by.id('rooms-list-view-item-rocket.cat'))).toBeVisible();
			await element(by.id('rooms-list-view-item-rocket.cat')).tap();
			await waitFor(element(by.id('room-view'))).toBeVisible().withTimeout(10000);
			await expect(element(by.id('room-view'))).toBeVisible();
			await waitFor(element(by.text('rocket.cat'))).toBeVisible().withTimeout(60000);
			await expect(element(by.text('rocket.cat'))).toBeVisible();
			await tapBack();
			await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(2000);
			await expect(element(by.id('rooms-list-view'))).toBeVisible();
			await element(by.id('rooms-list-view-search')).replaceText('');
			await sleep(2000);
			await waitFor(element(by.id('rooms-list-view-item-rocket.cat'))).toExist().withTimeout(60000);
			await expect(element(by.id('rooms-list-view-item-rocket.cat'))).toExist();
		});
github RocketChat / Rocket.Chat.ReactNative / e2e / 07-createroom.spec.js View on Github external
it('should create private room', async() => {
				const room = `private${ data.random }`;
				await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(2000);
				await device.reloadReactNative();
				await element(by.id('rooms-list-view-create-channel')).tap();
				await waitFor(element(by.id('new-message-view'))).toBeVisible().withTimeout(2000);
				await element(by.id('new-message-view-create-channel')).tap();
				await waitFor(element(by.id('select-users-view'))).toBeVisible().withTimeout(2000);
				await element(by.id('select-users-view-item-rocket.cat')).tap();
				await waitFor(element(by.id('selected-user-rocket.cat'))).toBeVisible().withTimeout(5000);
				await element(by.id('selected-users-view-submit')).tap();
				await waitFor(element(by.id('create-channel-view'))).toBeVisible().withTimeout(5000);
				await element(by.id('create-channel-name')).replaceText(room);
				await element(by.id('create-channel-submit')).tap();
				await waitFor(element(by.id('room-view'))).toBeVisible().withTimeout(60000);
				await expect(element(by.id('room-view'))).toBeVisible();
				await waitFor(element(by.text(room))).toExist().withTimeout(60000);
				await expect(element(by.text(room))).toExist();
				await tapBack();
				await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(2000);
				await element(by.id('rooms-list-view-search')).replaceText(room);
				await sleep(2000);
				await waitFor(element(by.id(`rooms-list-view-item-${ room }`))).toBeVisible().withTimeout(60000);
				await expect(element(by.id(`rooms-list-view-item-${ room }`))).toBeVisible();
			});
github RocketChat / Rocket.Chat.ReactNative / e2e / 02-legal.spec.js View on Github external
it('should have legal screen', async() => {
			await expect(element(by.id('legal-view'))).toBeVisible();
		});
github RocketChat / Rocket.Chat.ReactNative / e2e / 06-roomslist.spec.js View on Github external
await element(by.id('rooms-list-view-search')).replaceText('rocket.cat');
			await sleep(2000);
			await waitFor(element(by.id('rooms-list-view-item-rocket.cat'))).toBeVisible().withTimeout(60000);
			await expect(element(by.id('rooms-list-view-item-rocket.cat'))).toBeVisible();
			await element(by.id('rooms-list-view-item-rocket.cat')).tap();
			await waitFor(element(by.id('room-view'))).toBeVisible().withTimeout(10000);
			await expect(element(by.id('room-view'))).toBeVisible();
			await waitFor(element(by.text('rocket.cat'))).toBeVisible().withTimeout(60000);
			await expect(element(by.text('rocket.cat'))).toBeVisible();
			await tapBack();
			await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(2000);
			await expect(element(by.id('rooms-list-view'))).toBeVisible();
			await element(by.id('rooms-list-view-search')).replaceText('');
			await sleep(2000);
			await waitFor(element(by.id('rooms-list-view-item-rocket.cat'))).toExist().withTimeout(60000);
			await expect(element(by.id('rooms-list-view-item-rocket.cat'))).toExist();
		});
github RocketChat / Rocket.Chat.ReactNative / e2e / 09-roomactions.spec.js View on Github external
async function backToRoomsList() {
	await tapBack();
	await waitFor(element(by.id('room-view'))).toBeVisible().withTimeout(2000);
	await tapBack();
	await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(2000);
}
github RocketChat / Rocket.Chat.ReactNative / e2e / 06-roomslist.spec.js View on Github external
await waitFor(element(by.id('rooms-list-view-search'))).toExist().withTimeout(2000);

			await element(by.id('rooms-list-view-search')).replaceText('rocket.cat');
			await sleep(2000);
			await waitFor(element(by.id('rooms-list-view-item-rocket.cat'))).toBeVisible().withTimeout(60000);
			await expect(element(by.id('rooms-list-view-item-rocket.cat'))).toBeVisible();
			await element(by.id('rooms-list-view-item-rocket.cat')).tap();
			await waitFor(element(by.id('room-view'))).toBeVisible().withTimeout(10000);
			await expect(element(by.id('room-view'))).toBeVisible();
			await waitFor(element(by.text('rocket.cat'))).toBeVisible().withTimeout(60000);
			await expect(element(by.text('rocket.cat'))).toBeVisible();
			await tapBack();
			await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(2000);
			await expect(element(by.id('rooms-list-view'))).toBeVisible();
			await element(by.id('rooms-list-view-search')).replaceText('');
			await sleep(2000);
			await waitFor(element(by.id('rooms-list-view-item-rocket.cat'))).toExist().withTimeout(60000);
			await expect(element(by.id('rooms-list-view-item-rocket.cat'))).toExist();
		});
github RocketChat / Rocket.Chat.ReactNative / e2e / 08-room.spec.js View on Github external
async function navigateToRoom() {
	await element(by.id('rooms-list-view-search')).replaceText(`private${ data.random }`);
	await sleep(2000);
    await waitFor(element(by.id(`rooms-list-view-item-private${ data.random }`))).toBeVisible().withTimeout(60000);
    await element(by.id(`rooms-list-view-item-private${ data.random }`)).tap();
    await waitFor(element(by.id('room-view'))).toBeVisible().withTimeout(5000);
}
github RocketChat / Rocket.Chat.ReactNative / e2e / helpers / app.js View on Github external
async function addServer() {
    await waitFor(element(by.id('onboarding-view'))).toBeVisible().withTimeout(2000);
    await element(by.id('connect-server-button')).tap();
    await waitFor(element(by.id('new-server-view'))).toBeVisible().withTimeout(60000);
    await expect(element(by.id('new-server-view'))).toBeVisible();
    await element(by.id('new-server-view-input')).replaceText(data.server);
    await element(by.id('new-server-view-button')).tap();
}