From 7f821cbd17dabf2676c43dc45641ad4f0b4e8e83 Mon Sep 17 00:00:00 2001 From: John Cowen Date: Mon, 25 Jun 2018 12:11:01 +0100 Subject: [PATCH] Reset `` after every test, back to its original static value --- ui-v2/tests/acceptance/startup.feature | 1 - ui-v2/tests/helpers/yadda-annotations.js | 15 +++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ui-v2/tests/acceptance/startup.feature b/ui-v2/tests/acceptance/startup.feature index 70e54705c..a847fef3d 100644 --- a/ui-v2/tests/acceptance/startup.feature +++ b/ui-v2/tests/acceptance/startup.feature @@ -3,7 +3,6 @@ Feature: startup In order to give users an indication as early as possible that they are at the right place As a user I should be able to see a startup logo -@ignore Scenario: When loading the index.html file into a browser Given 1 datacenter model with the value "dc-1" Then the url should be '' diff --git a/ui-v2/tests/helpers/yadda-annotations.js b/ui-v2/tests/helpers/yadda-annotations.js index 7c972601e..43cc67853 100644 --- a/ui-v2/tests/helpers/yadda-annotations.js +++ b/ui-v2/tests/helpers/yadda-annotations.js @@ -3,6 +3,18 @@ import { skip } from 'qunit'; import { setupApplicationTest, setupRenderingTest, setupTest } from 'ember-qunit'; import api from 'consul-ui/tests/helpers/api'; +const staticClassList = [...document.documentElement.classList]; +function reset() { + window.localStorage.clear(); + api.server.reset(); + const list = document.documentElement.classList; + while (list.length > 0) { + list.remove(list.item(0)); + } + staticClassList.forEach(function(item) { + list.add(item); + }); +} // this logic could be anything, but in this case... // if @ignore, then return skip (for backwards compatibility) // if have annotations in config, then only run those that have a matching annotation @@ -64,8 +76,7 @@ function setupScenario(featureAnnotations, scenarioAnnotations) { } return function(model) { model.afterEach(function() { - window.localStorage.clear(); - api.server.reset(); + reset(); }); }; // return setupFn;