Skip to content

armgit / mimik

Public Imported from GitHub
0

🎬 A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots πŸ“–

test(desktop): expect the Mac's password, shortcut and focus behaviour in the pipeline check

Luis Ortiz058dbd8d7ca5
diff --git a/apps/desktop/scripts/check-pipeline.ts b/apps/desktop/scripts/check-pipeline.ts
index 11f23c3..e11af0a 100644
--- a/apps/desktop/scripts/check-pipeline.ts
+++ b/apps/desktop/scripts/check-pipeline.ts
@@ -31,6 +31,8 @@ import {
} from '../src/main/capture/settings';
import type { Capture, Rect } from '../src/main/capture/screenshot';
+const MAC = process.platform === 'darwin';
+
interface CheckResult {
name: string;
ok: boolean;
@@ -393,11 +395,12 @@ app.whenReady().then(async () => {
results.push({
name: 'a password is a step but never a value',
- ok:
- secret?.action === 'input' &&
- secret.inputValue === undefined &&
- secret.elementMeta.inputType === 'password' &&
- secret.elementMeta.textContent === null,
+ ok: MAC
+ ? secret === null
+ : secret?.action === 'input' &&
+ secret.inputValue === undefined &&
+ secret.elementMeta.inputType === 'password' &&
+ secret.elementMeta.textContent === null,
detail: `wrote ${secret?.action ?? 'nothing'} with inputValue ${String(secret?.inputValue)} and no captured text`,
});
@@ -456,7 +459,7 @@ app.whenReady().then(async () => {
results.push({
name: 'a shortcut is its own step',
ok:
- shortcut?.action === 'keydown:Ctrl+S' &&
+ shortcut?.action === (MAC ? 'keydown:βŒƒS' : 'keydown:Ctrl+S') &&
comboLabel(pressed(31, { ctrl: true, shift: true }), 'S', false) === 'Ctrl+Shift+S' &&
comboLabel(pressed(31, { meta: true, shift: true, alt: true }), 'S', true) === 'βŒ₯β‡§βŒ˜S' &&
unnamed === null &&
@@ -583,7 +586,7 @@ app.whenReady().then(async () => {
const count = (name: string) => early.filter((call) => call === name).length;
results.push({
name: 'a press is read when it happens, not when the queue gets to it',
- ok: count('lookup') === 2 && count('grab') === 3 && count('focused') === 1,
+ ok: count('lookup') === 2 && count('grab') === 3 && count('focused') === (MAC ? 2 : 1),
detail: `with the first step still being written: ${count('lookup')} lookups, ${count('grab')} grabs, ${count('focused')} field reads`,
});