From d2d31861b610027516738c13c49196bd58dc2db4 Mon Sep 17 00:00:00 2001 From: Tomasz Subik Date: Sun, 17 Nov 2024 11:23:56 +0100 Subject: [PATCH] fix links are not crawable --- components/layout/header.js | 6 +++--- components/ui/dropdown.js | 9 +++++---- components/ui/user-dropdown.js | 11 +++++++---- e2e/cypress/e2e/operator.cy.js | 4 ++-- e2e/cypress/e2e/pages.cy.js | 2 +- e2e/cypress/e2e/password-reset.cy.js | 2 +- e2e/cypress/e2e/user.cy.js | 18 +++++++++--------- e2e/cypress/support/commands.js | 4 ++-- 8 files changed, 30 insertions(+), 26 deletions(-) diff --git a/components/layout/header.js b/components/layout/header.js index aacfb913..7f7a89cb 100644 --- a/components/layout/header.js +++ b/components/layout/header.js @@ -31,9 +31,9 @@ const Header = ({ url }) => {

- + Open Timber Portal - + {process.env.ENV === 'staging' && ( Staging @@ -47,7 +47,7 @@ const Header = ({ url }) => {
  • - +
  • diff --git a/components/ui/dropdown.js b/components/ui/dropdown.js index 5e7cd1d1..b9b98c4e 100644 --- a/components/ui/dropdown.js +++ b/components/ui/dropdown.js @@ -1,4 +1,4 @@ -import React, { useState, useEffect, useRef, useCallback } from 'react'; +import React, { useState, useRef } from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; @@ -14,12 +14,13 @@ const DropdownContent = (props) => { } const DropdownTrigger = (props) => { - const { children, className, ...dropdownTriggerProps } = props; + const { children, ...dropdownTriggerProps } = props; + const className = classNames('dropdown__trigger', props.className); return ( - + ); } diff --git a/components/ui/user-dropdown.js b/components/ui/user-dropdown.js index a8ea238b..f518aee0 100644 --- a/components/ui/user-dropdown.js +++ b/components/ui/user-dropdown.js @@ -1,5 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; +import cx from 'classnames'; import dynamic from 'next/dynamic'; @@ -16,10 +17,12 @@ import Icon from 'components/ui/icon'; const Login = dynamic(() => import('components/ui/login'), { ssr: false }); -const UserDropdown = ({ intl, user, displayIcon, theme }) => { +const UserDropdown = ({ intl, user, displayIcon, className, theme }) => { if (!user.token) { return ( - { modal.toggleModal(true, { children: Login @@ -28,13 +31,13 @@ const UserDropdown = ({ intl, user, displayIcon, theme }) => { > {displayIcon && } {intl.formatMessage({ id: 'signin' })} - +
  • ) } return (
    diff --git a/e2e/cypress/e2e/operator.cy.js b/e2e/cypress/e2e/operator.cy.js index 61296df0..6b5bb388 100644 --- a/e2e/cypress/e2e/operator.cy.js +++ b/e2e/cypress/e2e/operator.cy.js @@ -14,7 +14,7 @@ describe('Operator', function () { describe('updating operator profile', function () { beforeEach(function () { - cy.get('a').contains('My account').click(); + cy.get('div[role=button]').contains('My account').click(); cy.get('a').contains('Producer profile').click(); cy.location('pathname', {timeout: 25000}).should('include', '/operator/edit'); }) @@ -50,7 +50,7 @@ describe('Operator', function () { describe('documentation', function () { beforeEach(function () { - cy.get('a').contains('My account').click(); + cy.get('div[role=button]').contains('My account').click(); cy.contains('a', 'IFO / Interholco').click(); cy.location('pathname', {timeout: 25000}).should('include', '/documentation'); }) diff --git a/e2e/cypress/e2e/pages.cy.js b/e2e/cypress/e2e/pages.cy.js index 051171a3..488608a1 100644 --- a/e2e/cypress/e2e/pages.cy.js +++ b/e2e/cypress/e2e/pages.cy.js @@ -2,7 +2,7 @@ describe('Pages', () => { describe('Login page', () => { it('matches visually', function () { cy.visit('/'); - cy.get('a').contains('Sign in').click(); + cy.get('div[role=button]').contains('Sign in').click(); cy.get('.c-login').matchImage(); }); }) diff --git a/e2e/cypress/e2e/password-reset.cy.js b/e2e/cypress/e2e/password-reset.cy.js index 168e9265..b7eb0a29 100644 --- a/e2e/cypress/e2e/password-reset.cy.js +++ b/e2e/cypress/e2e/password-reset.cy.js @@ -5,7 +5,7 @@ describe('Password Reset', () => { describe('Forgot password form', () => { it('user can ask for password reset', function () { - cy.get('a').contains('Sign in').click(); + cy.get('div[role=button]').contains('Sign in').click(); cy.get('button').contains('Reset your password').click(); cy.get('#input-email').type('operator@example.com'); cy.get('button').contains('Reset Password').click(); diff --git a/e2e/cypress/e2e/user.cy.js b/e2e/cypress/e2e/user.cy.js index 1321d3ad..98148b25 100644 --- a/e2e/cypress/e2e/user.cy.js +++ b/e2e/cypress/e2e/user.cy.js @@ -10,33 +10,33 @@ describe('User', () => { context('Login form', () => { it('can log in', function () { cy.visit('/'); - cy.get('a').contains('Sign in').click(); + cy.get('div[role=button]').contains('Sign in').click(); cy.get('#input-email').type('operator@example.com'); cy.get('#input-password').type('wrongpassword'); cy.get('button').contains('Log in').click(); cy.get('.rrt-text').should('have.text', 'Wrong email or password'); cy.get('#input-password').clear().type('Supersecret1'); cy.get('button').contains('Log in').click(); - cy.contains('a', 'My account'); + cy.contains('div[role=button]', 'My account'); }); }) context('Public user', () => { it('can log in and out', function () { cy.login('operator@example.com', 'Supersecret1'); - cy.get('a').contains('My account').click(); + cy.get('div[role=button]').contains('My account').click(); cy.get('a').contains('My profile').click(); cy.get('#input-firstName').should('have.value', 'Operator'); cy.get('#input-lastName').should('have.value', 'User'); - cy.get('a').contains('My account').click(); + cy.get('div[role=button]').contains('My account').click(); cy.get('a').contains('Sign out').click(); - cy.get('a').contains('Sign in').should('exist') - cy.get('a').contains('My account').should('not.exist') + cy.get('div[role=button]').contains('Sign in').should('exist') + cy.get('div[role=button]').contains('My account').should('not.exist') }); it('can create account', function () { cy.visit('/'); - cy.get('a').contains('Sign in').click(); + cy.get('div[role=button]').contains('Sign in').click(); cy.get('a').contains('Register now').click(); cy.selectOption('[name=country_id]', 'Co', 'Congo'); cy.selectOption('[name=operator_id]', 'Si', 'SIFCO'); @@ -62,7 +62,7 @@ describe('User', () => { it('can create producer', function () { cy.visit('/'); - cy.get('a').contains('Sign in').click(); + cy.get('div[role=button]').contains('Sign in').click(); cy.get('a').contains('Register new producer').click(); cy.get('#input-name').type('Super New Producer'); @@ -88,7 +88,7 @@ describe('User', () => { }); it('can update user profile', function () { - cy.get('a').contains('My account').click(); + cy.get('div[role=button]').contains('My account').click(); cy.get('a').contains('My profile').click(); cy.get('#input-firstName').clear(); diff --git a/e2e/cypress/support/commands.js b/e2e/cypress/support/commands.js index 3a708a85..910fe9ee 100644 --- a/e2e/cypress/support/commands.js +++ b/e2e/cypress/support/commands.js @@ -15,11 +15,11 @@ Cypress.Commands.add('login', (username, password) => { [username, password], () => { cy.visit('/'); - cy.get('a').contains('Sign in').click(); + cy.get('div[role=button]').contains('Sign in').click(); cy.get('#input-email').type(username); cy.get('#input-password').type(password); cy.get('button').contains('Log in').click(); - cy.get('a').contains('My account').should('exist'); + cy.get('div[role=button]').contains('My account').should('exist'); }, { cacheAcrossSpecs: true