verdnatura-chat/e2e/00-addserver.spec.js

51 lines
1.7 KiB
JavaScript
Raw Normal View History

2018-05-23 13:39:18 +00:00
const {
device, expect, element, by, waitFor
} = require('detox');
const { takeScreenshot } = require('./helpers/screenshot');
const data = require('./data');
describe('Add server', () => {
before(async() => {
await waitFor(element(by.id('new-server-view'))).toBeVisible().withTimeout(2000);
});
describe('Render', async() => {
it('should have add server screen', async() => {
await expect(element(by.id('new-server-view'))).toBeVisible();
});
it('should have server input', async() => {
await expect(element(by.id('new-server-view-input'))).toBeVisible();
});
it('should have submit button', async() => {
await expect(element(by.id('new-server-view-button'))).toBeVisible();
});
after(async() => {
takeScreenshot();
});
});
describe('Usage', async() => {
it('should insert "invalidtest" and get an invalid instance', async() => {
await element(by.id('new-server-view-input')).replaceText('invalidtest');
await waitFor(element(by.text(' is not a valid Rocket.Chat instance'))).toBeVisible().withTimeout(60000);
await expect(element(by.text(' is not a valid Rocket.Chat instance'))).toBeVisible();
});
it('should have a button to add a new server', async() => {
await element(by.id('new-server-view-input')).replaceText(data.server);
await waitFor(element(by.text(' is a valid Rocket.Chat instance'))).toBeVisible().withTimeout(60000);
await expect(element(by.id('new-server-view-button'))).toBeVisible();
await element(by.id('new-server-view-button')).tap();
await waitFor(element(by.id('welcome-view'))).toBeVisible().withTimeout(60000);
await expect(element(by.id('welcome-view'))).toBeVisible();
});
afterEach(async() => {
takeScreenshot();
});
});
});