diff --git a/ui-v2/app/templates/settings.hbs b/ui-v2/app/templates/settings.hbs index fc5dc8fd80..fd579734a3 100644 --- a/ui-v2/app/templates/settings.hbs +++ b/ui-v2/app/templates/settings.hbs @@ -26,7 +26,7 @@ {{#if (not (env 'CONSUL_UI_DISABLE_REALTIME'))}} -
+

Blocking Queries

Keep catalog info up-to-date without refreshing the page. Any changes made to services, nodes and intentions would be reflected in real time.

diff --git a/ui-v2/tests/acceptance/settings/show.feature b/ui-v2/tests/acceptance/settings/show.feature index fd13061ec8..75490337ac 100644 --- a/ui-v2/tests/acceptance/settings/show.feature +++ b/ui-v2/tests/acceptance/settings/show.feature @@ -2,8 +2,23 @@ @notNamespaceable Feature: settings / show: Show Settings Page - Scenario: + Scenario: I see the Blocking queries Given 1 datacenter model with the value "datacenter" When I visit the settings page Then the url should be /setting And the title should be "Settings - Consul" + And I see blockingQueries + Scenario: Setting CONSUL_UI_DISABLE_REALTIME hides Blocking Queries + Given 1 datacenter model with the value "datacenter" + And settings from yaml + --- + CONSUL_UI_DISABLE_REALTIME: 1 + --- + Then I have settings like yaml + --- + CONSUL_UI_DISABLE_REALTIME: "1" + --- + When I visit the settings page + Then the url should be /setting + And the title should be "Settings - Consul" + And I don't see blockingQueries \ No newline at end of file diff --git a/ui-v2/tests/pages.js b/ui-v2/tests/pages.js index 4e009f8634..530b6f7cb6 100644 --- a/ui-v2/tests/pages.js +++ b/ui-v2/tests/pages.js @@ -1,4 +1,12 @@ -import { create, clickable, is, attribute, collection, text } from 'ember-cli-page-object'; +import { + create, + clickable, + is, + attribute, + collection, + text, + isPresent, +} from 'ember-cli-page-object'; import { alias } from 'ember-cli-page-object/macros'; import { visitable } from 'consul-ui/tests/lib/page-object/visitable'; import createDeletable from 'consul-ui/tests/lib/page-object/createDeletable'; @@ -112,5 +120,5 @@ export default { nspace: create( nspace(visitable, submitable, deletable, cancelable, policySelector, roleSelector) ), - settings: create(settings(visitable, submitable)), + settings: create(settings(visitable, submitable, isPresent)), }; diff --git a/ui-v2/tests/pages/settings.js b/ui-v2/tests/pages/settings.js index 3e858de933..d352311dc9 100644 --- a/ui-v2/tests/pages/settings.js +++ b/ui-v2/tests/pages/settings.js @@ -1,5 +1,6 @@ -export default function(visitable, submitable) { +export default function(visitable, submitable, isPresent) { return submitable({ visit: visitable('/setting'), + blockingQueries: isPresent('[data-test-blocking-queries]'), }); } diff --git a/ui-v2/tests/steps/assertions/page.js b/ui-v2/tests/steps/assertions/page.js index 6458a2aeb0..4e1489c7c3 100644 --- a/ui-v2/tests/steps/assertions/page.js +++ b/ui-v2/tests/steps/assertions/page.js @@ -123,15 +123,30 @@ export default function(scenario, assert, find, currentPage) { } }) .then(["I don't see $property"], function(property) { - assert.throws( - function() { - return currentPage()[property](); - }, - function(e) { - return e.message.startsWith('Element not found'); - }, - `Expected to not see ${property}` - ); + const message = `Expected to not see ${property}`; + let prop; + try { + prop = currentPage()[property]; + } catch (e) { + if (isExpectedError(e)) { + assert.ok(true, message); + } else { + throw e; + } + } + if (typeof prop === 'function') { + assert.throws( + function() { + prop(); + }, + function(e) { + return isExpectedError(e); + }, + message + ); + } else { + assert.notOk(prop); + } }) .then(['I see $property'], function(property) { assert.ok(currentPage()[property], `Expected to see ${property}`);