Tweak recognizePDF fix, add test coverage, and enable manual tests
Still disabled in Travis until we mock the remote services
This commit is contained in:
parent
e34bf4d5cb
commit
6994c63a0e
2 changed files with 16 additions and 5 deletions
|
@ -258,7 +258,7 @@ Zotero.Translate.ItemSaver.prototype = {
|
|||
newAttachment = yield this._saveAttachmentFile.apply(this, arguments);
|
||||
} else {
|
||||
Zotero.debug('Translate: Ignoring attachment due to ATTACHMENT_MODE_IGNORE');
|
||||
attachmentCallback(attachment, false, e);
|
||||
attachmentCallback(attachment, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
describe.skip("PDF Recognition", function() {
|
||||
describe("PDF Recognition", function() {
|
||||
var win;
|
||||
|
||||
before(function* () {
|
||||
|
@ -52,7 +52,7 @@ describe.skip("PDF Recognition", function() {
|
|||
});
|
||||
|
||||
it("should recognize a PDF without a DOI", function* () {
|
||||
if (Zotero.automatedTest) this.skip(); // CAPTCHAs make this fail
|
||||
if (Zotero.automatedTest) this.skip(); // TODO: Mock
|
||||
|
||||
this.timeout(30000);
|
||||
// Import the PDF
|
||||
|
@ -65,9 +65,20 @@ describe.skip("PDF Recognition", function() {
|
|||
// Recognize the PDF
|
||||
win.Zotero_RecognizePDF.recognizeSelected();
|
||||
|
||||
var ids = yield waitForItemEvent("add");
|
||||
var item = Zotero.Items.get(ids[0]);
|
||||
var addedIDs = yield waitForItemEvent("add");
|
||||
var modifiedIDs = yield waitForItemEvent("modify");
|
||||
assert.lengthOf(addedIDs, 1);
|
||||
var item = Zotero.Items.get(addedIDs[0]);
|
||||
assert.equal(item.getField("title"), "Scaling study of an improved fermion action on quenched lattices");
|
||||
assert.equal(item.getField("libraryCatalog"), "Google Scholar");
|
||||
assert.lengthOf(modifiedIDs, 2);
|
||||
|
||||
yield Zotero.Promise.delay(0);
|
||||
|
||||
var progressWindow = getWindows("chrome://zotero/content/pdfProgress.xul")[0];
|
||||
assert.equal(
|
||||
progressWindow.document.getElementById("label").value,
|
||||
Zotero.getString("recognizePDF.complete.label")
|
||||
);
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue