ql
1describe('Repository Search', () => {2beforeEach(() => {3cy.visit('/');4});5
6it('should display repositories of the current user if the search field is empty', () => {7cy.get('ul').within(() => {8cy.get('li').should('have.length.gt', 0);9});10});11
12it('should allow the user to search for repositories', () => {13const searchQuery = 'react';14
15cy.get('input[type="text"]').type(searchQuery).should('have.value', searchQuery);16cy.get('ul').within(() => {17cy.get('li').should('have.length.gt', 0);18cy.get('li').first().contains(searchQuery);19});20});21
22it('should allow pagination', () => {23cy.get('button').contains('2').click();24cy.get('ul').within(() => {25cy.get('li').should('have.length.gt', 0);26});27});28
29it('should navigate to the repository details page when a repo link is clicked', () => {30cy.get('ul').within(() => {31cy.get('li').first().within(() => {32cy.get('a').first().click();33});34});35cy.url().should('include', '/repository/');36});37});38