jeudi 1 octobre 2020

HTML custom attribute not showing?

Using a React app, i am currently addind custom attributes to HTML tags or React components for E2E tests (Testcafe)

I am not sure why the extra data-test="burger-menu-btn" is not showing up in any Element when i inspect the page ?

 import {slide as Menu} from 'react-burger-menu';
 ...

 <Menu className="sidebar-menu" isOpen={menuOpen} data-test="burger-menu-btn">
        <Nav.Link onClick={() => goTo("/dashboard")}>
        ...
 </Menu>

Its also the case for regular HTML tags such as

<button className={"redirect-button"} data-test="return-dashboard-btn">Return</button>

Thus testcafe is not able to find the button with await Selector('[data-test="return-dashboard-btn"]');

The app is served either through webpack-dev-server or a webpack bundle

I don't think webpack removes any HTML attributes, not sure why they are gone.

Aucun commentaire:

Enregistrer un commentaire