Skip to content

Commit

Permalink
fix rest of acceptance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredgalanis committed Jul 9, 2024
1 parent 837bdb1 commit f141419
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 67 deletions.
106 changes: 46 additions & 60 deletions tests/acceptance/nih-submission-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@ module('Acceptance | submission', function (hooks) {

assert.dom('#swal2-title').includesText('Deposit requirements for JScholarship');

await click('.swal2-modal').parentElement;

await click('[data-test-workflow-review-submit]');

await waitFor('#swal2-title');
Expand Down Expand Up @@ -329,23 +327,20 @@ module('Acceptance | submission', function (hooks) {

await click('[data-test-workflow-review-submit]');

await waitFor(document.querySelector('#swal2-title'));
assert.dom(document.querySelector('#swal2-title')).includesText('Deposit requirements for JScholarship');

await click(document.querySelector('.swal2-modal').parentElement);
assert.dom('#swal2-title').doesNotExist();
await waitFor('#swal2-title');
assert.dom('#swal2-title').includesText('Deposit requirements for JScholarship');

await click('[data-test-workflow-review-submit]');

await waitFor(document.querySelector('#swal2-title'));
assert.dom(document.querySelector('#swal2-title')).includesText('Deposit requirements for JScholarship');
await waitFor(document.querySelector('.swal2-radio label:nth-child(1) input[type="radio"]'));
await click(document.querySelector('.swal2-radio label:nth-child(1) input[type="radio"]'));
await click(document.querySelector('.swal2-confirm'));
await waitFor('#swal2-title');
assert.dom('#swal2-title').includesText('Deposit requirements for JScholarship');
await waitFor('.swal2-radio label:nth-child(1) input[type="radio"]');
await click('.swal2-radio label:nth-child(1) input[type="radio"]');
await click('.swal2-confirm');

await waitFor(document.querySelector('#swal2-title'));
assert.dom(document.querySelector('#swal2-title')).includesText('Confirm submission');
await click(document.querySelector('.swal2-confirm'));
await waitFor('#swal2-title');
assert.dom('#swal2-title').includesText('Confirm submission');
await click('.swal2-confirm');

await waitFor('[data-test-workflow-thanks-thank-you]');
assert.dom('[data-test-workflow-thanks-thank-you]').includesText('Thank you!');
Expand Down Expand Up @@ -457,12 +452,12 @@ module('Acceptance | submission', function (hooks) {

await click('.alpaca-form-button-Next');

await waitFor(document.querySelector('#swal2-content'));
assert.dom(document.querySelector('#swal2-content')).includesText("should have required property 'author'");
await waitFor('#swal2-content');
assert.dom('#swal2-content').includesText("should have required property 'author'");

// Some reason, setting the document query to a variable before clicking works,
// but calling the query selector in the click does not work
const confirmBtn = document.querySelector('.swal2-confirm');
const confirmBtn = '.swal2-confirm';
await waitFor(confirmBtn);
assert.ok(confirmBtn);
await click(confirmBtn);
Expand Down Expand Up @@ -493,23 +488,20 @@ module('Acceptance | submission', function (hooks) {

await click('[data-test-workflow-review-submit]');

await waitFor(document.querySelector('#swal2-title'));
assert.dom(document.querySelector('#swal2-title')).includesText('Deposit requirements for JScholarship');

await click(document.querySelector('.swal2-modal').parentElement);
assert.dom('#swal2-title').doesNotExist();
await waitFor('#swal2-title');
assert.dom('#swal2-title').includesText('Deposit requirements for JScholarship');

await click('[data-test-workflow-review-submit]');

await waitFor(document.querySelector('#swal2-title'));
assert.dom(document.querySelector('#swal2-title')).includesText('Deposit requirements for JScholarship');
await waitFor(document.querySelector('.swal2-radio label:nth-child(1) input[type="radio"]'));
await click(document.querySelector('.swal2-radio label:nth-child(1) input[type="radio"]'));
await click(document.querySelector('.swal2-confirm'));
await waitFor('#swal2-title');
assert.dom('#swal2-title').includesText('Deposit requirements for JScholarship');
await waitFor('.swal2-radio label:nth-child(1) input[type="radio"]');
await click('.swal2-radio label:nth-child(1) input[type="radio"]');
await click('.swal2-confirm');

await waitFor(document.querySelector('#swal2-title'));
assert.dom(document.querySelector('#swal2-title')).includesText('Confirm submission');
await click(document.querySelector('.swal2-confirm'));
await waitFor('#swal2-title');
assert.dom('#swal2-title').includesText('Confirm submission');
await click('.swal2-confirm');

await waitFor('[data-test-workflow-thanks-thank-you]');
assert.dom('[data-test-workflow-thanks-thank-you]').includesText('Thank you!');
Expand Down Expand Up @@ -599,10 +591,10 @@ module('Acceptance | submission', function (hooks) {

await click('.alpaca-form-button-Next');

await waitFor(document.querySelector('#swal2-content'));
assert.dom(document.querySelector('#swal2-content')).includesText("should have required property 'author'");
await waitFor('#swal2-content');
assert.dom('#swal2-content').includesText("should have required property 'author'");

const confirmBtn = document.querySelector('.swal2-confirm');
const confirmBtn = '.swal2-confirm';
assert.ok(confirmBtn, 'No SweetAlert OK button found');
await waitFor(confirmBtn);
await click(confirmBtn);
Expand Down Expand Up @@ -639,23 +631,20 @@ module('Acceptance | submission', function (hooks) {

await click('[data-test-workflow-review-submit]');

await waitFor(document.querySelector('#swal2-title'));
assert.dom(document.querySelector('#swal2-title')).includesText('Deposit requirements for JScholarship');

await click(document.querySelector('.swal2-modal').parentElement);
assert.dom('#swal2-title').doesNotExist();
await waitFor('#swal2-title');
assert.dom('#swal2-title').includesText('Deposit requirements for JScholarship');

await click('[data-test-workflow-review-submit]');

await waitFor(document.querySelector('#swal2-title'));
assert.dom(document.querySelector('#swal2-title')).includesText('Deposit requirements for JScholarship');
await waitFor(document.querySelector('.swal2-radio label:nth-child(1) input[type="radio"]'));
await click(document.querySelector('.swal2-radio label:nth-child(1) input[type="radio"]'));
await click(document.querySelector('.swal2-confirm'));
await waitFor('#swal2-title');
assert.dom('#swal2-title').includesText('Deposit requirements for JScholarship');
await waitFor('.swal2-radio label:nth-child(1) input[type="radio"]');
await click('.swal2-radio label:nth-child(1) input[type="radio"]');
await click('.swal2-confirm');

await waitFor(document.querySelector('#swal2-title'));
assert.dom(document.querySelector('#swal2-title')).includesText('Confirm submission');
await click(document.querySelector('.swal2-confirm'));
await waitFor('#swal2-title');
assert.dom('#swal2-title').includesText('Confirm submission');
await click('.swal2-confirm');

await waitFor('[data-test-workflow-thanks-thank-you]');
assert.dom('[data-test-workflow-thanks-thank-you]').includesText('Thank you!');
Expand Down Expand Up @@ -806,23 +795,20 @@ module('Acceptance | submission', function (hooks) {

await click('[data-test-workflow-review-submit]');

await waitFor(document.querySelector('#swal2-title'));
assert.dom(document.querySelector('#swal2-title')).includesText('Deposit requirements for JScholarship');

await click(document.querySelector('.swal2-modal').parentElement);
assert.dom('#swal2-title').doesNotExist();
await waitFor('#swal2-title');
assert.dom('#swal2-title').includesText('Deposit requirements for JScholarship');

await click('[data-test-workflow-review-submit]');

await waitFor(document.querySelector('#swal2-title'));
assert.dom(document.querySelector('#swal2-title')).includesText('Deposit requirements for JScholarship');
await waitFor(document.querySelector('.swal2-radio label:nth-child(1) input[type="radio"]'));
await click(document.querySelector('.swal2-radio label:nth-child(1) input[type="radio"]'));
await click(document.querySelector('.swal2-confirm'));
await waitFor('#swal2-title');
assert.dom('#swal2-title').includesText('Deposit requirements for JScholarship');
await waitFor('.swal2-radio label:nth-child(1) input[type="radio"]');
await click('.swal2-radio label:nth-child(1) input[type="radio"]');
await click('.swal2-confirm');

await waitFor(document.querySelector('#swal2-title'));
assert.dom(document.querySelector('#swal2-title')).includesText('Confirm submission');
await click(document.querySelector('.swal2-confirm'));
await waitFor('#swal2-title');
assert.dom('#swal2-title').includesText('Confirm submission');
await click('.swal2-confirm');

await waitFor('[data-test-workflow-thanks-thank-you]');
assert.dom('[data-test-workflow-thanks-thank-you]').includesText('Thank you!');
Expand Down
13 changes: 6 additions & 7 deletions tests/acceptance/proxy-submission-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ module('Acceptance | proxy submission', function (hooks) {
await fillIn('[data-test-proxy-search-input]', 'Staff');
await click('[data-test-proxy-user-search-button]');

await waitFor(document.querySelector('.ember-modal-dialog'));
await waitFor(document.querySelector('[data-test-found-proxy-user]'));
await click(document.querySelector('[data-test-found-proxy-user]'));
await waitFor('.ember-modal-dialog');
await waitFor('[data-test-found-proxy-user]');
await click('[data-test-found-proxy-user]');

await walkThroughSubmissionFlow(assert, true); // eslint-disable-line no-use-before-define

Expand Down Expand Up @@ -161,10 +161,9 @@ module('Acceptance | proxy submission', function (hooks) {

await click('[data-test-workflow-files-next]');

await waitFor(document.querySelector('#swal2-title'));
assert.dom(document.querySelector('#swal2-title')).includesText('No manuscript present');
await click(document.querySelector('.swal2-confirm'));
assert.dom('#swal2-title').doesNotExist();
await waitFor('#swal2-title');
assert.dom('#swal2-title').includesText('No manuscript present');
await click('.swal2-confirm');

await waitFor('[data-test-workflow-review-submit]');
assert.strictEqual(currentURL(), '/submissions/new/review');
Expand Down

0 comments on commit f141419

Please sign in to comment.