Attempt to fix tests

This commit is contained in:
Danielv123 committed 2025-08-10 00:28:48 +02:00
1 parent 630a0d3898
commit 89b6d5aa13
3 files changed
+56 -46

No files matched your search

+52 -46
View File
@@ -590,7 +590,7 @@ export default function CanvasMinimapPage() {
if (!resp.positions) { return null; } if (!resp.positions) { return null; }
const binStr = atob(resp.positions); const binStr = atob(resp.positions);
const buf = new Uint8Array(binStr.length); const buf = new Uint8Array(binStr.length);
for (let i=0; i<binStr.length; i++) { buf[i] = binStr.charCodeAt(i); } for (let i = 0; i < binStr.length; i++) { buf[i] = binStr.charCodeAt(i); }
playerPathBufRef.current = buf; playerPathBufRef.current = buf;
// Parse and deduplicate positions immediately after loading // Parse and deduplicate positions immediately after loading
@@ -936,24 +936,24 @@ export default function CanvasMinimapPage() {
useEffect(() => { useEffect(() => {
const isTypingInInput = (): boolean => { const isTypingInInput = (): boolean => {
const activeElement = document.activeElement; const activeElement = document.activeElement;
if (!activeElement) return false; if (!activeElement) { return false; }
const tagName = activeElement.tagName.toLowerCase(); const tagName = activeElement.tagName.toLowerCase();
const inputTypes = ['input', 'textarea', 'select']; const inputTypes = ["input", "textarea", "select"];
const isContentEditable = activeElement.getAttribute('contenteditable') === 'true'; const isContentEditable = activeElement.getAttribute("contenteditable") === "true";
// Check if it's an input field or contenteditable element // Check if it's an input field or contenteditable element
if (inputTypes.includes(tagName) || isContentEditable) { if (inputTypes.includes(tagName) || isContentEditable) {
return true; return true;
} }
// Check if it's an Ant Design Select dropdown (they use divs with specific classes) // Check if it's an Ant Design Select dropdown (they use divs with specific classes)
if (activeElement.closest('.ant-select-dropdown') || if (activeElement.closest(".ant-select-dropdown")
activeElement.closest('.ant-select-selector') || || activeElement.closest(".ant-select-selector")
activeElement.classList.contains('ant-select-selection-search-input')) { || activeElement.classList.contains("ant-select-selection-search-input")) {
return true; return true;
} }
return false; return false;
}; };
@@ -2191,7 +2191,7 @@ export default function CanvasMinimapPage() {
}} }}
> >
{/* Control Panel */} {/* Control Panel */}
<div style={{ <div style={{
marginBottom: "16px", marginBottom: "16px",
padding: "16px", padding: "16px",
border: "1px solid rgb(48, 48, 48)", border: "1px solid rgb(48, 48, 48)",
@@ -2220,7 +2220,9 @@ export default function CanvasMinimapPage() {
value: instance.id, value: instance.id,
label: instance.name, label: instance.name,
}))} }))}
suffixIcon={selectedInstance ? undefined : <span style={{ color: "#ff4d4f" }}>Required</span>} suffixIcon={selectedInstance
? undefined
: <span style={{ color: "#ff4d4f" }}>Required</span>}
/> />
</Space> </Space>
</Col> </Col>
@@ -2280,16 +2282,16 @@ export default function CanvasMinimapPage() {
<Col xs={24} md={8}> <Col xs={24} md={8}>
<Space direction="vertical" style={{ width: "100%" }} size="small"> <Space direction="vertical" style={{ width: "100%" }} size="small">
<Text strong style={{ fontSize: "12px", color: "#666" }}>DISPLAY OPTIONS</Text> <Text strong style={{ fontSize: "12px", color: "#666" }}>DISPLAY OPTIONS</Text>
<div style={{ <div style={{
display: "grid", display: "grid",
gridTemplateColumns: "repeat(2, 1fr)", gridTemplateColumns: "repeat(2, 1fr)",
gap: "8px", gap: "8px",
padding: "4px 0", padding: "4px 0",
}}> }}>
{/* Timelapse Toggle */} {/* Timelapse Toggle */}
<div style={{ <div style={{
display: "flex", display: "flex",
alignItems: "center", alignItems: "center",
justifyContent: "space-between", justifyContent: "space-between",
minHeight: "24px", minHeight: "24px",
}}> }}>
@@ -2304,10 +2306,10 @@ export default function CanvasMinimapPage() {
loading={loading} loading={loading}
disabled={!selectedInstance} disabled={!selectedInstance}
/> />
<Text <Text
type="secondary" type="secondary"
style={{ style={{
fontSize: "11px", fontSize: "11px",
width: "50px", width: "50px",
textAlign: "right", textAlign: "right",
}} }}
@@ -2318,9 +2320,9 @@ export default function CanvasMinimapPage() {
</div> </div>
{/* Chart Tags Toggle */} {/* Chart Tags Toggle */}
<div style={{ <div style={{
display: "flex", display: "flex",
alignItems: "center", alignItems: "center",
justifyContent: "space-between", justifyContent: "space-between",
minHeight: "24px", minHeight: "24px",
}}> }}>
@@ -2334,23 +2336,25 @@ export default function CanvasMinimapPage() {
}} }}
disabled={!selectedInstance} disabled={!selectedInstance}
/> />
<Text <Text
type="secondary" type="secondary"
style={{ style={{
fontSize: "11px", fontSize: "11px",
width: "50px", width: "50px",
textAlign: "right", textAlign: "right",
}} }}
> >
{showChartTags ? `${getVisibleChartTags().length} shown` : "Hidden"} {showChartTags
? `${getVisibleChartTags().length} shown`
: "Hidden"}
</Text> </Text>
</div> </div>
</div> </div>
{/* Recipes Toggle */} {/* Recipes Toggle */}
<div style={{ <div style={{
display: "flex", display: "flex",
alignItems: "center", alignItems: "center",
justifyContent: "space-between", justifyContent: "space-between",
minHeight: "24px", minHeight: "24px",
}}> }}>
@@ -2364,10 +2368,10 @@ export default function CanvasMinimapPage() {
}} }}
disabled={!selectedInstance} disabled={!selectedInstance}
/> />
<Text <Text
type="secondary" type="secondary"
style={{ style={{
fontSize: "11px", fontSize: "11px",
width: "50px", width: "50px",
textAlign: "right", textAlign: "right",
}} }}
@@ -2378,9 +2382,9 @@ export default function CanvasMinimapPage() {
</div> </div>
{/* Players Toggle */} {/* Players Toggle */}
<div style={{ <div style={{
display: "flex", display: "flex",
alignItems: "center", alignItems: "center",
justifyContent: "space-between", justifyContent: "space-between",
minHeight: "24px", minHeight: "24px",
}}> }}>
@@ -2394,15 +2398,17 @@ export default function CanvasMinimapPage() {
}} }}
disabled={!selectedInstance} disabled={!selectedInstance}
/> />
<Text <Text
type="secondary" type="secondary"
style={{ style={{
fontSize: "11px", fontSize: "11px",
width: "50px", width: "50px",
textAlign: "right", textAlign: "right",
}} }}
> >
{showPlayerPositions ? `${playerPositions.size} online` : "Hidden"} {showPlayerPositions
? `${playerPositions.size} online`
: "Hidden"}
</Text> </Text>
</div> </div>
</div> </div>
+3
View File
@@ -15,10 +15,12 @@ const { selectTargetCommand, initialize: initializeCtl } = require("@clusterio/c
// Make sure permissions from plugins are loaded // Make sure permissions from plugins are loaded
require("../../plugins/global_chat/dist/node/index"); require("../../plugins/global_chat/dist/node/index");
require("../../plugins/minimap/dist/node/index");
require("../../plugins/player_auth/dist/node/index"); require("../../plugins/player_auth/dist/node/index");
require("../../plugins/research_sync/dist/node/index"); require("../../plugins/research_sync/dist/node/index");
require("../../plugins/statistics_exporter/dist/node/index"); require("../../plugins/statistics_exporter/dist/node/index");
require("../../plugins/subspace_storage/dist/node/index"); require("../../plugins/subspace_storage/dist/node/index");
require("../../plugins/inventory_sync/dist/node/index");
class TestControl extends lib.Link { class TestControl extends lib.Link {
constructor(connector, subscribe = true) { constructor(connector, subscribe = true) {
@@ -319,6 +321,7 @@ before(async function() {
await execCtlProcess("plugin add ../../plugins/subspace_storage"); await execCtlProcess("plugin add ../../plugins/subspace_storage");
await execCtlProcess("plugin add ../../plugins/inventory_sync"); await execCtlProcess("plugin add ../../plugins/inventory_sync");
await execCtlProcess("plugin add ../../plugins/player_auth"); await execCtlProcess("plugin add ../../plugins/player_auth");
await execCtlProcess("plugin add ../../plugins/minimap");
console.log("Bootstrapping"); console.log("Bootstrapping");
await execController("bootstrap create-admin test"); await execController("bootstrap create-admin test");
+1
View File
@@ -39,6 +39,7 @@ describe("Clusterio Instance", function() {
for (const plugin of [ for (const plugin of [
"global_chat", "research_sync", "statistics_exporter", "subspace_storage", "player_auth", "inventory_sync", "global_chat", "research_sync", "statistics_exporter", "subspace_storage", "player_auth", "inventory_sync",
"minimap",
]) { ]) {
await execCtl(`instance config set ${instName} ${plugin}.load_plugin false`); await execCtl(`instance config set ${instName} ${plugin}.load_plugin false`);
} }