Skip to content
This repository has been archived by the owner on Jul 3, 2023. It is now read-only.

Commit

Permalink
MINOR: Updated tests to use Background and better Given/When/Then/And…
Browse files Browse the repository at this point in the history
… values.
  • Loading branch information
Sam Minnee committed Jul 29, 2010
1 parent f13d912 commit dc0a0a9
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 33 deletions.
12 changes: 7 additions & 5 deletions tests/ajax.feature
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
Feature: Salad self-tests for ajax

Scenario: Perform ajax testing
Background:
Given I visit tests/form-fields.html
And I click "ajax3"

Scenario: Perform ajax testing
When I click "ajax3"
And I click the "ID_AjaxButton1" button
Then I see "This was retrieved via AJAX."

Given I click the "ajax3" button
When I click the "ajax3" button
Then I don't see "This was retrieved via AJAX."

Given I click the "Short delay" button
When I click the "Short delay" button
Then I see "This was retrieved via AJAX."

Given I click the "Clear field" button
When I click the "Clear field" button
Then I don't see "This was retrieved via AJAX."
9 changes: 6 additions & 3 deletions tests/checkboxes.feature
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
Feature: Salad self-tests for form fields

Scenario: Identify, and select checkboxes
Background:
Given I visit tests/form-fields.html
And I click the "ID_CheckboxA" checkbox

Scenario: Identify, and select checkboxes
When I click the "ID_CheckboxA" checkbox
Then the checkbox "Item one" is checked
And I click the "Item one" checkbox

When I click the "Item one" checkbox
Then the checkbox "Item 1" is not checked
And the checkbox "Item 2" is not checked
And the checkbox "CheckboxC" is not checked
4 changes: 3 additions & 1 deletion tests/expectations.feature
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
Feature: Salad self-tests for basic expectations

Scenario: Look for text we know to be there
Background:
Given I visit tests/form-fields.html

Scenario: Look for text we know to be there
Then I see "These buttons will cause confirm() popups"
And I see "These are links, some of which open new windows:"
And I see "Check some of the following:"
Expand Down
9 changes: 5 additions & 4 deletions tests/form-fields.feature
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
Feature: Salad self-tests for form fields

Background:
Given I visit tests/form-fields.html

Scenario: Identify, populate, and read text fields
Given I visit tests/form-fields.html
And I put "A" in the "Field A" field
When I put "A" in the "Field A" field
And I put "B" in the "ID_FieldB" field
And I put "C" in the "FieldC" field
And I put "D" in the "FieldD" field
Expand All @@ -12,8 +14,7 @@ Feature: Salad self-tests for form fields
And the "ID_FieldD" field is "D"

Scenario: Identify, populate, and read dropdowns
Given I visit tests/form-fields.html
And I select "two" from "Select A"
When I select "two" from "Select A"
And I select "three" from "ID_SelectB"
And I select "four" from "SelectC"
Then "SelectA" is "two"
Expand Down
6 changes: 4 additions & 2 deletions tests/general.feature
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
Feature: Salad self-tests for ajax

Scenario: Perform testing of generalised vocabulary
Background:
Given I visit tests/form-fields.html
And I click "ID_AjaxButton1"

Scenario: Perform testing of generalised vocabulary
When I click "ID_AjaxButton1"
And I click "ID_RadioA"
Then I inspect "IFrame1"
And I click "ID_RadioB"
Expand Down
2 changes: 1 addition & 1 deletion tests/pages.feature
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Feature: Salad self-tests for pages

Scenario: Visit URLs and make sure we got there
Given I visit tests/form-fields.html
When I visit tests/form-fields.html
Then I am sent to tests/form-fields.html
15 changes: 9 additions & 6 deletions tests/popups.feature
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
Feature: Check that popup confirmation is handled correctly
I want to be able to check that the system responds correctly to popup confirmation windows

Scenario: The user cancels popup windows for one button
Background:
Given I visit tests/form-fields.html
And I cancel popups
And I click the "Confirm one" button

Scenario: The user cancels popup windows for one button
Given I cancel popups
When I click the "Confirm one" button
Then I see "No was clicked for PopupButton1"

Scenario: The user accepts popup windows for the other button
Given I confirm popups
And I click the "ID_PopupButton2" button
When I click the "ID_PopupButton2" button
Then I see "Yes was clicked for PopupButton2"

Scenario: The user enters text for prompts
Given I put "Test" in the popup
When I put "Test" in the popup
And I click the "Enter text" button
Then I see "You entered: Test"

Given I cancel popups
And I click the "ID_PopupButton3" button
When I click the "ID_PopupButton3" button
Then I see "PopupButton3 was cancelled"

12 changes: 8 additions & 4 deletions tests/radiobuttons.feature
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
Feature: Salad self-tests for form fields

Scenario: Identify, and select radio buttons
Background:
Given I visit tests/form-fields.html
And I click the "ID_RadioA" radio button

Scenario: Identify, and select radio buttons
When I click the "ID_RadioA" radio button
Then "Option 1" is selected
And I click the "two" radio button

When I click the "two" radio button
Then "ID_RadioB" is selected
And I click the "Different option" radio button

When I click the "Different option" radio button
Then "radiogroup2" is selected
14 changes: 7 additions & 7 deletions tests/windows.feature
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
Feature: Salad self-tests for popup windows.

Scenario: Test basic links
Background:
Given I visit tests/form-fields.html
And I click the "SilverStripe.org" link

Scenario: Test basic links
When I click the "SilverStripe.org" link
Then I am at http://silverstripe.org
And I see "A CMS for website editors"

Scenario: Test links with the target "_blank"
Given I visit tests/form-fields.html
And I click the "New Window" link
When I click the "New Window" link
And I look in the window "New Window Test"
And I am at tests/new-window.html
Then I am at tests/new-window.html
And I see "This is a new window."

Scenario: Test links which use window.open
Given I visit tests/form-fields.html
And I click the "Google" link
When I click the "Google" link
And I look in the window "Google"
Then I am at http://www.google.co.nz

0 comments on commit dc0a0a9

Please sign in to comment.