Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should quote message', async() => {
await mockMessage('quote');
await element(by.text(`${ data.random }quote`)).longPress();
await waitFor(element(by.text('Message actions'))).toBeVisible().withTimeout(5000);
await expect(element(by.text('Message actions'))).toBeVisible();
await element(by.text('Quote')).tap();
await element(by.id('messagebox-input')).typeText(`${ data.random }quoted`);
await element(by.id('messagebox-send-message')).tap();
// TODO: test if quote was sent
});
it('should mute user', async() => {
await element(by.id(`room-members-view-item-${ data.alternateUser }`)).longPress();
await waitFor(element(by.text('Mute'))).toBeVisible().withTimeout(5000);
await expect(element(by.text('Mute'))).toBeVisible();
await element(by.text('Mute')).tap();
await waitFor(element(by.text('User has been muted!'))).toBeVisible().withTimeout(10000);
// await expect(element(by.text('User has been muted!'))).toBeVisible();
await waitFor(element(by.text('User has been muted!'))).toBeNotVisible().withTimeout(10000);
await expect(element(by.text('User has been muted!'))).toBeNotVisible();
await element(by.id(`room-members-view-item-${ data.alternateUser }`)).longPress();
await waitFor(element(by.text('Unmute'))).toBeVisible().withTimeout(2000);
await expect(element(by.text('Unmute'))).toBeVisible();
await element(by.text('Unmute')).tap();
await waitFor(element(by.text('User has been unmuted!'))).toBeVisible().withTimeout(10000);
// await expect(element(by.text('User has been unmuted!'))).toBeVisible();
await waitFor(element(by.text('User has been unmuted!'))).toBeNotVisible().withTimeout(10000);
await expect(element(by.text('User has been unmuted!'))).toBeNotVisible();
});
it("予定の詳細を削除", async () => {
await element(by.id("ScheduleID_1")).tap();
await element(by.id("ScheduleDetailID_1")).tap();
await element(by.id("ScheduleDetailMenu")).tap();
await element(by.text("削除")).tap();
await element(by.text("削除する")).tap();
});
});
it('should star message', async() => {
await element(by.text(`${ data.random }message`)).longPress();
await waitFor(element(by.text('Message actions'))).toBeVisible().withTimeout(5000);
await expect(element(by.text('Message actions'))).toBeVisible();
await element(by.text('Star')).tap();
await waitFor(element(by.text('Message actions'))).toBeNotVisible().withTimeout(5000);
await element(by.text(`${ data.random }message`)).longPress();
await waitFor(element(by.text('Unstar'))).toBeVisible().withTimeout(2000);
await expect(element(by.text('Unstar'))).toBeVisible();
await element(by.text('Cancel')).tap();
await waitFor(element(by.text('Cancel'))).toBeNotVisible().withTimeout(2000);
});
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 be read only', async() => {
await expect(element(by.text('This room is read only'))).toBeVisible();
});
it('should navigate to join community', async() => {
await element(by.id('join-community-button')).tap();
await waitFor(element(by.id('welcome-view'))).toBeVisible().withTimeout(60000);
await expect(element(by.id('welcome-view'))).toBeVisible();
await waitFor(element(by.text('Rocket.Chat'))).toBeVisible().withTimeout(60000);
await expect(element(by.text('Rocket.Chat'))).toBeVisible();
});
it('should get invalid room', async() => {
await element(by.id('create-channel-name')).replaceText('general');
await element(by.id('create-channel-submit')).tap();
await waitFor(element(by.text(`A channel with name 'general' exists`))).toBeVisible().withTimeout(60000);
await expect(element(by.text(`A channel with name 'general' exists`))).toBeVisible();
await element(by.text('OK')).tap();
});
it('should insert wrong password and get error', async() => {
await element(by.id('login-view-email')).replaceText(data.user);
await element(by.id('login-view-password')).replaceText('error');
await element(by.id('login-view-submit')).tap();
await waitFor(element(by.text('Your credentials were rejected! Please try again.'))).toBeVisible().withTimeout(10000);
await expect(element(by.text('Your credentials were rejected! Please try again.'))).toBeVisible();
await element(by.text('OK')).tap();
});
it('should enable/disable notifications', async() => {
await waitFor(element(by.id('room-actions-notifications'))).toBeVisible().whileElement(by.id('room-actions-list')).scroll(scrollDown, 'down');
await expect(element(by.text('Disable notifications'))).toBeVisible();
await element(by.id('room-actions-notifications')).tap();
await waitFor(element(by.text('Enable notifications'))).toBeVisible().withTimeout(60000);
await expect(element(by.text('Enable notifications'))).toBeVisible();
await element(by.id('room-actions-notifications')).tap();
await waitFor(element(by.text('Disable notifications'))).toBeVisible().withTimeout(60000);
await expect(element(by.text('Disable notifications'))).toBeVisible();
});