Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.waitForCardToBeCreated(expectedTitle)
.wait(() => {
console.log(1);
return true;
})
.waitForCardStatus(selectors.uploadsView.firstDocument, 'Conversion failed')
.wait(() => {
console.log(2);
return true;
})
.getResultsAsJson()
.then((results) => {
expect(results[0].title).toBe(expectedTitle);
done();
})
.catch(catchErrors(done));
});
});
it('should call users update with the body', (done) => {
spyOn(users, 'resetPassword').and.returnValue(Promise.resolve());
const req = { body: 'changes' };
routes.post('/api/resetpassword', req)
.then(() => {
expect(users.resetPassword).toHaveBeenCalledWith('changes');
done();
})
.catch(catchErrors(done));
});
});
it('should return number of templates using a thesauri', done => {
templates
.countByThesauri('thesauri1')
.then(result => {
expect(result).toBe(3);
done();
})
.catch(catchErrors(done));
});
it('should create a new one and return it', (done) => {
relationtypes.save({ name: 'Indiferent', properties: [] })
.then((result) => {
expect(result.name).toBe('Indiferent');
done();
})
.catch(catchErrors(done));
});
it('should return an error', (done) => {
const relationtype = { name: 'Against', properties: [] };
return relationtypes.save(relationtype)
.then(catchErrors(done))
.catch((error) => {
expect(error).toBe('duplicated_entry');
done();
});
});
});
it('should create a group called Test Group', (done) => {
nightmare
.clearInput(selectors.settingsView.newFilterGroupForm)
.write(selectors.settingsView.newFilterGroupForm, 'Test Group')
.waitToClick(selectors.settingsView.filtrableTypesSaveButton)
.wait('.alert.alert-success')
.isVisible('.alert.alert-success')
.then((result) => {
expect(result).toBe(true);
done();
})
.catch(catchErrors(done));
});
it('should insert Pie chart graph in page', (done) => {
nightmare
.evaluate(() => document.querySelector('div.panel-body.page-viewer.document-viewer > div > div.tab-content.tab-content-visible > textarea').value = '')
.write(localSelectors.pageContentsInput, '<p></p>')
.write(localSelectors.pageContentsInput, graphs.pieChart)
.waitToClick(localSelectors.savePageButton)
.wait('div.panel-body.page-viewer.document-viewer > div.alert.alert-info:first-of-type')
.getInnerText('div.panel-body.page-viewer.document-viewer > div.alert.alert-info:first-of-type')
.then((text) => {
expect(text).toContain('/page');
expect(text).toContain('(view page)');
})
.then(() => { done(); })
.catch(catchErrors(done));
});
beforeEach((done) => {
spyOn(process.stdout, 'write');
spyOn(errorLog, 'error');
paths.uploadDocumentsPath = __dirname;
testingDB.clearAllAndLoad(fixtures).then(done).catch(catchErrors(done));
});
beforeEach((done) => {
spyOn(process.stdout, 'write');
testingDB.clearAllAndLoad(fixtures).then(done).catch(catchErrors(done));
});
nightmare
.waitToClick(editPropertySelector(textPropertyIndex))
.waitToClick(hideLabelSelector(textPropertyIndex))
.waitToClick(usedAsFilterSelector(textPropertyIndex))
.waitToClick(editPropertySelector(relationshipPropertyIndex))
.select(localSelectors.relationShipSelect, '5aae90e0bfbf88e5ae28b18c')
.waitToClick(localSelectors.saveTemplate)
.waitToClick('.alert.alert-success')
.waitToClick(localSelectors.backbutton)
.getInnerText(localSelectors.template)
.then((text) => {
expect(text).toContain('Testing Document Type');
})
.then(() => { done(); })
.catch(catchErrors(done));
});