Skip to content

A continuation of HomeBox the inventory and organization system built for the Home User

fix issues with actions (#680)

Tonya9855474555f8
diff --git a/frontend/layouts/default.vue b/frontend/layouts/default.vue
index c9b2c937..45d675f2 100644
--- a/frontend/layouts/default.vue
+++ b/frontend/layouts/default.vue
@@ -77,6 +77,7 @@
<SidebarMenuButton
class="flex justify-center group-data-[collapsible=icon]:justify-start group-data-[collapsible=icon]:bg-destructive group-data-[collapsible=icon]:text-destructive-foreground group-data-[collapsible=icon]:shadow-sm group-data-[collapsible=icon]:hover:bg-destructive/90"
:tooltip="$t('global.sign_out')"
+ data-testid="logout-button"
@click="logout"
>
<MdiLogout />
diff --git a/frontend/lib/api/classes/items.ts b/frontend/lib/api/classes/items.ts
index 0778b04f..a649b288 100644
--- a/frontend/lib/api/classes/items.ts
+++ b/frontend/lib/api/classes/items.ts
@@ -32,14 +32,16 @@ export type ItemsQuery = {
};
export class AttachmentsAPI extends BaseAPI {
- add(id: string, file: File | Blob, filename: string, type: AttachmentTypes | null = null, primary: boolean = false) {
+ add(id: string, file: File | Blob, filename: string, type: AttachmentTypes | null = null, primary?: boolean) {
const formData = new FormData();
formData.append("file", file);
if (type) {
formData.append("type", type);
}
formData.append("name", filename);
- formData.append("primary", primary.toString());
+ if (primary !== undefined) {
+ formData.append("primary", primary.toString());
+ }
return this.http.post<FormData, ItemOut>({
url: route(`/items/${id}/attachments`),
diff --git a/frontend/package.json b/frontend/package.json
index 62513448..7311c1d2 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -20,6 +20,7 @@
"@nuxtjs/eslint-config-typescript": "^12.1.0",
"@playwright/test": "^1.52.0",
"@types/markdown-it": "^13.0.9",
+ "@types/semver": "^7.7.0",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"@vite-pwa/nuxt": "^0.5.0",
@@ -49,7 +50,6 @@
"@tailwindcss/aspect-ratio": "^0.4.2",
"@tailwindcss/forms": "^0.5.10",
"@tailwindcss/typography": "^0.5.16",
- "@types/lunr": "^2.3.7",
"@vuepic/vue-datepicker": "^8.8.1",
"@vueuse/core": "^12.8.2",
"@vueuse/nuxt": "^10.11.1",
@@ -64,7 +64,6 @@
"h3": "^1.15.1",
"http-proxy": "^1.18.1",
"lucide-vue-next": "^0.474.0",
- "lunr": "^2.3.9",
"markdown-it": "^14.1.0",
"pinia": "^2.3.1",
"postcss": "^8.5.3",
@@ -74,6 +73,7 @@
"tailwindcss": "^3.4.17",
"tailwindcss-animate": "^1.0.7",
"vaul-vue": "^0.4.1",
+ "vite": "^6.3.5",
"vue": "3.4.8",
"vue-router": "^4.5.0",
"vue-sonner": "^1.3.2"
diff --git a/frontend/pages/index.vue b/frontend/pages/index.vue
index b15d7330..86d7c6e1 100644
--- a/frontend/pages/index.vue
+++ b/frontend/pages/index.vue
@@ -98,7 +98,11 @@
});
if (error) {
- toast.error("Problem registering user");
+ toast.error("Problem registering user", {
+ classes: {
+ title: "login-error",
+ },
+ });
return;
}
@@ -123,7 +127,11 @@
const { error } = await ctx.login(api, email.value, loginPassword.value, remember.value);
if (error) {
- toast.error("Invalid email or password");
+ toast.error("Invalid email or password", {
+ classes: {
+ title: "login-error",
+ },
+ });
loading.value = false;
return;
}
@@ -218,19 +226,20 @@
</CardTitle>
</CardHeader>
<CardContent class="flex flex-col gap-2">
- <FormTextField v-model="email" :label="$t('index.set_email')" />
- <FormTextField v-model="username" :label="$t('index.set_name')" />
+ <FormTextField v-model="email" :label="$t('index.set_email')" data-testid="email-input" />
+ <FormTextField v-model="username" :label="$t('index.set_name')" data-testid="name-input" />
<div v-if="!(groupToken == '')" class="pb-1 pt-4 text-center">
<p>{{ $t("index.joining_group") }}</p>
<button type="button" class="text-xs underline" @click="groupToken = ''">
{{ $t("index.dont_join_group") }}
</button>
</div>
- <FormPassword v-model="password" :label="$t('index.set_password')" />
+ <FormPassword v-model="password" :label="$t('index.set_password')" data-testid="password-input" />
<PasswordScore v-model:valid="canRegister" :password="password" />
</CardContent>
<CardFooter>
<Button
+ data-testid="confirm-register-button"
class="w-full"
type="submit"
:class="loading ? 'loading' : ''"
@@ -274,7 +283,13 @@
</form>
</Transition>
<div class="mt-6 text-center">
- <Button v-if="status && status.allowRegistration" class="group" variant="link" @click="() => toggleLogin()">
+ <Button
+ v-if="status && status.allowRegistration"
+ class="group"
+ variant="link"
+ data-testid="register-button"
+ @click="() => toggleLogin()"
+ >
<div class="relative mx-2">
<div
class="absolute inset-0 flex items-center justify-center transition-transform duration-300 group-hover:rotate-[360deg]"
diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml
index 8a5a1606..46343396 100644
--- a/frontend/pnpm-lock.yaml
+++ b/frontend/pnpm-lock.yaml
@@ -26,9 +26,6 @@ importers:
'@tailwindcss/typography':
specifier: ^0.5.16
version: 0.5.16([email protected])
- '@types/lunr':
- specifier: ^2.3.7
- version: 2.3.7
'@vuepic/vue-datepicker':
specifier: ^8.8.1
@@ -37,7 +34,7 @@ importers:
version: 12.8.2([email protected])
'@vueuse/nuxt':
specifier: ^10.11.1
'@vueuse/router':
specifier: ^10.11.1
@@ -71,9 +68,6 @@ importers:
lucide-vue-next:
specifier: ^0.474.0
- lunr:
- specifier: ^2.3.9
- version: 2.3.9
markdown-it:
specifier: ^14.1.0
version: 14.1.0
@@ -101,6 +95,9 @@ importers:
vaul-vue:
specifier: ^0.4.1
+ vite:
+ specifier: ^6.3.5
vue:
specifier: 3.4.8
version: 3.4.8([email protected])
@@ -129,6 +126,9 @@ importers:
'@types/markdown-it':
specifier: ^13.0.9
version: 13.0.9
+ '@types/semver':
+ specifier: ^7.7.0
+ version: 7.7.0
'@typescript-eslint/eslint-plugin':
specifier: ^6.21.0
@@ -137,7 +137,7 @@ importers:
'@vite-pwa/nuxt':
specifier: ^0.5.0
'@vue/runtime-core':
specifier: ^3.5.13
version: 3.5.13
@@ -164,7 +164,7 @@ importers:
version: 3.0.0
nuxt:
specifier: 3.12.4
prettier:
specifier: ^3.5.3
version: 3.5.3
@@ -179,7 +179,7 @@ importers:
version: 0.18.5(@vue/[email protected])
vite-plugin-eslint:
specifier: ^1.8.1
vitest:
specifier: ^1.6.1
version: 1.6.1(@types/[email protected])([email protected])
@@ -2054,9 +2054,6 @@ packages:
resolution: {integrity: sha512-yg6E+u0/+Zjva+buc3EIb+29XEg4wltq7cSmd4Uc2EE/1nUVmxyzpX6gUXD0V8jIrG0r7YeOGVIbYRkxeooCtw==}
- '@types/[email protected]':
- resolution: {integrity: sha512-Tb/kUm38e8gmjahQzdCKhbdsvQ9/ppzHFfsJ0dMs3ckqQsRj+P5IkSAwFTBrBxdyr3E/LoMUUrZngjDYAjiE3A==}
-
resolution: {integrity: sha512-1XPwR0+MgXLWfTn9gCsZ55AHOKW1WN+P9vr0PaQh5aerR9LLQXUbjfEAFhjmEmyoYFWAyuN2Mqkn40MZ4ukjBw==}
@@ -4570,9 +4567,6 @@ packages:
peerDependencies:
vue: '>=3.0.1'
- resolution: {integrity: sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==}
-
resolution: {integrity: sha512-tJLxrKJhO2ukZ5z0gyjY1zPh3Rh88Ej9P7jNrZiHMUXHae1yvI2imgOZtL1TO8TW6biMMKfTtAOoEJANgtWBMQ==}
engines: {node: '>=12'}
@@ -6066,6 +6060,10 @@ packages:
resolution: {integrity: sha512-qkf4trmKSIiMTs/E63cxH+ojC2unam7rJ0WrauAzpT3ECNTxGRMlaXxVbfxMUC/w0LaYk6jQ4y/nGR9uBO3tww==}
engines: {node: '>=12.0.0'}
+ resolution: {integrity: sha512-mEwzpUgrLySlveBwEVDMKk5B57bhLPYovRfPAXD5gA/98Opn0rCDj3GtLwFvCvH5RK9uPCExUROW5NjDwvqkxw==}
+ engines: {node: '>=12.0.0'}
+
resolution: {integrity: sha512-i11VH5gS6IFeLY3gMBQ00/MmLncVP7JLXOw1vlgkytLmJK7QnEr7NXf0LBdxfmNPAeyetukOk0bOYrJrFGjYJQ==}
engines: {node: '>=14.0.0'}
@@ -6554,6 +6552,46 @@ packages:
terser:
optional: true
+ resolution: {integrity: sha512-cZn6NDFE7wdTpINgs++ZJ4N49W2vRp8LCKrn3Ob1kYNtOo21vfDoaV5GzBfLU4MovSAB8uNRm4jgzVQZ+mBzPQ==}
+ engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0}
+ hasBin: true
+ peerDependencies:
+ '@types/node': ^18.0.0 || ^20.0.0 || >=22.0.0
+ jiti: '>=1.21.0'
+ less: '*'
+ lightningcss: ^1.21.0
+ sass: '*'
+ sass-embedded: '*'
+ stylus: '*'
+ sugarss: '*'
+ terser: ^5.16.0
+ tsx: ^4.8.1
+ yaml: ^2.4.2
+ peerDependenciesMeta:
+ '@types/node':
+ optional: true
+ jiti:
+ optional: true
+ less:
+ optional: true
+ lightningcss:
+ optional: true
+ sass:
+ optional: true
+ sass-embedded:
+ optional: true
+ stylus:
+ optional: true
+ sugarss:
+ optional: true
+ terser:
+ optional: true
+ tsx:
+ optional: true
+ yaml:
+ optional: true
+
resolution: {integrity: sha512-Ljb1cnSJSivGN0LqXd/zmDbWEM0RNNg2t1QW/XUhYl/qPqyu7CsqeWtqQXHVaJsecLPuDoak2oJcZN2QoRIOag==}
engines: {node: ^18.0.0 || >=20.0.0}
@@ -8278,12 +8316,12 @@ snapshots:
'@nuxt/[email protected]': {}
dependencies:
'@nuxt/kit': 3.16.2([email protected])
'@nuxt/schema': 3.16.2
execa: 7.2.0
- vite: 5.4.18(@types/[email protected])([email protected])
transitivePeerDependencies:
- magicast
@@ -8300,13 +8338,13 @@ snapshots:
rc9: 2.1.2
semver: 7.7.1
dependencies:
'@antfu/utils': 0.7.10
'@nuxt/devtools-wizard': 1.7.0
'@nuxt/kit': 3.16.2([email protected])
'@vue/devtools-kit': 7.6.8
birpc: 0.2.19
consola: 3.4.2
@@ -8335,9 +8373,9 @@ snapshots:
sirv: 3.0.1
tinyglobby: 0.2.12
unimport: 3.14.6([email protected])
- vite: 5.4.18(@types/[email protected])([email protected])
- vite-plugin-vue-inspector: 5.3.1([email protected](@types/[email protected])([email protected]))
which: 3.0.1
ws: 8.18.1
transitivePeerDependencies:
@@ -8913,8 +8951,6 @@ snapshots:
'@types/[email protected]': {}
- '@types/[email protected]': {}
-
dependencies:
'@types/linkify-it': 3.0.5
@@ -9173,12 +9209,12 @@ snapshots:
- rollup
- supports-color
dependencies:
'@nuxt/kit': 3.16.2([email protected])
pathe: 1.1.2
ufo: 1.6.1
transitivePeerDependencies:
- '@vite-pwa/assets-generator'
- magicast
@@ -9350,14 +9386,14 @@ snapshots:
'@vue/[email protected]': {}
dependencies:
'@vue/devtools-kit': 7.6.8
'@vue/devtools-shared': 7.7.5
mitt: 3.0.1
nanoid: 5.1.5
pathe: 1.1.2
- vite-hot-client: 0.2.4([email protected](@types/[email protected])([email protected]))
vue: 3.5.13([email protected])
transitivePeerDependencies:
- vite
@@ -9464,13 +9500,13 @@ snapshots:
'@vueuse/[email protected]': {}
dependencies:
'@nuxt/kit': 3.16.2([email protected])
'@vueuse/core': 10.11.1([email protected]([email protected]))
'@vueuse/metadata': 10.11.1
local-pkg: 0.5.1
transitivePeerDependencies:
- '@vue/composition-api'
@@ -11859,8 +11895,6 @@ snapshots:
dependencies:
vue: 3.4.8([email protected])
-
@@ -12205,10 +12239,10 @@ snapshots:
dependencies:
'@nuxt/devalue': 2.0.2
'@nuxt/kit': 3.12.4([email protected])([email protected])
'@nuxt/schema': 3.12.4([email protected])
'@nuxt/telemetry': 2.6.6([email protected])
@@ -13626,6 +13660,11 @@ snapshots:
fdir: 6.4.4([email protected])
picomatch: 4.0.2
+ dependencies:
+ fdir: 6.4.4([email protected])
+ picomatch: 4.0.2
+
@@ -14030,9 +14069,9 @@ snapshots:
transitivePeerDependencies:
- '@vue/composition-api'
dependencies:
- vite: 5.4.18(@types/[email protected])([email protected])
dependencies:
@@ -14093,15 +14132,15 @@ snapshots:
typescript: 5.6.2
vue-tsc: 2.1.6([email protected])
dependencies:
'@rollup/pluginutils': 4.2.1
'@types/eslint': 8.56.12
eslint: 8.57.1
rollup: 2.79.2
- vite: 5.4.18(@types/[email protected])([email protected])
dependencies:
'@antfu/utils': 0.7.10
'@rollup/pluginutils': 5.1.4([email protected])
@@ -14112,25 +14151,25 @@ snapshots:
perfect-debounce: 1.0.0
picocolors: 1.1.1
sirv: 3.0.1
- vite: 5.4.18(@types/[email protected])([email protected])
optionalDependencies:
'@nuxt/kit': 3.16.2([email protected])
transitivePeerDependencies:
- rollup
- supports-color
dependencies:
debug: 4.4.0
pretty-bytes: 6.1.1
tinyglobby: 0.2.12
- vite: 5.4.18(@types/[email protected])([email protected])
workbox-build: 7.1.1
workbox-window: 7.1.0
transitivePeerDependencies:
- supports-color
dependencies:
'@babel/core': 7.26.10
'@babel/plugin-proposal-decorators': 7.25.9(@babel/[email protected])
@@ -14141,7 +14180,7 @@ snapshots:
'@vue/compiler-dom': 3.5.13
kolorist: 1.8.0
magic-string: 0.30.17
- vite: 5.4.18(@types/[email protected])([email protected])
transitivePeerDependencies:
- supports-color
@@ -14155,6 +14194,21 @@ snapshots:
fsevents: 2.3.3
terser: 5.39.0
+ dependencies:
+ esbuild: 0.25.2
+ fdir: 6.4.4([email protected])
+ picomatch: 4.0.2
+ postcss: 8.5.3
+ rollup: 4.40.0
+ tinyglobby: 0.2.13
+ optionalDependencies:
+ '@types/node': 22.14.1
+ fsevents: 2.3.3
+ jiti: 2.4.2
+ terser: 5.39.0
+ yaml: 2.7.1
+
dependencies:
'@vitest/expect': 1.6.1
diff --git a/frontend/tailwind.config.js b/frontend/tailwind.config.js
index 4d4e08a4..cfa4bad9 100644
--- a/frontend/tailwind.config.js
+++ b/frontend/tailwind.config.js
@@ -1,6 +1,3 @@
-import { config } from "dotenv";
-config();
-
/** @type {import('tailwindcss').Config} */
module.exports = {
darkMode: ["class"],
diff --git a/frontend/test/e2e/login.browser.spec.ts b/frontend/test/e2e/login.browser.spec.ts
index 9c2d20c9..f4c48575 100644
--- a/frontend/test/e2e/login.browser.spec.ts
+++ b/frontend/test/e2e/login.browser.spec.ts
@@ -4,7 +4,7 @@ test("valid login", async ({ page }) => {
await page.goto("/home");
await expect(page).toHaveURL("/");
await page.fill("input[type='text']", "[email protected]");
- await page.fill("input[placeholder='Password']", "demo");
+ await page.fill("input[type='password']", "demo");
await page.click("button[type='submit']");
await expect(page).toHaveURL("/home");
});
@@ -13,45 +13,37 @@ test("invalid login", async ({ page }) => {
await page.goto("/home");
await expect(page).toHaveURL("/");
await page.fill("input[type='text']", "[email protected]");
- await page.fill("input[placeholder='Password']", "dummy");
+ await page.fill("input[type='password']", "dummy");
await page.click("button[type='submit']");
- await expect(page.locator("div[class*='top-2']")).toHaveText("Invalid email or password");
+ await page.waitForTimeout(500);
+ await expect(page.locator("div[class*='login-error']").first()).toHaveText("Invalid email or password");
await expect(page).toHaveURL("/");
});
test("registration", async ({ page }) => {
test.slow();
- test.fixme();
// Register a new user
await page.goto("/home");
await expect(page).toHaveURL("/");
- await page.click("button[class$='btn-wide']");
- await page.fill(
- "html > body > div:nth-of-type(1) > div > div:nth-of-type(2) > div:nth-of-type(2) > div > div > form > div > div > div:nth-of-type(1) > input",
- );
- await page.fill(
- "html > body > div:nth-of-type(1) > div > div:nth-of-type(2) > div:nth-of-type(2) > div > div > form > div > div > div:nth-of-type(2) > input",
- "Test User"
- );
- await page.fill("input[placeholder='Password']", "ThisIsAStrongDemoPass");
- await page.click("button[class$='mt-2']");
+ await page.getByTestId("register-button").click();
+
+ await page.waitForTimeout(1000);
+
+ await page.getByTestId("email-input").locator("input").fill("[email protected]");
+ await page.getByTestId("name-input").locator("input").fill("Test User");
+ await page.getByTestId("password-input").locator("input").fill("ThisIsAStrongDemoPass");
+ await page.getByTestId("confirm-register-button").click();
await expect(page).toHaveURL("/");
// Try to register the same user again (it should fail)
await page.goto("/home");
await expect(page).toHaveURL("/");
- await page.click("button[class$='btn-wide']");
- await page.fill(
- "html > body > div:nth-of-type(1) > div > div:nth-of-type(2) > div:nth-of-type(2) > div > div > form > div > div > div:nth-of-type(1) > input",
- );
- await page.fill(
- "html > body > div:nth-of-type(1) > div > div:nth-of-type(2) > div:nth-of-type(2) > div > div > form > div > div > div:nth-of-type(2) > input",
- "Test User"
- );
- await page.fill("input[placeholder='Password']", "ThisIsAStrongDemoPass");
- await page.click("button[class$='mt-2']");
+ await page.getByTestId("register-button").click();
+ await page.getByTestId("email-input").locator("input").fill("[email protected]");
+ await page.getByTestId("name-input").locator("input").fill("Test User");
+ await page.getByTestId("password-input").locator("input").fill("ThisIsAStrongDemoPass");
+ await page.getByTestId("confirm-register-button").click();
await expect(page).toHaveURL("/");
- await expect(page.locator("div[class*='top-2']")).toHaveText("Problem registering user");
+ await page.waitForTimeout(500);
+ await expect(page.locator("div[class*='login-error']").first()).toHaveText("Problem registering user");
});