Ragura
Ragura
NNuxt
Created by Ragura on 12/8/2024 in #❓・help
404 errors during playwright navigation due to missing server redirect?
When I run my playwright tests on my SPA Nuxt application, I keep getting the message: Failed to load resource: the server responded with a status of 404 (Not Found) This happens when navigating to a page in the app using Playwright, like localhost:3000/mypage. Note however that the test and the navigation do succeed, but the error is always printed nonetheless. I assume this has something to do with the server serving the assets? Obviously there is no real mypage.html, so the 404 would be warranted, but usually servers are setup to reroute to the root for an SPA. Is there a setting I can change to remove this error from the tests (that doesn't include just hiding it by hacking the console.log 😛)
7 replies
NNuxt
Created by Ragura on 7/6/2024 in #❓・help
Can we prevent Playwright tests from running a build for each test?
After some trial and error I finally got Playwright to correctly run all tests. I'm happy with the state of testing, but I was wondering if it's possible to reuse builds of my SPA across tests instead of having to build the same application at the start of each test which greatly increases the total test running time. Is it not be possible to build once and serve multiple instances of the application on different ports for the tests to use?
1 replies
NNuxt
Created by Ragura on 6/15/2024 in #❓・help
Vitest auto-import functions
Is there a way to correctly auto-import functions from Vitest, like it and expect while preserving their function types and not have them show as any? I got this far using the config, which generates the imports in the imports.d.ts file, but they still show up as any in the test files.
imports: {
imports: [
{
name: 'it, expect, describe, beforeEach, afterEach',
from: 'vitest',
},
],
},
imports: {
imports: [
{
name: 'it, expect, describe, beforeEach, afterEach',
from: 'vitest',
},
],
},
6 replies