How to use the detox.by.traits 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.

github flow-typed / flow-typed / definitions / npm / detox_v7.x.x / test_detox_v7.x.x.js View on Github external
device.enableSynchronization();
device.disableSynchronization();
device.resetContentAndSettings();
device.getPlatform();

// Matchers
// --------
by.id("flowType");
by.text("flowType is great!");
by.label("welcome");
// $ExpectError
by.label(123);
by.type("RCTImageView");
by.traits(["button"]);
// $ExpectError
by.traits("button");

// Actions on element
// ------------------
element(by.id("testElement")).tap();
element(by.id("testElement")).longPress();

// $ExpectError
element(by.id("testElement")).multiTap(true);
element(by.id("testElement")).multiTap(3);

// $ExpectError
element(by.id("testElement")).tapAtPoint();
element(by.id("testElement")).tapAtPoint({ x: 5, y: 10 });

// $ExpectError
element(by.id("testElement")).typeText(false);
github flow-typed / flow-typed / definitions / npm / detox_v7.x.x / test_detox_v7.x.x.js View on Github external
device.setURLBlacklist(["https://flow.org", "https://flow.org"]);
device.enableSynchronization();
device.disableSynchronization();
device.resetContentAndSettings();
device.getPlatform();

// Matchers
// --------
by.id("flowType");
by.text("flowType is great!");
by.label("welcome");
// $ExpectError
by.label(123);
by.type("RCTImageView");
by.traits(["button"]);
// $ExpectError
by.traits("button");

// Actions on element
// ------------------
element(by.id("testElement")).tap();
element(by.id("testElement")).longPress();

// $ExpectError
element(by.id("testElement")).multiTap(true);
element(by.id("testElement")).multiTap(3);

// $ExpectError
element(by.id("testElement")).tapAtPoint();
element(by.id("testElement")).tapAtPoint({ x: 5, y: 10 });
github RocketChat / Rocket.Chat.ReactNative / e2e / 09-roomactions.spec.js View on Github external
it('should search and find a message', async() => {
				await element(by.id('room-actions-search')).tap();
				await waitFor(element(by.id('search-messages-view'))).toExist().withTimeout(2000);
				await expect(element(by.id('search-message-view-input'))).toBeVisible();
				await element(by.id('search-message-view-input')).replaceText(`/${ data.random }message/`);
				await waitFor(element(by.text(`${ data.random }message`).withAncestor(by.id('search-messages-view'))).atIndex(0)).toBeVisible().withTimeout(60000);
				await expect(element(by.text(`${ data.random }message`).withAncestor(by.id('search-messages-view'))).atIndex(0)).toBeVisible();
				await element(by.traits(['button'])).atIndex(0).tap();
				await backToActions();
			});