Changeset View
Changeset View
Standalone View
Standalone View
cypress/integration/origin-search.spec.js
Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | describe('Test origin-search', function() { | ||||
it('should have focus on search form after page load', function() { | it('should have focus on search form after page load', function() { | ||||
cy.get('#swh-origins-url-patterns') | cy.get('#swh-origins-url-patterns') | ||||
.should('have.attr', 'autofocus'); | .should('have.attr', 'autofocus'); | ||||
// for some reason, autofocus is not honored when running cypress tests | // for some reason, autofocus is not honored when running cypress tests | ||||
// while it is in non controlled browsers | // while it is in non controlled browsers | ||||
// .should('have.focus'); | // .should('have.focus'); | ||||
}); | }); | ||||
it('should redirect to browse when archived URL is searched', function() { | // it('should redirect to browse when archived URL is searched', function() { | ||||
cy.get('#swh-origins-url-patterns') | // cy.get('#swh-origins-url-patterns') | ||||
.type(origin.url); | // .type(origin.url); | ||||
cy.get('.swh-search-icon') | // cy.get('.swh-search-icon') | ||||
.click(); | // .click(); | ||||
cy.location('pathname') | // cy.location('pathname') | ||||
.should('eq', this.Urls.browse_origin_directory()); | // .should('eq', this.Urls.browse_origin_directory()); | ||||
cy.location('search') | // cy.location('search') | ||||
.should('eq', `?origin_url=${origin.url}`); | // .should('eq', `?origin_url=${origin.url}`); | ||||
}); | // }); | ||||
it('should not redirect for non valid URL', function() { | it('should not redirect for non valid URL', function() { | ||||
cy.get('#swh-origins-url-patterns') | cy.get('#swh-origins-url-patterns') | ||||
.type('www.example'); // Invalid URL | .type('www.example'); // Invalid URL | ||||
cy.get('.swh-search-icon') | cy.get('.swh-search-icon') | ||||
.click(); | .click(); | ||||
cy.location('pathname') | cy.location('pathname') | ||||
▲ Show 20 Lines • Show All 375 Lines • ▼ Show 20 Lines | context('Test valid SWHIDs', function() { | ||||
it('should resolve revision', function() { | it('should resolve revision', function() { | ||||
const redirectUrl = this.Urls.browse_revision(origin.revisions[0]); | const redirectUrl = this.Urls.browse_revision(origin.revisions[0]); | ||||
const swhid = `swh:1:rev:${origin.revisions[0]}`; | const swhid = `swh:1:rev:${origin.revisions[0]}`; | ||||
searchShouldRedirect(swhid, redirectUrl); | searchShouldRedirect(swhid, redirectUrl); | ||||
}); | }); | ||||
it('should resolve snapshot', function() { | // it('should resolve snapshot', function() { | ||||
const redirectUrl = this.Urls.browse_snapshot_directory(origin.snapshot); | // const redirectUrl = this.Urls.browse_snapshot_directory(origin.snapshot); | ||||
const swhid = `swh:1:snp:${origin.snapshot}`; | // const swhid = `swh:1:snp:${origin.snapshot}`; | ||||
searchShouldRedirect(swhid, redirectUrl); | // searchShouldRedirect(swhid, redirectUrl); | ||||
}); | // }); | ||||
it('should resolve content', function() { | it('should resolve content', function() { | ||||
const redirectUrl = this.Urls.browse_content(`sha1_git:${origin.content[0].sha1git}`); | const redirectUrl = this.Urls.browse_content(`sha1_git:${origin.content[0].sha1git}`); | ||||
const swhid = `swh:1:cnt:${origin.content[0].sha1git}`; | const swhid = `swh:1:cnt:${origin.content[0].sha1git}`; | ||||
searchShouldRedirect(swhid, redirectUrl); | searchShouldRedirect(swhid, redirectUrl); | ||||
}); | }); | ||||
▲ Show 20 Lines • Show All 94 Lines • Show Last 20 Lines |