From dfffdc4f88ed67c4dc06867cd147197b4888964f Mon Sep 17 00:00:00 2001 From: Adam Drago Date: Sat, 21 May 2016 12:33:01 -0700 Subject: [PATCH] Refactor preferences test. --- test/tests/menu/negative/preferences.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/test/tests/menu/negative/preferences.js b/test/tests/menu/negative/preferences.js index b84ee0e..30be33a 100644 --- a/test/tests/menu/negative/preferences.js +++ b/test/tests/menu/negative/preferences.js @@ -44,36 +44,36 @@ describe('Negative > Preferences', function () { .then(() => app.client.windowHandles()) .then((handles) => { windowHandles = handles.value; - app.client.window(windowHandles[1]) + // Focus the Preferences window + return app.client.window(windowHandles[1]); }) .then(() => { + // Get "Show tips" checkbox value return app.client.selectorExecute(TIPS_ID, (elements) => { return elements[0].checked; - }); + }) }) .then((isChecked) => { - originalIsChecked = isChecked; - - if (!isChecked) { - return app.client.leftClick(TIPS_ID); - } + return assert.isTrue(isChecked, '"Show tips" checkbox should default to checked.'); }) + // Focus the Negative window .then(() => app.client.window(windowHandles[0])) .then(() => { + // Get the class that is toggled by the "Show tips" checkbox return app.client.selectorExecute('//body', (elements) => { return elements[0].classList.contains('no-tips'); - }) + }); }) - .then((hasNoTipsClass) => assert.isFalse(hasNoTipsClass)) + .then((hasNoTipsClass) => assert.isFalse(hasNoTipsClass, 'The body element should not have the .no-tips class when "Show tips" is checked.')) .then(() => app.client.window(windowHandles[1])) .then(() => app.client.leftClick(TIPS_ID)) .then(() => app.client.window(windowHandles[0])) .then(() => { return app.client.selectorExecute('//body', (elements) => { return elements[0].classList.contains('no-tips'); - }) + }); }) - .then((hasNoTipsClass) => assert.isTrue(hasNoTipsClass)); + .then((hasNoTipsClass) => assert.isTrue(hasNoTipsClass, 'The body element should have the .no-tips class when "Show tips" is checked.')); }); // @TODO - Close should be tested here, but because it uses