diff --git a/cypress/integration/origin-diff.spec.js b/cypress/integration/origin-diff.spec.js new file mode 100644 --- /dev/null +++ b/cypress/integration/origin-diff.spec.js @@ -0,0 +1,46 @@ +/** + * Copyright (C) 2019 The Software Heritage developers + * See the AUTHORS file at the top-level directory of this distribution + * License: GNU Affero General Public License version 3, or any later version + * See top-level LICENSE file for more information + */ + +const origin = { + url: 'https://github.com/memononen/libtess2', + revision: '344b31572659aa74426c5c6ad91bbde3fe23bbb8' +}; + +let diffData; + +describe('Test Diffs View', function() { + before(function() { + const url = this.Urls.browse_revision(origin.revision) + `?origin=${origin.url}`; + + cy.visit(url).window().then(win => { + cy.request(win.diffRevUrl) + .then(res => { + diffData = res.body; + }); + }); + }); + + beforeEach(function() { + const url = this.Urls.browse_revision(origin.revision) + `?origin=${origin.url}`; + cy.visit(url); + cy.contains('a[data-toggle="tab"]', 'Changes') + .click(); + }); + + it('should list all files with changes', function() { + for (let change of diffData.changes) { + const fromFile = change.from_path; + const toFile = change.to_path; + cy.get('#swh-revision-changes-list a') + .contains(fromFile) + .should('be.visible'); + cy.get('#swh-revision-changes-list a') + .contains(toFile) + .should('be.visible'); + } + }); +});