Skip to content

Commit

Permalink
test(e2e): Disable enter and spacebar tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mst101 committed Aug 10, 2021
1 parent 11d63ef commit 379cfc2
Show file tree
Hide file tree
Showing 11 changed files with 97 additions and 75 deletions.
88 changes: 46 additions & 42 deletions test/e2e/specs/CalendarButton.feature
Original file line number Diff line number Diff line change
Expand Up @@ -33,45 +33,49 @@ Feature: Calendar Button
| 4 | open | invalid | closes | cleared | calendar-button |


@id-3
Scenario: Press the enter key
Given the calendar is closed
When the user presses the enter key
Then the calendar opens
And today's cell has focus


@id-4
Scenario Outline: Press the enter key: typeable, <openOrClosed>, <validity> date
Given the typeable calendar is "<openOrClosed>" and a "<validity>" date is typed
When the user presses the enter key
Then the calendar "<opensOrCloses>"
And the date is "<formattedOrCleared>"
And the input has focus

Examples:
| # | openOrClosed | validity | opensOrCloses | formattedOrCleared |
| 1 | closed | valid | opens | formatted |
| 2 | closed | invalid | opens | cleared |


@id-5
Scenario: Press the space bar
Given the calendar is closed
When the user presses the space bar
Then the calendar opens
And today's cell has focus


@id-6
Scenario Outline: Press the space bar: typeable, <openOrClosed>, <validity> date
Given the typeable calendar is "<openOrClosed>" and a "<validity>" date is typed
When the user presses the space bar
Then the calendar "<opensOrCloses>"
And the date is "<formattedOrCleared>"
And the input has focus

Examples:
| # | openOrClosed | validity | opensOrCloses | formattedOrCleared |
| 1 | closed | valid | opens | formatted |
| 2 | closed | invalid | opens | cleared |
# N.B. These tests have been disabled until native events are supported by Cypress
# See https://github.com/cypress-io/cypress/issues/311
# and https://github.com/cypress-io/cypress/issues/8267

# @id-3
# Scenario: Press the enter key
# Given the calendar is closed
# When the user presses the enter key
# Then the calendar opens
# And today's cell has focus


# @id-4
# Scenario Outline: Press the enter key: typeable, <openOrClosed>, <validity> date
# Given the typeable calendar is "<openOrClosed>" and a "<validity>" date is typed
# When the user presses the enter key
# Then the calendar "<opensOrCloses>"
# And the date is "<formattedOrCleared>"
# And the input has focus
#
# Examples:
# | # | openOrClosed | validity | opensOrCloses | formattedOrCleared |
# | 1 | closed | valid | opens | formatted |
# | 2 | closed | invalid | opens | cleared |


# @id-5
# Scenario: Press the space bar
# Given the calendar is closed
# When the user presses the space bar
# Then the calendar opens
# And today's cell has focus


# @id-6
# Scenario Outline: Press the space bar: typeable, <openOrClosed>, <validity> date
# Given the typeable calendar is "<openOrClosed>" and a "<validity>" date is typed
# When the user presses the space bar
# Then the calendar "<opensOrCloses>"
# And the date is "<formattedOrCleared>"
# And the input has focus
#
# Examples:
# | # | openOrClosed | validity | opensOrCloses | formattedOrCleared |
# | 1 | closed | valid | opens | formatted |
# | 2 | closed | invalid | opens | cleared |
3 changes: 1 addition & 2 deletions test/e2e/specs/CalendarButton/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ describe('Calendar button', () => {
})

When('the user presses the enter key', () => {
// TODO: Remove arbitrary wait
focusThe('calendar-button').wait(100).type(`{enter}`)
the('calendar-button').type('{enter}')
})

Then('the calendar opens', () => {
Expand Down
11 changes: 7 additions & 4 deletions test/e2e/specs/CellSelection.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ Feature: Cell Selection
I want to select a cell
So that I pick a date

# N.B. The enter and space bar tests have been disabled until native events are supported by Cypress
# See https://github.com/cypress-io/cypress/issues/311
# and https://github.com/cypress-io/cypress/issues/8267

@id-1
Scenario Outline: Select by <action>: minimum view
Expand All @@ -14,8 +17,8 @@ Feature: Cell Selection
Examples:
| # | action |
| 1 | click |
| 2 | enter |
| 3 | space |
# | 2 | enter |
# | 3 | space |


@id-2
Expand All @@ -28,5 +31,5 @@ Feature: Cell Selection
Examples:
| # | action |
| 1 | click |
| 2 | enter |
| 3 | space |
# | 2 | enter |
# | 3 | space |
37 changes: 20 additions & 17 deletions test/e2e/specs/ClearButton.feature
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,23 @@ Feature: Clear Button
| 1 | closed |
| 2 | open |


@id-3
Scenario: Press the enter key
Given the calendar is closed and a date is selected
When the user focuses the clear button and presses the enter key
Then the calendar remains closed
And the date is cleared
And the input field has focus


@id-4
Scenario: Press the space bar
Given the calendar is closed and a date is selected
When the user focuses the clear button and presses the space bar
Then the calendar remains closed
And the date is cleared
And the input field has focus
# N.B. These tests have been disabled until native events are supported by Cypress
# See https://github.com/cypress-io/cypress/issues/311
# and https://github.com/cypress-io/cypress/issues/8267

# @id-3
# Scenario: Press the enter key
# Given the calendar is closed and a date is selected
# When the user focuses the clear button and presses the enter key
# Then the calendar remains closed
# And the date is cleared
# And the input field has focus


# @id-4
# Scenario: Press the space bar
# Given the calendar is closed and a date is selected
# When the user focuses the clear button and presses the space bar
# Then the calendar remains closed
# And the date is cleared
# And the input field has focus
8 changes: 6 additions & 2 deletions test/e2e/specs/NextButton.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Feature: Next Button
So that I can navigate to the next page


# N.B. The enter and space bar tests have been disabled until native events are supported by Cypress
# See https://github.com/cypress-io/cypress/issues/311
# and https://github.com/cypress-io/cypress/issues/8267

@id-1
Scenario Outline: Select by <action>
Given the calendar is open on `Dec 2020`
Expand All @@ -14,8 +18,8 @@ Feature: Next Button
Examples:
| # | action |
| 1 | click |
| 2 | enter |
| 3 | space |
# | 2 | enter |
# | 3 | space |

@id-2
Scenario: Arrow down to tabbable cell
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/specs/NextButton/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('Next Button', () => {
return
}

focusThe('next-button').type(`{${action}}`)
the('next-button').type(`{${action}}`)
})

Then('the page is `Jan 2021`', () => {
Expand Down
8 changes: 6 additions & 2 deletions test/e2e/specs/PreviousButton.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Feature: Previous Button
So that I can navigate to the previous page


# N.B. The enter and space bar tests have been disabled until native events are supported by Cypress
# See https://github.com/cypress-io/cypress/issues/311
# and https://github.com/cypress-io/cypress/issues/8267

@id-1
Scenario Outline: Select by <action>
Given the calendar is open on `Jan 2021`
Expand All @@ -14,8 +18,8 @@ Feature: Previous Button
Examples:
| # | action |
| 1 | click |
| 2 | enter |
| 3 | space |
# | 2 | enter |
# | 3 | space |

@id-2
Scenario: Arrow down to tabbable cell
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/specs/PreviousButton/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('Previous Button', () => {
return
}

focusThe('previous-button').type(`{${action}}`)
the('previous-button').type(`{${action}}`)
})

Then('the page is `Dec 2020`', () => {
Expand Down
3 changes: 2 additions & 1 deletion test/e2e/specs/TypeableCalendar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ describe('@id-1: Press the enter key', () => {
)

When('the user presses the enter key', () => {
focusThe('input').type(`{enter}`)
// Until Cypress supports native events, we can simulate this by blurring the input first
the('input').blur().type('{enter}')
})

Then('the calendar {string}', (opensOrCloses) => {
Expand Down
8 changes: 6 additions & 2 deletions test/e2e/specs/UpButton.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Feature: Up Button
So that I can navigate to the next view up


# N.B. The enter and space bar tests have been disabled until native events are supported by Cypress
# See https://github.com/cypress-io/cypress/issues/311
# and https://github.com/cypress-io/cypress/issues/8267

@id-1
Scenario Outline: Select up button by <action>
Given the calendar is open on `Jan 2021`
Expand All @@ -14,8 +18,8 @@ Feature: Up Button
Examples:
| # | action |
| 1 | click |
| 2 | enter |
| 3 | space |
# | 2 | enter |
# | 3 | space |


@id-2
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/specs/UpButton/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('Up Button', () => {
return
}

focusThe('up-button').type(`{${action}}`)
the('up-button').type(`{${action}}`)
})

Then('the page is `2021`', () => {
Expand Down

0 comments on commit 379cfc2

Please sign in to comment.