Page MenuHomeSoftware Heritage

D2498.diff
No OneTemporary

D2498.diff

diff --git a/cypress/integration/origin-search.spec.js b/cypress/integration/origin-search.spec.js
--- a/cypress/integration/origin-search.spec.js
+++ b/cypress/integration/origin-search.spec.js
@@ -30,6 +30,17 @@
.and('contain', msg);
}
+function stubOriginVisitLatestRequests() {
+ cy.server();
+ cy.route({
+ method: 'GET',
+ url: '**/visit/latest/**',
+ response: {
+ type: 'tar'
+ }
+ }).as('originVisitLatest');
+}
+
describe('Test origin-search', function() {
before(function() {
origin = this.origin[0];
@@ -116,6 +127,7 @@
});
it('should paginate forward when there are many results', function() {
+ stubOriginVisitLatestRequests();
// Setup search
cy.get('#swh-search-origins-with-visit')
.uncheck()
@@ -126,6 +138,7 @@
// Get first page of results
doSearch(searchText);
+ cy.wait('@originVisitLatest');
cy.get('.swh-search-result-entry')
.should('have.length', 100);
@@ -143,6 +156,7 @@
// Get second page of results
cy.get('#origins-next-results-button a')
.click();
+ cy.wait('@originVisitLatest');
cy.get('.swh-search-result-entry')
.should('have.length', 100);
@@ -160,6 +174,7 @@
// Get third (and last) page of results
cy.get('#origins-next-results-button a')
.click();
+ cy.wait('@originVisitLatest');
cy.get('.swh-search-result-entry')
.should('have.length', 50);
@@ -177,6 +192,7 @@
});
it('should paginate backward from a middle page', function() {
+ stubOriginVisitLatestRequests();
// Setup search
cy.get('#swh-search-origins-with-visit')
.uncheck()
@@ -187,6 +203,7 @@
// Get first page of results
doSearch(searchText);
+ cy.wait('@originVisitLatest');
cy.get('#origins-prev-results-button')
.should('have.class', 'disabled');
@@ -196,6 +213,8 @@
// Get second page of results
cy.get('#origins-next-results-button a')
.click();
+ cy.wait('@originVisitLatest');
+
cy.get('#origins-prev-results-button')
.should('not.have.class', 'disabled');
cy.get('#origins-next-results-button')
@@ -204,6 +223,7 @@
// Get first page of results again
cy.get('#origins-prev-results-button a')
.click();
+ cy.wait('@originVisitLatest');
cy.get('.swh-search-result-entry')
.should('have.length', 100);
@@ -221,6 +241,7 @@
});
it('should paginate backward from the last page', function() {
+ stubOriginVisitLatestRequests();
// Setup search
cy.get('#swh-search-origins-with-visit')
.uncheck()
@@ -231,6 +252,7 @@
// Get first page of results
doSearch(searchText);
+ cy.wait('@originVisitLatest');
cy.get('#origins-prev-results-button')
.should('have.class', 'disabled');
@@ -240,6 +262,7 @@
// Get second page of results
cy.get('#origins-next-results-button a')
.click();
+ cy.wait('@originVisitLatest');
cy.get('#origins-prev-results-button')
.should('not.have.class', 'disabled');
@@ -258,6 +281,7 @@
// Get second page of results again
cy.get('#origins-prev-results-button a')
.click();
+ cy.wait('@originVisitLatest');
cy.get('.swh-search-result-entry')
.should('have.length', 100);
@@ -275,6 +299,7 @@
// Get first page of results again
cy.get('#origins-prev-results-button a')
.click();
+ cy.wait('@originVisitLatest');
cy.get('.swh-search-result-entry')
.should('have.length', 100);

File Metadata

Mime Type
text/plain
Expires
Dec 20 2024, 2:07 PM (11 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3217155

Event Timeline