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
});
test.describe('Mark all as completed', function () {
test.it('should allow me to mark all items as completed', function () {
test.beforeEach(function () {
createStandardItems();
});
test.it('should allow me to mark all items as completed', function () {
page.clickMarkAllCompletedCheckBox();
testOps.assertItemAtIndexIsCompleted(0);
......@@ -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 () {
createStandardItems();
page.clickMarkAllCompletedCheckBox();
page.clickMarkAllCompletedCheckBox();
......@@ -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 () {
createStandardItems();
page.clickMarkAllCompletedCheckBox();
testOps.assertCompleteAllIsChecked();
......@@ -282,14 +283,16 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod
test.describe('Clear completed button', function () {
test.it('should display the correct text', function () {
test.beforeEach(function () {
createStandardItems();
});
test.it('should display the correct text', function () {
page.toggleItemAtIndex(1);
testOps.assertClearCompleteButtonText('Clear completed');
});
test.it('should remove completed items when clicked', function () {
createStandardItems();
page.toggleItemAtIndex(1);
page.clickClearCompleteButton();
testOps.assertItemCount(2);
......@@ -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 () {
createStandardItems();
page.toggleItemAtIndex(1);
testOps.assertClearCompleteButtonIsVisible();
page.clickClearCompleteButton();
......@@ -331,8 +333,10 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod
});
test.describe('Routing', function () {
test.it('should allow me to display active items', function () {
test.beforeEach(function () {
createStandardItems();
});
test.it('should allow me to display active items', function () {
page.toggleItemAtIndex(1);
page.filterByActiveItems();
......@@ -359,7 +363,6 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod
});
test.it('should allow me to display completed items', function () {
createStandardItems();
page.toggleItemAtIndex(1);
page.filterByCompletedItems();
......@@ -367,7 +370,6 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod
});
test.it('should allow me to display all items', function () {
createStandardItems();
page.toggleItemAtIndex(1);
// apply the other filters first, before returning to the 'all' state
......@@ -379,8 +381,6 @@ module.exports.todoMVCTest = function (frameworkName, baseUrl, speedMode, laxMod
});
test.it('should highlight the currently applied filter', function () {
createStandardItems();
// initially 'all' should be selected
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