mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 13:39:24 +08:00
chore(e2e): make e2e more stable
This commit is contained in:
parent
00b7e0e0bd
commit
980f4d8919
@ -310,8 +310,6 @@ const InternalSchemaToolbar: FC<SchemaToolbarProps> = React.memo((props) => {
|
|||||||
}, [schemaSettingsExists, schemaSettingsRender, settings]);
|
}, [schemaSettingsExists, schemaSettingsRender, settings]);
|
||||||
const toolbarRef = useRef<HTMLDivElement>(null);
|
const toolbarRef = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
const hiddenClassName = process.env.__E2E__ ? 'hidden-e2e' : 'hidden';
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const toolbarElement = toolbarRef.current;
|
const toolbarElement = toolbarRef.current;
|
||||||
let parentElement = toolbarElement?.parentElement;
|
let parentElement = toolbarElement?.parentElement;
|
||||||
@ -327,14 +325,22 @@ const InternalSchemaToolbar: FC<SchemaToolbarProps> = React.memo((props) => {
|
|||||||
|
|
||||||
function show() {
|
function show() {
|
||||||
if (toolbarElement) {
|
if (toolbarElement) {
|
||||||
toolbarElement.classList.remove(hiddenClassName);
|
if (process.env.__E2E__) {
|
||||||
|
toolbarElement.style.display = 'block';
|
||||||
|
} else {
|
||||||
|
toolbarElement.classList.remove('hidden');
|
||||||
|
}
|
||||||
props.onVisibleChange?.(true);
|
props.onVisibleChange?.(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function hide() {
|
function hide() {
|
||||||
if (toolbarElement) {
|
if (toolbarElement) {
|
||||||
toolbarElement.classList.add(hiddenClassName);
|
if (process.env.__E2E__) {
|
||||||
|
toolbarElement.style.display = 'none';
|
||||||
|
} else {
|
||||||
|
toolbarElement.classList.add('hidden');
|
||||||
|
}
|
||||||
props.onVisibleChange?.(false);
|
props.onVisibleChange?.(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,10 +31,6 @@ export const useStyles = genStyleHook('nb-schema-toolbar', (token) => {
|
|||||||
pointerEvents: 'none',
|
pointerEvents: 'none',
|
||||||
},
|
},
|
||||||
|
|
||||||
'&.hidden-e2e': {
|
|
||||||
display: 'none',
|
|
||||||
},
|
|
||||||
|
|
||||||
'.ant-space-item .anticon': {
|
'.ant-space-item .anticon': {
|
||||||
margin: 0,
|
margin: 0,
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user