-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test(featurelist): Cypress tests for featurelist #567
Conversation
3637e2f
to
ef1a069
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Move the test to new folder ‘regression-tests/layers-dialog’. The
smoke-test
folder should only contain tests for much larger functionality and this is just a single dialog. - Rename the test to
layer-features.spec.js
for consistency with the terminology used in the application and something that isn't tied to the implementation (slick-grid). - All selectors used in tests should be human readable in the spec and come from
selectors.js
. This extension can be helpful in building selectors for an element: https://chrome.google.com/webstore/detail/css-selector-helper-for-c/gddgceinofapfodcekopkjjelkbjodin - Create
fixtures/regression-tests/layers-dialog/layer-features
and add a new and unique test file there. Sharing data across tests will increase maintenance overhead as changes to any data file could impact multiple tests. When possible use unique data for each test. More variety in testing data will better exercise the application. The title on the dialog should have beenLayer Features
or something equivalent instead of the name of the file. That would be consistent with other similar dialogs likeLayer Description
,Rename Layer
,Export Data
, etc. It could then be used as part of the selector. Or, anid=“layerFeatures”
could be used as most dialogs have an id. However, the selectordata-testid="featurelist”
works just fine.- Tests missing for Sort Selected (context), Export, Go To, Show Selected Only checkbox, height slider, ctrl+click selections, shift+click selections, multiple instances of the dialog with different layers, sort via clicking on header, moving columns via drag, Show Description (for which test data currently in use in inadequate). Isolate different tests within the spec with an
it
for each area/category. - Consider smoke tests of this capability for other types of data in a new test spec.
Drop the use of.within
and make selectors more specific instead. Using.within
leads to lots of nesting and a less readable test.
Change this:
cy.get('[data-testid=\'featurelist\']').within(function() {
cy.get('[ng-if=\'ctrl.status\']').should('be.visible');
cy.get('[ng-if=\'ctrl.status\']').should('contain', '291 records');
});
To this:
cy.get(os.layerFeaturesDialog.STATUS_BAR)
.should('be.visible')
.should('contain', '291 records');
…with os.layerFeaturesDialog.STATUS_BAR
being [data-testid=\'featurelist\'] [ng-if=\'ctrl.status\']
set somewhere in selectors.js
.
I need clarification on 5. - are you just commenting on the UI / implementation, or asking for a change in the test? So are you asking for changes to #561 implementation? If not, the title is what it is. There is an id, but its not fixed.
I think I can deal with the other issues (except maybe 6 and 7 which is a lot of additional test scope), but I'm not sure how to deal with 5. |
|
I'm not going to do all of your tests. If that is unacceptable, say now and I'll stop wasting everyone's time. If you're willing to take the tests I'm willing to write (on my own time), and a ticket that identifies the additional tests (6/7), then we have a way forward. |
@bradh, apologies I didn't realize you were an open source contributor. We can make a note to expand coverage in the future for the test you wrote. Thank you for our efforts. |
I would scratch out 5 entirely. The window title uses the title of the layer because a feature list can be opened for each layer. This helps the user distinguish which data they're looking at, and should not be changed to something generic. As far as id's go, any window that can have multiple instances should not have a generic |
In terms of selectors, the use of I'm also a bit conflicted on |
@bradh, after discussion with @schmidtk, I've revised my original comment. Updated:
To clarify on the new |
I've done 1 and 2. I've done 4 except for the part about the description - its commented out in the KML, because it causes unexpected breakage. See below. For 3. I've refactored out the selectors, but putting them into a different file in a different directory seems wrong. If they aren't actually shared between test files, then it makes more sense to keep the selectors and usage together. For 5, 7 and 8 I took no action. For 6, introducing even a trivial description makes cypress error. It appears that the canvas is breaking the visibility / interaction.
|
Also could consider whether https://github.com/ngageoint/opensphere/blob/master/cypress/integration/smoke-tests/generate-heatmap.spec.js is really a "smoke test". |
|
On the point of selectors, we're planning on organizing |
Please understand that |
The visibility error may be related to cypress-io/cypress/issues/2558 or cypress-io/cypress/issues/1379. I'm not seeing a current workaround in either of those issues. |
Changing the
Using |
It all passed for me (and Travis) without the |
…phere:upscanMerge to master * commit 'bd4f4499d48268733611e9449d4631152accce64': refactor(layers): Open Layer Description with confirm. feat(draw): Allow drag pan during click interactions fix(draw): Update wrapX value from projection fix(draw): Fix drawing in wrapped extents fix(cesium): Sync all label styles to Cesium. feat(cesium): Show the sun when Sunlight is enabled. refactor(timeline): Resize on element size change. feat(alerts): Open alert links in a new tab. fix(alertpopup): Removed tooltip from alertpopup and added url hyperlinks to alerts window.
It does seem to be a timing issue. Even with the description tests disabled, I get the same visibility errors Brad was seeing with them enabled. |
6652b17
to
a2a1660
Compare
I've taken a different approach to the row selection (choosing a cell instead), which works OK. That was based on @justin-bits That allowed me to test the description capability. |
Ah I see, that's good to know. Thanks for working through this! |
This adds cypress tests for the new features display. However I'd appreciate feedback on whether there is a cleaner way. In particular, I'm not pleased with doing the selector on icons.
Is it acceptable to modify code (e.g. to add a stable
id
) to make testing more reliable?