Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// 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");
it('should not have messagebox', async() => {
await expect(element(by.id('messagebox'))).toBeNotVisible();
});
});
it('should have name', async() => {
await expect(element(by.id('profile-view-name'))).toExist();
});
it('waitFor should be exported', async () => {
await waitFor(element(by.id('welcome')))
.toExist()
.withTimeout(2000)
await expect(element(by.id('welcome'))).toExist()
})
})
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);
});
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();
});
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();
});
it('should have rooms list screen', async() => {
await expect(element(by.id('rooms-list-view'))).toBeVisible();
});
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)
})
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();
}
}