Page MenuHomeSoftware Heritage

D1652.id5575.diff
No OneTemporary

D1652.id5575.diff

diff --git a/cypress/integration/errors.spec.js b/cypress/integration/errors.spec.js
new file mode 100644
--- /dev/null
+++ b/cypress/integration/errors.spec.js
@@ -0,0 +1,58 @@
+/**
+ * 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 unarchivedRepoUrl = 'https://github.com/SoftwareHeritage/swh-web';
+const archivedRepoUrl = 'https://github.com/memononen/libtess2';
+const unarchivedFileSha1git = 'eaa52086b0e8d99e8d62b05e3f28acd4091f35f5';
+
+function urlShouldShowError(url, error) {
+ cy.visit(url, {
+ failOnStatusCode: false
+ });
+ cy.get('.swh-http-error')
+ .should('be.visible');
+ cy.get('.swh-http-error-code')
+ .should('contain', error.code);
+ cy.get('.swh-http-error-desc')
+ .should('contain', error.msg);
+}
+
+describe('Test Errors', function() {
+ it('should display NotFoundExc for unarchived repo', function() {
+ const url = 'browse/origin/' + unarchivedRepoUrl + '/directory/';
+
+ urlShouldShowError(url, {
+ code: '404',
+ msg: 'NotFoundExc: Origin with url ' + unarchivedRepoUrl + ' not found!'
+ });
+ });
+
+ it('should display NotFoundExc for unarchived content', function() {
+ const url = 'browse/content/sha1_git:' + unarchivedFileSha1git + '/';
+
+ urlShouldShowError(url, {
+ code: '404',
+ msg: 'NotFoundExc: Content with sha1_git checksum equals to ' + unarchivedFileSha1git + ' not found!'
+ });
+ });
+
+ it('should display NotFoundExc for invalid directory from archived repo', function() {
+ const invalidSubDir = 'Source1';
+ const rootDir = 'browse/origin/' + archivedRepoUrl + '/directory/';
+ const subDir = rootDir + invalidSubDir;
+
+ cy.visit(rootDir);
+ cy.window().then(async win => {
+ const metadata = win.swh.webapp.getBrowsedSwhObjectMetadata();
+ urlShouldShowError(subDir, {
+ code: '404',
+ msg: 'NotFoundExc: Directory entry with path ' +
+ invalidSubDir + ' from ' + metadata.directory + ' not found'
+ });
+ });
+ });
+});

File Metadata

Mime Type
text/plain
Expires
Thu, Jul 3, 4:05 PM (2 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3217776

Event Timeline