Changeset View
Changeset View
Standalone View
Standalone View
cypress/integration/origin-search.spec.js
Show First 20 Lines • Show All 260 Lines • ▼ Show 20 Lines | it('should show error messages when using the query language', function() { | ||||
cy.wait('@searchOrigin').then((xhr) => { | cy.wait('@searchOrigin').then((xhr) => { | ||||
cy.get('#swh-no-result') | cy.get('#swh-no-result') | ||||
.should('contain', 'Syntax error in search query'); | .should('contain', 'Syntax error in search query'); | ||||
}); | }); | ||||
}); | }); | ||||
function checkSearchHasResults() { | |||||
cy.get('.swh-search-icon') | |||||
.click(); | |||||
cy.wait('@checkOriginVisits'); | |||||
cy.get('#origin-search-results') | |||||
.should('be.visible'); | |||||
cy.get('tbody tr td.swh-origin-visit-type') | |||||
.should('exist'); | |||||
} | |||||
it('should search all origins when no pattern is provided', function() { | |||||
cy.intercept('**/visit/latest/**').as('checkOriginVisits'); | |||||
// with default filters | |||||
checkSearchHasResults(); | |||||
// remove filters | |||||
cy.get('#swh-search-origins-with-visit') | |||||
.uncheck({force: true}) | |||||
.get('#swh-filter-empty-visits') | |||||
.uncheck({force: true}); | |||||
checkSearchHasResults(); | |||||
}); | |||||
it('should search all origins for a visit type', function() { | |||||
cy.intercept('**/visit/latest/**').as('checkOriginVisits'); | |||||
for (const visitType of ['git', 'tar']) { | |||||
cy.get('#swh-search-visit-type') | |||||
.select(visitType); | |||||
checkSearchHasResults(); | |||||
cy.get('tbody tr td.swh-origin-visit-type').then(elts => { | |||||
for (const elt of elts) { | |||||
cy.get(elt).should('have.text', visitType); | |||||
} | |||||
}); | |||||
} | |||||
}); | |||||
context('Test pagination', function() { | context('Test pagination', function() { | ||||
it('should not paginate if there are not many results', function() { | it('should not paginate if there are not many results', function() { | ||||
// Setup search | // Setup search | ||||
cy.get('#swh-search-origins-with-visit') | cy.get('#swh-search-origins-with-visit') | ||||
.uncheck({force: true}) | .uncheck({force: true}) | ||||
.get('#swh-filter-empty-visits') | .get('#swh-filter-empty-visits') | ||||
.uncheck({force: true}) | .uncheck({force: true}) | ||||
.then(() => { | .then(() => { | ||||
▲ Show 20 Lines • Show All 332 Lines • Show Last 20 Lines |