-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
What's new: updating the old moduleFor syntax to the newer syntax (used in Ember 3.0) as proposed in emberjs/rfcs#232 Tests: All tests still passing 268/268
- Loading branch information
Showing
38 changed files
with
673 additions
and
672 deletions.
There are no files selected for viewing
100 changes: 52 additions & 48 deletions
100
thirdeye/thirdeye-frontend/tests/acceptance/edit-alert-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,60 @@ | ||
import { test } from 'qunit'; | ||
import moduleForAcceptance from 'thirdeye-frontend/tests/helpers/module-for-acceptance'; | ||
import { module, test } from 'qunit'; | ||
import { setupApplicationTest } from 'ember-qunit'; | ||
import { visit, fillIn, click, currentURL } from '@ember/test-helpers'; | ||
import $ from 'jquery'; | ||
|
||
moduleForAcceptance('Acceptance | edit alert'); | ||
module('Acceptance | edit alert', function(hooks) { | ||
setupApplicationTest(hooks); | ||
|
||
const ALERT_NAME_INPUT = '#anomaly-form-function-name'; | ||
const SUBSCRIPTION_GROUP = '#anomaly-form-app-name'; | ||
const STATUS = '.te-toggle--form span'; | ||
const STATUS_RESULT = '.te-search-results__tag'; | ||
const EDIT_LINK = '/manage/alert/edit'; | ||
const STATUS_TOGGLER = '.x-toggle-btn'; | ||
const SUBMIT_BUTTON = '.te-button--submit'; | ||
const NEW_FUNC_NAME = 'test_function_2'; | ||
const NEW_FUNC_RESULT = '.te-search-results__title-name'; | ||
const ALERT_NAME_INPUT = '#anomaly-form-function-name'; | ||
const SUBSCRIPTION_GROUP = '#anomaly-form-app-name'; | ||
const STATUS = '.te-toggle--form span'; | ||
const STATUS_RESULT = '.te-search-results__tag'; | ||
const EDIT_LINK = '/manage/alert/edit'; | ||
const STATUS_TOGGLER = '.x-toggle-btn'; | ||
const SUBMIT_BUTTON = '.te-button--submit'; | ||
const NEW_FUNC_NAME = 'test_function_2'; | ||
const NEW_FUNC_RESULT = '.te-search-results__title-name'; | ||
|
||
test(`visiting ${EDIT_LINK} and checking that fields render correctly and edit is successful`, async (assert) => { | ||
const alert = server.create('alert'); | ||
await visit(`/manage/alert/${alert.id}/edit`); | ||
test(`visiting ${EDIT_LINK} and checking that fields render correctly and edit is successful`, async (assert) => { | ||
const alert = server.create('alert'); | ||
await visit(`/manage/alert/${alert.id}/edit`); | ||
|
||
assert.equal( | ||
currentURL(), | ||
'/manage/alert/1/edit', | ||
'correctly redirects to edit alerts page' | ||
); | ||
assert.equal( | ||
find(ALERT_NAME_INPUT).get(0).value, | ||
'test_function_1', | ||
'alert name is correct'); | ||
assert.equal( | ||
find(SUBSCRIPTION_GROUP).get(0).innerText, | ||
'beauty-and-the-beast', | ||
'subscription group name is correct'); | ||
assert.equal( | ||
find(STATUS).get(0).innerText, | ||
'Active', | ||
'alert status is correct'); | ||
assert.equal( | ||
currentURL(), | ||
'/manage/alert/1/edit', | ||
'correctly redirects to edit alerts page' | ||
); | ||
assert.equal( | ||
$(ALERT_NAME_INPUT).get(0).value, | ||
'test_function_1', | ||
'alert name is correct'); | ||
assert.equal( | ||
$(SUBSCRIPTION_GROUP).get(0).innerText, | ||
'beauty-and-the-beast', | ||
'subscription group name is correct'); | ||
assert.equal( | ||
$(STATUS).get(0).innerText, | ||
'Active', | ||
'alert status is correct'); | ||
|
||
await fillIn(ALERT_NAME_INPUT, NEW_FUNC_NAME); | ||
await click(STATUS_TOGGLER); | ||
await click(SUBMIT_BUTTON); | ||
await fillIn(ALERT_NAME_INPUT, NEW_FUNC_NAME); | ||
await click(STATUS_TOGGLER); | ||
await click(SUBMIT_BUTTON); | ||
|
||
assert.equal( | ||
currentURL(), | ||
'/manage/alerts', | ||
'correctly redirects to manage alerts page after edit' | ||
); | ||
assert.equal( | ||
currentURL(), | ||
'/manage/alerts', | ||
'correctly redirects to manage alerts page after edit' | ||
); | ||
|
||
assert.equal( | ||
find(`${NEW_FUNC_RESULT}[title='${NEW_FUNC_NAME}']`).get(0).innerText, | ||
NEW_FUNC_NAME, | ||
'after edit, alert name is saved correctly'); | ||
assert.equal( | ||
find(STATUS_RESULT).get(0).innerText, | ||
'Inactive', | ||
'after edit, alert status is saved correctly'); | ||
assert.equal( | ||
$(`${NEW_FUNC_RESULT}[title='${NEW_FUNC_NAME}']`).get(0).innerText, | ||
NEW_FUNC_NAME, | ||
'after edit, alert name is saved correctly'); | ||
assert.equal( | ||
$(STATUS_RESULT).get(0).innerText, | ||
'Inactive', | ||
'after edit, alert status is saved correctly'); | ||
}); | ||
}); |
18 changes: 0 additions & 18 deletions
18
thirdeye/thirdeye-frontend/tests/acceptance/example-test.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.