Skip to content

Commit

Permalink
fix: make failing cypress tests pass (#774)
Browse files Browse the repository at this point in the history
  • Loading branch information
sir-radar authored Mar 9, 2024
1 parent 5c2f6d3 commit 8c08203
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
27 changes: 15 additions & 12 deletions cypress/e2e/client.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Igbo API Homepage', () => {
});

it('navigate to Nkọwa okwu website', () => {
cy.findByTestId('nkowaokwu-link').click();
cy.findByTestId('nkowaokwu-link').click({ force: true });
cy.url().should('equal', 'https://nkowaokwu.com/home');
cy.contains('Internal Server Error').should('not.exist');
});
Expand All @@ -28,14 +28,14 @@ describe('Igbo API Homepage', () => {
});

it('render the About page', () => {
cy.get('li').contains('About').click();
cy.get('li').contains('About').click({ force: true });
cy.findByText('Contact');
cy.contains('Email:');
cy.contains('[email protected]');
});

it('render the Privacy page', () => {
cy.findByText('Privacy Policy').click();
cy.findByText('Privacy Policy').should('exist');
cy.get('h1').contains('Privacy Policy').should('exist');
});

it('render the Terms or Service page', () => {
Expand All @@ -46,10 +46,12 @@ describe('Igbo API Homepage', () => {
describe('Try it Out', () => {
it('enter a word and select flag', () => {
cy.visit('/');
cy.findByTestId('try-it-out-input').clear().type('biko');
cy.findByTestId('try-it-out-input').clear({ force: true }).type('biko', { force: true });
cy.findByTestId('dialects-flag').click();
cy.get('button').contains('Submit').click();
cy.get('input[value="http://localhost:8080/api/v1/words?keyword=biko&dialects=true"]');
cy.get('code')
.contains('http://localhost:8080/api/v1/words?keyword=biko&dialects=true')
.should('exist');
});
});

Expand Down Expand Up @@ -103,20 +105,21 @@ describe('Igbo API Homepage', () => {
});

it('render the About page', () => {
cy.findByAltText('down arrow as menu icon').click();
cy.get('button').contains('About').click();
cy.findByTestId('drop-down-button').click();
cy.get('button').contains('About').click({ force: true });
cy.findByText('Contact');
cy.contains('Email:');
cy.contains('[email protected]');
});
it('render the Sign up page', () => {
cy.findByAltText('down arrow as menu icon').click();
cy.get('button').contains('Get an API Key').click();
cy.findByTestId('drop-down-button').click();
cy.get('button').contains('Get an API Key').click({ force: true });
cy.findByText('Sign up.');
});

it('navigate to Nkọwa okwu', () => {
cy.visit('/');
cy.findByTestId('nkowaokwu-link').scrollTo(0, -300).click();
cy.scrollTo(0, -300);
cy.findByTestId('nkowaokwu-link').click({ force: true });
});
});
});
1 change: 1 addition & 0 deletions src/pages/components/Navbar/NavigationMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const NavigationMenu = () => (
_hover={{ backgroundColor: 'transparent' }}
_focus={{ backgroundColor: 'transparent' }}
_active={{ backgroundColor: 'transparent' }}
data-test="drop-down-button"
/>
<MenuList>
{navigationLinks.map(({ href, label }) => (
Expand Down

0 comments on commit 8c08203

Please sign in to comment.