Page MenuHomeSoftware Heritage

Add tests for content view
ClosedPublic

Authored by kalpitk on Jun 26 2019, 3:34 PM.

Details

Summary

Related T1768
Add e2e tests for file/content view.

Diff Detail

Repository
rDWAPPS Web applications
Branch
fileTest
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 6572
Build 9160: tox-on-jenkinsJenkins
Build 9159: arc lint + arc unit

Event Timeline

anlambert added a subscriber: anlambert.

Looks good so far. I added some inline comments to improve some points of implementation.

cypress/integration/content-view.spec.js
9 ↗(On Diff #5514)

It would be great if you could compute the number of lines dynamically instead of harcoding it.

The easiest way will be to query the browse/origin/raw endpoint (you already computed this url in your last test implementation) in the before hook of the tests and then count the number of lines.

30 ↗(On Diff #5514)

Can you add a CSS class swh-content-filename to the card header in the templates/includes/content-display.html file and use it to select the filename element instead ?

This way, if one day we migrate away from using bootstrap, we won't need to modify this test implementation.

51 ↗(On Diff #5514)

Can you also test that the links to all sub-directories in the breadcrumbs are also present ?

57 ↗(On Diff #5514)

Here I would rather use the following selector a[href="${rawFilePath}]" in order to ensure the test will still pass if we move the Raw File button elsewhere in the layout.

This revision now requires changes to proceed.Jun 26 2019, 4:55 PM
  • Dynamically calculate number of Lines

I tried calculating number of lines dynamically but the number of lines displayed are 93 and response.body.split('\n').length gives me 94.

It looks like highlightjs will not render the last line of a source file if it is empty. You should check if the last element in the split array is the empty string and decrement the number of computed lines if it is the case.

Add tests for breadcrumbs paths

Great ! Let's land this !

This revision is now accepted and ready to land.Jul 1 2019, 10:41 AM
This revision was landed with ongoing or failed builds.Jul 1 2019, 12:01 PM
This revision was automatically updated to reflect the committed changes.