Skip to content

Commit

Permalink
Fix acceptance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ifrost committed Sep 14, 2020
1 parent 9db3da1 commit adb9d3a
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 25 deletions.
9 changes: 6 additions & 3 deletions js/utils/dropbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ define(function(require) {
clientId: key
});

// var state = Dropbox.Util.Oauth.randomAuthStateParam();
var url = client.getAuthenticationUrl(redirect_uri);
var popup = window.open(url, '_blank', 'width=500, height=500');
$(window).on('message.dropboxclient', function(e) {
Expand Down Expand Up @@ -125,6 +124,8 @@ define(function(require) {
var data = item_to_data(item);
if (data.isFolder) {
folders[data.path] = data;
} else if (options.pdfOnly && !data.name.match(/.*\.pdf$/)) {
return;
}
files.push(data);
});
Expand Down Expand Up @@ -160,13 +161,15 @@ define(function(require) {
var conflate_caller = function(conflate_callback, result) {
if (result && result.cursor) {
client.filesListFolderContinue({
cursor: result.cursor
cursor: result.cursor,
include_media_info: true
}).then(conflate_callback);
}
else {
client.filesListFolder({
path: is_lazy ? options.folder : '',
recursive: !is_lazy
recursive: !is_lazy,
include_media_info: true
}).then(conflate_callback);
}
};
Expand Down
19 changes: 9 additions & 10 deletions test/acceptance/spec/open.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,16 @@ define(function(require) {
it('WHEN a FinalDraft file is loaded THEN editor is set to its converted content', function(done) {
// WHEN
env.scenarios.load_local_file({
name: 'test.fountain',
content: '<?xml version="1.0" encoding="UTF-8"?><FinalDraft DocumentType="Script" Template="No" Version="1"><Content><Paragraph Type="Action"><Text>Action. Action.</Text></Paragraph></Content></FinalDraft>'
},
function() {
env.user.theme.open_plugin('editor');
name: 'test.fountain',
content: '<?xml version="1.0" encoding="UTF-8"?><FinalDraft DocumentType="Script" Template="No" Version="1"><Content><Paragraph Type="Action"><Text>Action. Action.</Text></Paragraph></Content></FinalDraft>'
},
function() {
env.user.theme.open_plugin('editor');

// THEN
env.assert.editor.editor_content('\nAction. Action.\n');
done();
}
);
// THEN
env.assert.editor.editor_content('\nAction. Action.\n');
done();
});
});

it('WHEN open from Dropbox is clicked THEN list of files is displayed', function(done) {
Expand Down
2 changes: 1 addition & 1 deletion test/acceptance/spec/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ define(function(require) {
env.assert.popup.dialog_input_content_is('screenplay.pdf');
});

it.only('WHEN save pdf to Dropbox button is clicked THEN save pdf to Dropbox dialog is displayed', function(done) {
it('WHEN save pdf to Dropbox button is clicked THEN save pdf to Dropbox dialog is displayed', function(done) {
// GIVEN
env.user.theme.open_plugin('preview');

Expand Down
28 changes: 17 additions & 11 deletions test/acceptance/spec/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ define(function(require) {

var Env = require('acceptance/env');

describe.only('Save plugin', function() {
describe('Save plugin', function() {

var env;

Expand Down Expand Up @@ -84,11 +84,14 @@ define(function(require) {
env.scenarios.initialise_saving_to_dropbox('fountain', function() {
env.user.popup.select_file('file.fountain');
env.user.popup.save_popup();

// THEN
env.assert.dropbox.dropbox_saved(1);
env.assert.popup.dialog_message_is('File saved!');
done();

Promise.resolve().then(function() {
// THEN
env.browser.tick(1000);
env.assert.dropbox.dropbox_saved(1);
env.assert.popup.dialog_message_is('File saved!');
done();
});
});
});

Expand All @@ -99,11 +102,14 @@ define(function(require) {

env.dropbox.disable();
env.user.popup.save_popup();

// THEN
env.assert.dropbox.dropbox_saved(0);
env.assert.popup.dialog_message_is('Could not save the file. Try again later.');
done();

Promise.resolve().then(function() {
// THEN
env.browser.tick(1000);
env.assert.dropbox.dropbox_saved(0);
env.assert.popup.dialog_message_is('Could not save the file. Try again later.');
done();
});
});
});

Expand Down

0 comments on commit adb9d3a

Please sign in to comment.