Commit bacc2c83 authored by Sam Saccone's avatar Sam Saccone

tests: Extract shared test steps into beforeEach

parent c87099c8
...@@ -140,8 +140,11 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod ...@@ -140,8 +140,11 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod
}); });
test.describe('Mark all as completed', function () { test.describe('Mark all as completed', function () {
test.it('should allow me to mark all items as completed', function () { test.beforeEach(function () {
createStandardItems(); createStandardItems();
});
test.it('should allow me to mark all items as completed', function () {
page.clickMarkAllCompletedCheckBox(); page.clickMarkAllCompletedCheckBox();
testOps.assertItemAtIndexIsCompleted(0); testOps.assertItemAtIndexIsCompleted(0);
...@@ -150,7 +153,6 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod ...@@ -150,7 +153,6 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod
}); });
test.it('should allow me to clear the completion state of all items', function () { test.it('should allow me to clear the completion state of all items', function () {
createStandardItems();
page.clickMarkAllCompletedCheckBox(); page.clickMarkAllCompletedCheckBox();
page.clickMarkAllCompletedCheckBox(); page.clickMarkAllCompletedCheckBox();
...@@ -160,7 +162,6 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod ...@@ -160,7 +162,6 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod
}); });
test.it('complete all checkbox should update state when items are completed / cleared', function () { test.it('complete all checkbox should update state when items are completed / cleared', function () {
createStandardItems();
page.clickMarkAllCompletedCheckBox(); page.clickMarkAllCompletedCheckBox();
testOps.assertCompleteAllIsChecked(); testOps.assertCompleteAllIsChecked();
...@@ -282,14 +283,16 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod ...@@ -282,14 +283,16 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod
test.describe('Clear completed button', function () { test.describe('Clear completed button', function () {
test.it('should display the correct text', function () { test.beforeEach(function () {
createStandardItems(); createStandardItems();
});
test.it('should display the correct text', function () {
page.toggleItemAtIndex(1); page.toggleItemAtIndex(1);
testOps.assertClearCompleteButtonText('Clear completed'); testOps.assertClearCompleteButtonText('Clear completed');
}); });
test.it('should remove completed items when clicked', function () { test.it('should remove completed items when clicked', function () {
createStandardItems();
page.toggleItemAtIndex(1); page.toggleItemAtIndex(1);
page.clickClearCompleteButton(); page.clickClearCompleteButton();
testOps.assertItemCount(2); testOps.assertItemCount(2);
...@@ -297,7 +300,6 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod ...@@ -297,7 +300,6 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod
}); });
test.it('should be hidden when there are no items that are completed', function () { test.it('should be hidden when there are no items that are completed', function () {
createStandardItems();
page.toggleItemAtIndex(1); page.toggleItemAtIndex(1);
testOps.assertClearCompleteButtonIsVisible(); testOps.assertClearCompleteButtonIsVisible();
page.clickClearCompleteButton(); page.clickClearCompleteButton();
...@@ -331,8 +333,10 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod ...@@ -331,8 +333,10 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod
}); });
test.describe('Routing', function () { test.describe('Routing', function () {
test.it('should allow me to display active items', function () { test.beforeEach(function () {
createStandardItems(); createStandardItems();
});
test.it('should allow me to display active items', function () {
page.toggleItemAtIndex(1); page.toggleItemAtIndex(1);
page.filterByActiveItems(); page.filterByActiveItems();
...@@ -359,7 +363,6 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod ...@@ -359,7 +363,6 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod
}); });
test.it('should allow me to display completed items', function () { test.it('should allow me to display completed items', function () {
createStandardItems();
page.toggleItemAtIndex(1); page.toggleItemAtIndex(1);
page.filterByCompletedItems(); page.filterByCompletedItems();
...@@ -367,7 +370,6 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod ...@@ -367,7 +370,6 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod
}); });
test.it('should allow me to display all items', function () { test.it('should allow me to display all items', function () {
createStandardItems();
page.toggleItemAtIndex(1); page.toggleItemAtIndex(1);
// apply the other filters first, before returning to the 'all' state // apply the other filters first, before returning to the 'all' state
...@@ -379,8 +381,6 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod ...@@ -379,8 +381,6 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod
}); });
test.it('should highlight the currently applied filter', function () { test.it('should highlight the currently applied filter', function () {
createStandardItems();
// initially 'all' should be selected // initially 'all' should be selected
testOps.assertFilterAtIndexIsSelected(0); testOps.assertFilterAtIndexIsSelected(0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment