Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/lib/MetadataList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
scroll = $bindable({ y: 0 }),
}: Props = $props();

const { showTechnicalMetadata } = $derived(getSettings());
const { debugMode } = $derived(getSettings());

const compareDefinitions = $derived(metadataDefinitionComparator({ metadataOrder: ordering }));

Expand Down Expand Up @@ -101,7 +101,7 @@

{#snippet defs()}
{#each definitions as def (def.id)}
{#if def.label || showTechnicalMetadata}
{#if def.label || debugMode}
{@render children(def, values[def.id], {
collapsed: group?.collapsed ?? false,
})}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/MobileWIPOverlay.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
const mobile = new IsMobile();
</script>

{#if mobile.current && !getSettings().showTechnicalMetadata}
{#if mobile.current && !getSettings().debugMode}
<div class="overlay">
<p>
{feature} est en cours de développement pour les appareils mobiles. En attendant, veuillez
Expand Down
2 changes: 1 addition & 1 deletion src/lib/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ const Settings = table(
}
),
showInputHints: 'boolean',
showTechnicalMetadata: 'boolean',
debugMode: 'boolean',
cropAutoNext: 'boolean = false',
// TODO: revert back to smart default (before https://github.com/cigaleapp/cigale/commit/81af290cb3b50f6d62ec5274b109958b84f769fb)
// for now this causes too many OOM crashes...
Expand Down
2 changes: 1 addition & 1 deletion src/lib/settings.svelte.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export async function toggleSetting(key) {
}

export function isDebugMode() {
return getSettings().showTechnicalMetadata;
return getSettings().debugMode;
}

export function locale() {
Expand Down
2 changes: 1 addition & 1 deletion src/routes/(app)/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
'i d e v': {
help: 'Activer/Désactiver le debug mode',
do: async () => {
await setSetting('showTechnicalMetadata', isDebugMode() ? false : true);
await setSetting('debugMode', isDebugMode() ? false : true);
},
},
});
Expand Down
2 changes: 1 addition & 1 deletion src/routes/(app)/+layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ async function initializeSettings() {
gridSize: 1,
language: 'fr',
showInputHints: true,
showTechnicalMetadata: dev,
debugMode: dev,
cropAutoNext: false,
gallerySort: { key: 'date', direction: 'asc' },
});
Expand Down
6 changes: 3 additions & 3 deletions src/routes/(app)/Settings.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
})();
});

const { showTechnicalMetadata, language, parallelism, submitIssuesVia } =
const { debugMode, language, parallelism, submitIssuesVia } =
$derived(getSettings());

const theme = getTheme();
Expand Down Expand Up @@ -250,14 +250,14 @@
type: 'selectable',
key: 'debug-mode',
label: 'Mode debug',
selected: showTechnicalMetadata,
selected: debugMode,
closeOnSelect: false,
data: {
icon: IconDebugMode,
subtext: '',
},
async onclick() {
await setSetting('showTechnicalMetadata', !showTechnicalMetadata);
await setSetting('debugMode', !debugMode);
},
},
...desktopOnly({
Expand Down
2 changes: 1 addition & 1 deletion src/routes/(app)/protocols/[id]/exports/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
{/each}
</dl>

{#if getSettings().showTechnicalMetadata}
{#if getSettings().debugMode}
<pre class="debug">{JSON.stringify(
tables.Protocol.state.find((p) => p.id === data.protocol.id)?.exports,
null,
Expand Down
2 changes: 1 addition & 1 deletion tests/classification.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@
const metadata = observation.metadataOverrides[`${lightweightProtocol.id}__species`];

if (confirmed) {
expect(metadata).toHaveProperty('confirmed', true);

Check failure on line 339 in tests/classification.spec.ts

View workflow job for this annotation

GitHub Actions / E2E / Test (shard 3 of 16)

[chromium] › tests/classification.spec.ts:328:2 › full-screen classification view › classification confirmation @pr

1) [chromium] › tests/classification.spec.ts:328:2 › full-screen classification view › classification confirmation @pr Error: expect(received).toHaveProperty(path, value) Matcher error: received value must not be null nor undefined Received has value: undefined 337 | 338 | if (confirmed) { > 339 | expect(metadata).toHaveProperty('confirmed', true); | ^ 340 | } else { 341 | // allow either a confirmed=false or no confirmed property at all 342 | // TODO: a custom matcher to make the error more readable at assertDatabaseConfirmedStatus (/__w/cigale/cigale/tests/classification.spec.ts:339:22) at /__w/cigale/cigale/tests/classification.spec.ts:437:3
} else {
// allow either a confirmed=false or no confirmed property at all
// TODO: a custom matcher to make the error more readable
Expand Down Expand Up @@ -423,7 +423,7 @@
await page.getByTestId('current').getByRole('combobox').blur();
await expect(
page.getByRole('progressbar', { name: 'Observations classifiées: 100%' })
).toBeVisible();

Check failure on line 426 in tests/classification.spec.ts

View workflow job for this annotation

GitHub Actions / E2E / Test (shard 3 of 16)

[chromium] › tests/classification.spec.ts:328:2 › full-screen classification view › classification confirmation @pr

1) [chromium] › tests/classification.spec.ts:328:2 › full-screen classification view › classification confirmation @pr Error: expect(locator).toBeVisible() failed Locator: getByRole('progressbar', { name: 'Observations classifiées: 100%' }) Expected: visible Timeout: 5000ms Error: element(s) not found Call log: - Expect "soft toBeVisible" with timeout 5000ms - waiting for getByRole('progressbar', { name: 'Observations classifiées: 100%' }) 424 | await expect( 425 | page.getByRole('progressbar', { name: 'Observations classifiées: 100%' }) > 426 | ).toBeVisible(); | ^ 427 | await expect( 428 | page.getByRole('progressbar', { name: 'Classifications confirmées: 75%' }) 429 | ).toBeVisible(); at /__w/cigale/cigale/tests/classification.spec.ts:426:5
await expect(
page.getByRole('progressbar', { name: 'Classifications confirmées: 75%' })
).toBeVisible();
Expand Down Expand Up @@ -537,7 +537,7 @@
}

test.beforeEach(async ({ page, app }) => {
await app.settings.set({ showTechnicalMetadata: false });
await app.settings.set({ debugMode: false });
await chooseFirstSession(page);
await setInferenceModels(page, {
classify: 'Aucune inférence',
Expand Down
6 changes: 3 additions & 3 deletions tests/core.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { readFile } from 'node:fs/promises';
import * as path from 'node:path';
import type { FixturePaths } from './filepaths.js';
Expand Down Expand Up @@ -25,7 +25,7 @@
import { controlOrMeta } from './utils/keyboard.js';

test('basic functionality', async ({ page, app }) => {
await app.settings.set({ showTechnicalMetadata: false });
await app.settings.set({ debugMode: false });
await newSession(page);
await app.tabs.go('import');

Expand Down Expand Up @@ -146,7 +146,7 @@
test.setTimeout(3 * timeouts.finish);

await app.settings.set({
showTechnicalMetadata: false,
debugMode: false,
});
await newSession(page);
await app.tabs.go('import');
Expand Down Expand Up @@ -181,7 +181,7 @@
});

test('can import a protocol via /protocols/import/url', async ({ page, app, context }) => {
await app.settings.set({ showTechnicalMetadata: false });
await app.settings.set({ debugMode: false });
const protocolUrl = 'https://example.com/kitchensink.yaml';
await mockProtocolSourceURL(page, context, protocolUrl, {
body: await readFile(
Expand Down
4 changes: 2 additions & 2 deletions tests/cropper.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@

test.describe('autoskip enabled', () => {
test.beforeEach(async ({ app }) => {
await app.settings.set({ cropAutoNext: true, showTechnicalMetadata: true });
await app.settings.set({ cropAutoNext: true, debugMode: true });
});

test('should skip on confirm button click', async ({ page, app }) => {
Expand Down Expand Up @@ -341,7 +341,7 @@
});

test('dragging outside the crop surface cancels', issue(431), async ({ page, app }) => {
await app.settings.set({ showTechnicalMetadata: true });
await app.settings.set({ debugMode: true });
await makeBox(page, 10, 10, 50, -30);
await assert(page.locator('.change-area .debug')).toHaveText(
/create {2}\(0 0\) × \[0 0\]/
Expand Down Expand Up @@ -640,7 +640,7 @@
* @param {number} [tolerance=0.1] relative tolerance for pixel count differences for the width and height, relative to the expected width and height (between 0 and 1). Mainly used to account for discrepancies between browser engines.
*/
async function expectBoxInList(page, number, width, height, tolerance = 0.1) {
await assert(page.locator('aside').getByText(`Boîte #${number}`)).toBeVisible();

Check failure on line 643 in tests/cropper.spec.js

View workflow job for this annotation

GitHub Actions / E2E / Test (shard 5 of 16)

[chromium] › tests/cropper.spec.js:308:4 › Cropper view › creating a new bounding box › with click-and-drag tool › should create boxes on mouseup

1) [chromium] › tests/cropper.spec.js:308:4 › Cropper view › creating a new bounding box › with click-and-drag tool › should create boxes on mouseup Error: expect(locator).toBeVisible() failed Locator: locator('aside').getByText('Boîte #3') Expected: visible Timeout: 5000ms Error: element(s) not found Call log: - Expect "toBeVisible" with timeout 5000ms - waiting for locator('aside').getByText('Boîte #3') 641 | */ 642 | async function expectBoxInList(page, number, width, height, tolerance = 0.1) { > 643 | await assert(page.locator('aside').getByText(`Boîte #${number}`)).toBeVisible(); | ^ 644 | 645 | const box = page 646 | .locator('aside') at expectBoxInList (/__w/cigale/cigale/tests/cropper.spec.js:643:68) at /__w/cigale/cigale/tests/cropper.spec.js:315:11

Check failure on line 643 in tests/cropper.spec.js

View workflow job for this annotation

GitHub Actions / E2E / Test (shard 5 of 16)

[chromium] › tests/cropper.spec.js:308:4 › Cropper view › creating a new bounding box › with click-and-drag tool › should create boxes on mouseup

1) [chromium] › tests/cropper.spec.js:308:4 › Cropper view › creating a new bounding box › with click-and-drag tool › should create boxes on mouseup Error: expect(locator).toBeVisible() failed Locator: locator('aside').getByText('Boîte #3') Expected: visible Timeout: 5000ms Error: element(s) not found Call log: - Expect "toBeVisible" with timeout 5000ms - waiting for locator('aside').getByText('Boîte #3') 641 | */ 642 | async function expectBoxInList(page, number, width, height, tolerance = 0.1) { > 643 | await assert(page.locator('aside').getByText(`Boîte #${number}`)).toBeVisible(); | ^ 644 | 645 | const box = page 646 | .locator('aside') at expectBoxInList (/__w/cigale/cigale/tests/cropper.spec.js:643:68) at /__w/cigale/cigale/tests/cropper.spec.js:315:11

const box = page
.locator('aside')
Expand All @@ -660,7 +660,7 @@
)
.map(Number);

assert(Math.abs((width - actualWidth) / actualWidth)).toBeLessThan(tolerance);

Check failure on line 663 in tests/cropper.spec.js

View workflow job for this annotation

GitHub Actions / E2E / Test (shard 6 of 16)

[chromium] › tests/cropper.spec.js:449:4 › Cropper view › creating a new bounding box › with 4-point tool › should create boxes every 4 clicks

1) [chromium] › tests/cropper.spec.js:449:4 › Cropper view › creating a new bounding box › with 4-point tool › should create boxes every 4 clicks Error: expect(received).toBeLessThan(expected) Expected: < 0.1 Received: 0.2217687074829932 661 | .map(Number); 662 | > 663 | assert(Math.abs((width - actualWidth) / actualWidth)).toBeLessThan(tolerance); | ^ 664 | assert(Math.abs((height - actualHeight) / actualHeight)).toBeLessThan(tolerance); 665 | } 666 | at expectBoxInList (/__w/cigale/cigale/tests/cropper.spec.js:663:56) at /__w/cigale/cigale/tests/cropper.spec.js:455:5
assert(Math.abs((height - actualHeight) / actualHeight)).toBeLessThan(tolerance);
}

Expand Down
8 changes: 4 additions & 4 deletions tests/export.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {

test('correctly applies crop padding', issue(463), async ({ page, app }) => {
// Disable inference to go faster
await app.settings.set({ showTechnicalMetadata: false });
await app.settings.set({ debugMode: false });
await newSession(page, {
models: {
crop: 'Aucune inférence',
Expand All @@ -44,9 +44,9 @@ test('correctly applies crop padding', issue(463), async ({ page, app }) => {
await page.getByRole('button', { name: 'Retour' }).click();

// XXX: turn on debug mode so that the tab is not disabled
await app.settings.set({ showTechnicalMetadata: true });
await app.settings.set({ debugMode: true });
await app.tabs.go('results');
await app.settings.set({ showTechnicalMetadata: false });
await app.settings.set({ debugMode: false });

const zip = await exportResults(page, { cropPadding: '40px' });
await expectZipFiles(zip, ['analysis.json', 'metadata.csv', 'Cropped/(Unknown)_obs1_1.png'], {
Expand All @@ -57,7 +57,7 @@ test('correctly applies crop padding', issue(463), async ({ page, app }) => {
});

testBasic('correctly shows .zip preview', async ({ page, app }) => {
await app.settings.set({ showTechnicalMetadata: false });
await app.settings.set({ debugMode: false });
await chooseFirstSession(page);

await app.tabs.go('results');
Expand Down
2 changes: 1 addition & 1 deletion tests/gallery.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ testBasic(
'deleting an observation does not delete ImageFiles that appear in other observations',
issue(1744),
async ({ page, app }) => {
await app.settings.set({ showTechnicalMetadata: true });
await app.settings.set({ debugMode: true });
await setInferenceModels(page, {
crop: 'Aucune inférence',
classify: 'Aucune inférence',
Expand Down
2 changes: 1 addition & 1 deletion tests/neural.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test(
'honors infer.neural.output.select for enum metadata',
pr(1751),
async ({ page, app, onnxmodels }) => {
await app.settings.set({ showTechnicalMetadata: true });
await app.settings.set({ debugMode: true });
await app.tabs.go('protocols');
await importProtocol(page, {
id: 'testing',
Expand Down
4 changes: 2 additions & 2 deletions tests/protocols.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ test('can use a protocol that imports metadata from another protocol', async ({

await goToSessionPage(page);

await app.settings.set({ showTechnicalMetadata: false });
await app.settings.set({ debugMode: false });

await expect(page.getByTestId('session-metadata')).toMatchAriaSnapshot(`
- text: Imported session metadata
Expand Down Expand Up @@ -492,7 +492,7 @@ test('can use a protocol that imports metadata from another protocol', async ({
test('can infer metadata from a sidecar file', async ({ page, context, app, tempfiles }) => {
await goToProtocolManagement(page);

await app.settings.set({ showTechnicalMetadata: false });
await app.settings.set({ debugMode: false });

const locationDisplayName =
'Околтын, Akaltyn, Oltinsoy District, Province de Sourkhan-Daria, Ouzbékistan';
Expand Down
2 changes: 1 addition & 1 deletion tests/real-protocols.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ test('Entomoscope @real-protocol', async ({ app, page, browserName }) => {
test.fixme(browserName === 'webkit', 'Flaky test on WebKit');
test.setTimeout(ms('5m'));

await app.settings.set({ showTechnicalMetadata: false });
await app.settings.set({ debugMode: false });
await goToProtocolManagement(page);
await importProtocol(page, 'protocols/entomoscope.cigaleprotocol.yaml', (p) => {
p.exports = {
Expand Down
10 changes: 5 additions & 5 deletions tests/sessions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ test.describe('isolation', () => {
});

test('import into new session', async ({ page, app }) => {
await app.settings.set({ showTechnicalMetadata: false });
await app.settings.set({ debugMode: false });
const picker = page.waitForEvent('filechooser');
await page.getByRole('button', { name: 'Importer .zip' }).click();
await picker.then((picker) => {
Expand Down Expand Up @@ -289,7 +289,7 @@ test('changing session info saves in the database', async ({ page, app }) => {
});

test('can change protocol of session', async ({ page, app }) => {
await app.settings.set({ showTechnicalMetadata: false });
await app.settings.set({ debugMode: false });
await goToProtocolManagement(page);
await importProtocol(page, 'examples/kitchensink.cigaleprotocol.yaml');
await newSession(page, { name: 'Test' });
Expand Down Expand Up @@ -400,7 +400,7 @@ test('can change protocol of session', async ({ page, app }) => {
testKitchensink('session metadata form has default values @no-builtins', async ({ page, app }) => {
// test.skip(browserName === 'webkit', 'Does not work on Webkit for some reason');

await app.settings.set({ showTechnicalMetadata: false });
await app.settings.set({ debugMode: false });
await newSession(page, { name: 'Test', goto: '', protocol: 'Kitchen sink' });

const session = await app.db.session.byName('Test');
Expand Down Expand Up @@ -443,7 +443,7 @@ testKitchensink('session metadata form has default values @no-builtins', async (
});

testKitchensink('can set file-type metadata @no-builtins', async ({ page, app }) => {
await app.settings.set({ showTechnicalMetadata: false });
await app.settings.set({ debugMode: false });
await newSession(page, { name: 'Test', protocol: 'Kitchen sink' });
await goToSessionPage(page);

Expand Down Expand Up @@ -532,7 +532,7 @@ testKitchensink('can set file-type metadata @no-builtins', async ({ page, app })
});

testKitchensink('can convert between units', async ({ page, app }) => {
await app.settings.set({ showTechnicalMetadata: false });
await app.settings.set({ debugMode: false });
await page.getByRole('button', { name: 'Gérer', exact: true }).click();
await app.path.wait('/(app)/sessions/[id]');
const section = app.metadata.section('Has no default');
Expand Down
4 changes: 2 additions & 2 deletions tests/sidepanel.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
* @param {"example" | "kitchensink"} [param0.protocol]
*/
async function initialize({ page, app, protocol = 'example' }) {
await app.settings.set({ showTechnicalMetadata: false });
await app.settings.set({ debugMode: false });
await chooseFirstSession(page);
if (protocol === 'kitchensink') await changeSessionProtocol(page, 'Kitchen sink');
if (protocol !== 'kitchensink')
Expand Down Expand Up @@ -500,7 +500,7 @@ testKitchensink('can update a string-type metadata', async ({ page, app }) => {
});

test('displays metadata groups', async ({ page, app }) => {
await app.settings.set({ showTechnicalMetadata: false });
await app.settings.set({ debugMode: false });
await goToProtocolManagement(page);
await importProtocol(page, {
id: 'com.example.metadatagroups',
Expand Down
2 changes: 1 addition & 1 deletion tests/tasks/readme.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ test.describe('screenshots', { tag: '@real-protocol' }, () => {

await page.setViewportSize({ width: (16 / 9) * 720, height: 720 });

await app.settings.set({ showTechnicalMetadata: false });
await app.settings.set({ debugMode: false });

await chooseInDropdown(
page,
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/results.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export async function importResults(page, filepath, { waitForLoading = true } =
page,
},
{
showTechnicalMetadata: false,
debugMode: false,
}
);

Expand Down
Loading