Skip to content

Commit 3e93a04

Browse files
committed
Test fixes
1 parent f95c76c commit 3e93a04

File tree

6 files changed

+16
-25
lines changed

6 files changed

+16
-25
lines changed

src/lib/common/errors.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { error } from '@sveltejs/kit';
22
import StandardErrorAlert from '$lib/components/common/StandardErrorAlert.svelte';
33
import { writable } from 'svelte/store';
4-
import { mount } from "svelte";
4+
import { mount } from 'svelte';
55

66
/**
77
* Propagates an error response.
@@ -208,11 +208,11 @@ export function displayStandardErrorAlert(error, targetElementId) {
208208
const errorAlert = document.getElementById(targetElementId);
209209
if (errorAlert) {
210210
return mount(StandardErrorAlert, {
211-
target: errorAlert,
212-
props: {
213-
error
214-
}
215-
});
211+
target: errorAlert,
212+
props: {
213+
error
214+
}
215+
});
216216
} else {
217217
console.warn(`Unable to display the error: element ${targetElementId} not found`);
218218
}

src/lib/components/common/StandardErrorAlert.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99
1010
/** @type {Props} */
11-
let { error, children } = $props();
11+
let { error, children = undefined } = $props();
1212
1313
const errorData = $derived(getErrorData(error));
1414

tests/settings.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ test('User settings', async ({ page }) => {
3535
await page.getByLabel('SLURM account 1').fill(randomSlurmAccount);
3636
await page.getByLabel('SLURM account 2').fill(randomSlurmAccount);
3737
await page.getByRole('button', { name: 'Save' }).click();
38-
await page.getByText('`slurm_accounts` list has repetitions').waitFor();
38+
await page.getByText('List has repetitions').waitFor();
3939
});
4040

4141
await test.step('Add SLURM account (success)', async () => {

tests/v2/custom_env_task.spec.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ test('Custom Python env task [v2]', async ({ page }) => {
4646

4747
await page.getByRole('button', { name: 'Collect' }).click();
4848

49-
await expect(page.getByText('Python interpreter path must be absolute')).toBeVisible();
49+
await expect(
50+
page.getByText("Value error, String must be an absolute path (given 'foo')")
51+
).toBeVisible();
5052
});
5153

5254
await test.step("Test \"One and only one must be set between 'package_root' and 'package_name'\" error", async () => {

tests/v2/users_crud.spec.js

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,9 @@ test('Create and update a user', async ({ page }) => {
9393
await test.step('Test project dir validation error', async () => {
9494
await page.getByLabel('Project dir').fill('foo');
9595
await page.getByRole('button', { name: 'Save' }).click();
96-
await page.waitForFunction(() => {
97-
const invalidFeeback = document
98-
.querySelector('#projectDir')
99-
?.closest('div')
100-
?.querySelector('.invalid-feedback');
101-
if (invalidFeeback instanceof HTMLElement) {
102-
return invalidFeeback.innerText.includes(
103-
"String attribute 'project_dir' must be an absolute path (given 'foo')"
104-
);
105-
}
106-
return false;
107-
});
96+
await expect(
97+
page.getByText("Value error, String must be an absolute path (given 'foo')")
98+
).toBeVisible();
10899
await page.getByLabel('Project dir').fill('/tmp/test/project-dir');
109100
});
110101

@@ -118,7 +109,7 @@ test('Create and update a user', async ({ page }) => {
118109
.getByRole('textbox', { name: /^SLURM account #2/ })
119110
.fill(randomUserName + '-slurm-account');
120111
await page.getByRole('button', { name: 'Save' }).click();
121-
await page.getByText('`slurm_accounts` list has repetitions').waitFor();
112+
await expect(page.getByText('Value error, List has repetitions')).toBeVisible();
122113
await page.getByLabel('Remove SLURM account').first().click();
123114
});
124115

tests/v2/viewer_paths.spec.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ test('Viewer paths', async ({ page }) => {
5454
await addViewerPathBtn.click();
5555
const saveBtn = page.getByRole('button', { name: 'Save' }).first();
5656
await saveBtn.click();
57-
await expect(
58-
page.getByText("String attribute 'viewer_paths[0]' cannot be empty")
59-
).toBeVisible();
57+
await expect(page.getByText('String should have at least 1 character')).toBeVisible();
6058
await page.getByLabel('Viewer path #1', { exact: true }).fill('/path/to/1');
6159
await page.getByLabel('Viewer path #2', { exact: true }).fill('/path/to/2');
6260
await saveBtn.click();

0 commit comments

Comments
 (0)