chore(e2e): make e2e more stable

This commit is contained in:
Zeke Zhang 2025-03-11 18:26:00 +08:00
parent 00b7e0e0bd
commit 980f4d8919
2 changed files with 10 additions and 8 deletions

View File

@ -310,8 +310,6 @@ const InternalSchemaToolbar: FC<SchemaToolbarProps> = React.memo((props) => {
}, [schemaSettingsExists, schemaSettingsRender, settings]);
const toolbarRef = useRef<HTMLDivElement>(null);
const hiddenClassName = process.env.__E2E__ ? 'hidden-e2e' : 'hidden';
useEffect(() => {
const toolbarElement = toolbarRef.current;
let parentElement = toolbarElement?.parentElement;
@ -327,14 +325,22 @@ const InternalSchemaToolbar: FC<SchemaToolbarProps> = React.memo((props) => {
function show() {
if (toolbarElement) {
toolbarElement.classList.remove(hiddenClassName);
if (process.env.__E2E__) {
toolbarElement.style.display = 'block';
} else {
toolbarElement.classList.remove('hidden');
}
props.onVisibleChange?.(true);
}
}
function hide() {
if (toolbarElement) {
toolbarElement.classList.add(hiddenClassName);
if (process.env.__E2E__) {
toolbarElement.style.display = 'none';
} else {
toolbarElement.classList.add('hidden');
}
props.onVisibleChange?.(false);
}
}

View File

@ -31,10 +31,6 @@ export const useStyles = genStyleHook('nb-schema-toolbar', (token) => {
pointerEvents: 'none',
},
'&.hidden-e2e': {
display: 'none',
},
'.ant-space-item .anticon': {
margin: 0,
},