How to use the detox.expect 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
// Expect API
// ----------
expect(element(by.id("UniqueId204"))).toBeVisible();
expect(element(by.id("UniqueId204"))).toBeNotVisible();
expect(element(by.id("UniqueId204"))).toBeVisible();
expect(element(by.id("UniqueId204"))).toExist();
// $ExpectError
expect(element(by.id("UniqueId204"))).toHaveId(123);
expect(element(by.id("UniqueId204"))).toHaveId("someTestID");

// $ExpectError
expect(element(by.id("UniqueId204"))).toHaveLabel();
expect(element(by.id("UniqueId204"))).toHaveLabel("testLabel");

// $ExpectError
expect(element(by.id("UniqueId204"))).toHaveText(123);
expect(element(by.id("UniqueId204"))).toHaveText("some text");
// $ExpectError
expect(element(by.id("UniqueId204"))).toHaveValue(true);
expect(element(by.id("UniqueId204"))).toHaveValue("1");
expect(element(by.id("UniqueId204"))).toNotExist();

// waitFor API
waitFor(element(by.id("UniqueId204"))).toBeNotVisible();
waitFor(element(by.id("UniqueId204"))).toBeNotVisible();
waitFor(element(by.id("UniqueId204"))).toBeVisible();
// $ExpectError
waitFor(element(by.id("UniqueId204")))
  .toExist()
  .something();
waitFor(element(by.id("UniqueId204"))).toExist();
waitFor(element(by.id("UniqueId204"))).toHaveText("text");
github RocketChat / Rocket.Chat.ReactNative / e2e / 14-joinpublicroom.spec.js View on Github external
it('should not have messagebox', async() => {
				await expect(element(by.id('messagebox'))).toBeNotVisible();
			});
		});
github RocketChat / Rocket.Chat.ReactNative / e2e / 13-profile.spec.js View on Github external
it('should have name', async() => {
			await expect(element(by.id('profile-view-name'))).toExist();
		});
github henninghall / react-native-date-picker / examples / detox / e2eExplicitRequire / example.spec.js View on Github external
it('waitFor should be exported', async () => {
    await waitFor(element(by.id('welcome')))
      .toExist()
      .withTimeout(2000)
    await expect(element(by.id('welcome'))).toExist()
  })
})
github RocketChat / Rocket.Chat.ReactNative / e2e / 07-createroom.spec.js View on Github external
it('should select/unselect user', async() => {
			await element(by.id('select-users-view-item-rocket.cat')).tap();
			await waitFor(element(by.id('selected-user-rocket.cat'))).toBeVisible().withTimeout(5000);
			await expect(element(by.id('selected-user-rocket.cat'))).toBeVisible();
			await element(by.id('selected-user-rocket.cat')).tap();
			await waitFor(element(by.id('selected-user-rocket.cat'))).toBeNotVisible().withTimeout(5000);
			await expect(element(by.id('selected-user-rocket.cat'))).toBeNotVisible();
			await element(by.id('select-users-view-item-rocket.cat')).tap();
			await waitFor(element(by.id('selected-user-rocket.cat'))).toBeVisible().withTimeout(5000);
		});
github RocketChat / Rocket.Chat.ReactNative / e2e / 04-createuser.spec.js View on Github external
it('should submit email already taken and raise error', async() => {
			const invalidEmail = 'invalidemail';
			await element(by.id('register-view-name')).replaceText(data.user);
			await element(by.id('register-view-username')).replaceText(data.existingName);
			await element(by.id('register-view-email')).replaceText(data.email);
			await element(by.id('register-view-password')).replaceText(data.password);
			await element(by.id('register-view-submit')).tap();
			await waitFor(element(by.text('Username is already in use')).atIndex(0)).toExist().withTimeout(10000);
			await expect(element(by.text('Username is already in use')).atIndex(0)).toExist();
			await element(by.text('OK')).tap();
		});
github RocketChat / Rocket.Chat.ReactNative / e2e / 13-profile.spec.js View on Github external
it('should change email and password', async() => {
			await element(by.id('profile-view-email')).replaceText(`diego.mello+e2e${ data.random }test@rocket.chat`);
			await element(by.id('profile-view-new-password')).replaceText(`${ data.password }new`);
			await element(by.id('profile-view-submit')).tap();
			await waitFor(element(by.id('profile-view-typed-password'))).toBeVisible().withTimeout(10000);
			await expect(element(by.id('profile-view-typed-password'))).toBeVisible();
			await element(by.id('profile-view-typed-password')).replaceText(`${ data.password }`);
			await element(by.text('Save')).tap();
			await waitFor(element(by.text('Profile saved successfully!'))).toBeVisible().withTimeout(60000);
			await expect(element(by.text('Profile saved successfully!'))).toBeVisible();
			await waitFor(element(by.text('Profile saved successfully!'))).toBeNotVisible().withTimeout(10000);
			await expect(element(by.text('Profile saved successfully!'))).toBeNotVisible();
		});
github RocketChat / Rocket.Chat.ReactNative / e2e / 06-roomslist.spec.js View on Github external
it('should have rooms list screen', async() => {
			await expect(element(by.id('rooms-list-view'))).toBeVisible();
        });
github jolocom / smartwallet-app / e2e / 01_new_user / 02_creation.spec.ts View on Github external
it('should show an entropyMsg help text at first', async () => {
      const entropyMsg = element(by.id('entropyMsg'))
      await expect(entropyMsg).toBeVisible()
      const text = await readVisibleText('entropyMsg')
      jestExpect(text).not.toMatch(progressRegexp)
    })
github RocketChat / Rocket.Chat.ReactNative / e2e / helpers / app.js View on Github external
async function navigateToLogin() {
    await addServer();
    try {
        await waitFor(element(by.id('login-view'))).toBeVisible().withTimeout(2000);
        await expect(element(by.id('login-view'))).toBeVisible();
    } catch (error) {
        await waitFor(element(by.id('welcome-view'))).toBeVisible().withTimeout(2000);
        await expect(element(by.id('welcome-view'))).toBeVisible();
        await element(by.id('welcome-view-login')).tap();
        await waitFor(element(by.id('login-view'))).toBeVisible().withTimeout(2000);
        await expect(element(by.id('login-view'))).toBeVisible();
    }
}