-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Filter and Cluster acceptance tests for the locator (#831)
Add additional filter and cluster tests Enable clustering on the filter page and add some test coverage for filters and clusters. J=SLAP-1362 TEST=acceptance
- Loading branch information
Showing
3 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Selector, t } from 'testcafe'; | ||
|
||
/** | ||
* Models the user interaction with collapsible filters | ||
*/ | ||
class CollapsibleFilters { | ||
constructor () { | ||
this._viewFiltersButton = Selector('.js-changeFilters'); | ||
this._viewResultsButton = Selector('.Hitchhiker-ViewResultsButton'); | ||
this._collapsibleFiltersExpanded = Selector('.CollapsibleFilters--expanded'); | ||
} | ||
|
||
/** | ||
* Opens the filter view | ||
*/ | ||
async viewFilters () { | ||
await t.click(this._viewFiltersButton); | ||
} | ||
|
||
/** | ||
* Closes the filter view and opens the list view | ||
*/ | ||
async viewResults () { | ||
await t.click(this._viewResultsButton); | ||
} | ||
|
||
/** | ||
* Returns true if the filter view is open | ||
* @returns {Promise<boolean>} | ||
*/ | ||
async isFilterViewOpen () { | ||
return this._collapsibleFiltersExpanded.exists; | ||
} | ||
} | ||
|
||
export default new CollapsibleFilters(); |
32 changes: 32 additions & 0 deletions
32
tests/acceptance/suites/vertical-full-page-map-with-filters.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { PORT } from '../constants'; | ||
import SearchBar from '../blocks/searchbar'; | ||
import VerticalResults from '../blocks/verticalresults'; | ||
import ThemeMap from '../blocks/thememap'; | ||
import CollapsibleFilters from '../blocks/collapsiblefilters'; | ||
|
||
fixture`Vertical Full Page Map with Filters and Clusters` | ||
.page(`http://localhost:${PORT}/locations_full_page_map_with_filters`) | ||
|
||
test('Clicking on a pin closes the filter view', async t => { | ||
await SearchBar.submitQuery('virginia'); | ||
await CollapsibleFilters.viewFilters(); | ||
await ThemeMap.selectPin(); | ||
const isFilterViewOpen = await CollapsibleFilters.isFilterViewOpen(); | ||
await t.expect(isFilterViewOpen).notOk(); | ||
}); | ||
|
||
test('Clicking on a cluster causes the map to zoom in', async t => { | ||
await SearchBar.submitQuery('virginia'); | ||
const zoom = await ThemeMap.getZoom(); | ||
await ThemeMap.selectPinCluster(); | ||
const zoomAfterSelectingCluster = await ThemeMap.getZoom(); | ||
await t.expect(zoom).lt(zoomAfterSelectingCluster); | ||
}); | ||
|
||
test('Clicking on a cluster causes a new search to be ran', async t => { | ||
await SearchBar.submitQuery('virginia'); | ||
const numResults = await VerticalResults.getNumResults(); | ||
await ThemeMap.selectPinCluster(); | ||
const numResultsAfterSelectingCluster = await VerticalResults.getNumResults(); | ||
await t.expect(numResults).notEql(numResultsAfterSelectingCluster); | ||
}); |