diff --git a/test/javascripts/acceptance/composer-actions-test.js.es6 b/test/javascripts/acceptance/composer-actions-test.js.es6 index 305b10394c2..291c1cb5993 100644 --- a/test/javascripts/acceptance/composer-actions-test.js.es6 +++ b/test/javascripts/acceptance/composer-actions-test.js.es6 @@ -10,9 +10,8 @@ acceptance('Composer Actions', { QUnit.test('replying to post', async assert => { const composerActions = selectKit('.composer-actions'); - visit('/t/internationalization-localization/280'); - click('article#post_3 button.reply'); - + await visit('/t/internationalization-localization/280'); + await click('article#post_3 button.reply'); await composerActions.expandAwait(); assert.equal(composerActions.rowByIndex(0).value(), 'reply_as_new_topic'); @@ -20,7 +19,6 @@ QUnit.test('replying to post', async assert => { assert.equal(composerActions.rowByIndex(2).value(), 'reply_to_topic'); assert.equal(composerActions.rowByIndex(3).value(), 'toggle_whisper'); assert.equal(composerActions.rowByIndex(4).value(), undefined); - }); QUnit.test('replying to post - reply_as_private_message', async assert => { @@ -36,12 +34,12 @@ QUnit.test('replying to post - reply_as_private_message', async assert => { assert.ok(find('.d-editor-input').val().indexOf('Continuing the discussion') >= 0); }); -QUnit.skip('replying to post - reply_to_topic', async assert => { +QUnit.test('replying to post - reply_to_topic', async assert => { const composerActions = selectKit('.composer-actions'); - visit('/t/internationalization-localization/280'); - click('article#post_3 button.reply'); - fillIn('.d-editor-input', 'test replying to topic when initially replied to post'); + await visit('/t/internationalization-localization/280'); + await click('article#post_3 button.reply'); + await fillIn('.d-editor-input', 'test replying to topic when initially replied to post'); await composerActions.expandAwait(); await composerActions.selectRowByValueAwait('reply_to_topic'); @@ -51,69 +49,68 @@ QUnit.skip('replying to post - reply_to_topic', async assert => { assert.equal(find('.d-editor-input').val(), 'test replying to topic when initially replied to post'); }); -QUnit.test('replying to post - toggle_whisper', assert => { +QUnit.test('replying to post - toggle_whisper', async assert => { const composerActions = selectKit('.composer-actions'); - visit('/t/internationalization-localization/280'); - click('article#post_3 button.reply'); - fillIn('.d-editor-input', 'test replying as whisper to topic when initially not a whisper'); - composerActions.expand().selectRowByValue('toggle_whisper'); + await visit('/t/internationalization-localization/280'); + await click('article#post_3 button.reply'); + await fillIn('.d-editor-input', 'test replying as whisper to topic when initially not a whisper'); - andThen(() => { - assert.ok( - find('.composer-fields .whisper').text().indexOf(I18n.t("composer.whisper")) > 0 - ); - }); + await composerActions.expandAwait(); + await composerActions.selectRowByValueAwait('toggle_whisper'); + + assert.ok( + find('.composer-fields .whisper').text().indexOf(I18n.t("composer.whisper")) > 0 + ); }); -QUnit.test('replying to post - reply_as_new_topic', assert => { +QUnit.test('replying to post - reply_as_new_topic', async assert => { const composerActions = selectKit('.composer-actions'); const categoryChooser = selectKit('.title-wrapper .category-chooser'); const categoryChooserReplyArea = selectKit('.reply-area .category-chooser'); const quote = 'test replying as new topic when initially replied to post'; - visit('/t/internationalization-localization/280'); + await visit('/t/internationalization-localization/280'); - click('#topic-title .d-icon-pencil'); - categoryChooser.expand().selectRowByValue(4); - click('#topic-title .submit-edit'); + await click('#topic-title .d-icon-pencil'); + await categoryChooser.expandAwait(); + await categoryChooser.selectRowByValueAwait(4); + await click('#topic-title .submit-edit'); - click('article#post_3 button.reply'); - fillIn('.d-editor-input', quote); - composerActions.expand().selectRowByValue('reply_as_new_topic'); + await click('article#post_3 button.reply'); + await fillIn('.d-editor-input', quote); - andThen(() => { - assert.equal(categoryChooserReplyArea.header().name(), 'faq'); - assert.equal(find('.action-title').text().trim(), I18n.t("topic.create_long")); - assert.ok(find('.d-editor-input').val().includes(quote)); - }); + await composerActions.expandAwait(); + await composerActions.selectRowByValueAwait('reply_as_new_topic'); + + assert.equal(categoryChooserReplyArea.header().name(), 'faq'); + assert.equal(find('.action-title').text().trim(), I18n.t("topic.create_long")); + assert.ok(find('.d-editor-input').val().includes(quote)); }); -QUnit.test('shared draft', assert => { - let composerActions = selectKit('.composer-actions'); +QUnit.test('shared draft', async assert => { + const composerActions = selectKit('.composer-actions'); - visit("/"); - click('#create-topic'); - andThen(() => { - composerActions.expand().selectRowByValue('shared_draft'); - }); - andThen(() => { - assert.equal( - find('#reply-control .btn-primary.create .d-button-label').text(), - I18n.t('composer.create_shared_draft') - ); - assert.ok(find('#reply-control.composing-shared-draft').length === 1); - }); + await visit("/"); + await click('#create-topic'); + + await composerActions.expandAwait(); + await composerActions.selectRowByValueAwait('shared_draft'); + + assert.equal( + find('#reply-control .btn-primary.create .d-button-label').text(), + I18n.t('composer.create_shared_draft') + ); + assert.ok(find('#reply-control.composing-shared-draft').length === 1); }); -QUnit.skip('interactions', async assert => { +QUnit.test('interactions', async assert => { const composerActions = selectKit('.composer-actions'); const quote = 'Life is like riding a bicycle.'; await visit('/t/internationalization-localization/280'); await click('article#post_3 button.reply'); await fillIn('.d-editor-input', quote); - await composerActions.expandAwait(); await composerActions.selectRowByValueAwait('reply_to_topic'); @@ -126,7 +123,7 @@ QUnit.skip('interactions', async assert => { assert.equal(composerActions.rowByIndex(1).value(), 'reply_to_post'); assert.equal(composerActions.rowByIndex(2).value(), 'reply_as_private_message'); assert.equal(composerActions.rowByIndex(3).value(), 'toggle_whisper'); - assert.equal(composerActions.rowByIndex(4).value(), undefined); + assert.equal(composerActions.rows().length, 4); await composerActions.selectRowByValueAwait('reply_to_post'); await composerActions.expandAwait(); @@ -138,7 +135,7 @@ QUnit.skip('interactions', async assert => { assert.equal(composerActions.rowByIndex(1).value(), 'reply_as_private_message'); assert.equal(composerActions.rowByIndex(2).value(), 'reply_to_topic'); assert.equal(composerActions.rowByIndex(3).value(), 'toggle_whisper'); - assert.equal(composerActions.rowByIndex(4).value(), undefined); + assert.equal(composerActions.rows().length, 4); await composerActions.selectRowByValueAwait('reply_as_new_topic'); await composerActions.expandAwait(); @@ -149,6 +146,7 @@ QUnit.skip('interactions', async assert => { assert.equal(composerActions.rowByIndex(1).value(), 'reply_as_private_message'); assert.equal(composerActions.rowByIndex(2).value(), 'reply_to_topic'); assert.equal(composerActions.rowByIndex(3).value(), 'shared_draft'); + assert.equal(composerActions.rows().length, 4); await composerActions.selectRowByValueAwait('reply_as_private_message'); await composerActions.expandAwait(); @@ -158,5 +156,5 @@ QUnit.skip('interactions', async assert => { assert.equal(composerActions.rowByIndex(0).value(), 'reply_as_new_topic'); assert.equal(composerActions.rowByIndex(1).value(), 'reply_to_post'); assert.equal(composerActions.rowByIndex(2).value(), 'reply_to_topic'); - assert.equal(composerActions.rowByIndex(3).value(), undefined); + assert.equal(composerActions.rows().length, 3); });