-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[front] feat: support pasting URL and UID in search bar (#1841)
* added URL support in the search bar * Added tests for the search via URL and UID * removed line break (pretty lint error) * Update tests/cypress/e2e/frontend/search.cy.ts Co-authored-by: Adrien Matissart <amatissart@users.noreply.github.com> * Fixed edge cases * make the comments more explicit --------- Co-authored-by: Adrien Matissart <amatissart@users.noreply.github.com> Co-authored-by: Gresille&Siffle <39056254+GresilleSiffle@users.noreply.github.com>
- Loading branch information
1 parent
5283f56
commit c87240b
Showing
2 changed files
with
54 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
describe('Search', () => { | ||
describe('with a YouTube URL', () => { | ||
it('redirect automatically to the analysis page', () => { | ||
const videoURL = 'https://www.youtube.com/watch?v=b6vdKFxCvfU'; | ||
const videoId = 'b6vdKFxCvfU'; | ||
|
||
// Intercept the request to the API | ||
cy.intercept('GET', `/polls/videos/entities/yt:${videoId}/**`).as('videopoll'); | ||
|
||
cy.visit('/'); | ||
cy.get('input[id="searchInput"]').click().type(`${videoURL}{enter}`); | ||
|
||
|
||
cy.url().should('include', `/entities/yt:${videoId}`) | ||
cy.wait(`@videopoll`).its('response.statusCode').should('eq', 200); | ||
}); | ||
}); | ||
|
||
describe('with a Tournesol video UID', () => { | ||
it('redirect automatically to the analysis page', () => { | ||
const videoId = 'WPPPFqsECz0'; | ||
|
||
// Intercept the request to the API | ||
cy.intercept('GET', `/polls/videos/entities/yt:${videoId}/**`).as('videopoll'); | ||
|
||
cy.visit('/'); | ||
cy.get('input[id="searchInput"]').click().type(`yt:${videoId}{enter}`); | ||
|
||
cy.wait(`@videopoll`).its('response.statusCode').should('eq', 200); | ||
}); | ||
}); | ||
}); |