Changeset View
Changeset View
Standalone View
Standalone View
cypress/e2e/origin-search.cy.js
Show First 20 Lines • Show All 305 Lines • ▼ Show 20 Lines | for (const visitType of ['git', 'tar']) { | ||||
cy.get('tbody tr td.swh-origin-visit-type').then(elts => { | cy.get('tbody tr td.swh-origin-visit-type').then(elts => { | ||||
for (const elt of elts) { | for (const elt of elts) { | ||||
cy.get(elt).should('have.text', visitType); | cy.get(elt).should('have.text', visitType); | ||||
} | } | ||||
}); | }); | ||||
} | } | ||||
}); | }); | ||||
it('should encode origin argument in latest visit URL queried by XHR', function() { | it('should encode ? in origin URL provided as argument in latest visit URL queried by XHR', function() { | ||||
// origin added in tests data by Python | // origin added in tests data by Python | ||||
const originUrl = 'https://example.org/project/download.php?version=2.0'; | const originUrl = 'https://example.org/project/download.php?version=2.0'; | ||||
cy.intercept(`**/api/1/origin/${encodeURIComponent(originUrl)}/visit/latest/**`) | cy.intercept(`**/api/1/origin/${originUrl.replace('?', '%3F')}/visit/latest/**`) | ||||
.as('checkOriginVisit'); | .as('checkOriginVisit'); | ||||
doSearch(originUrl); | doSearch(originUrl); | ||||
cy.wait('@checkOriginVisit'); | cy.wait('@checkOriginVisit'); | ||||
cy.get('.swh-search-result-entry') | cy.get('.swh-search-result-entry') | ||||
.should('have.length', 1); | .should('have.length', 1); | ||||
▲ Show 20 Lines • Show All 352 Lines • Show Last 20 Lines |