I've got an issue with using 'visit' - cypress

When my Cypress tests are run on Github (headless).
When I call visit('/page') - get a 404 error. The page definitely exists.
CypressError: 'cy.visit()' failed trying to load:
http://localhost:4200/page
I can run the same tests locally (headless and headed) and they work fine.
Anyone have any ideas why this could be?
I should add that this is an Angular Application and there are no 404's because all routes are handled with wildcard. I know this page exists and happens if i try to visit another page that exists.
Version:
"cypress": "^10.6.0",
This is the .yml file. The baseUrl is set to 'http://localhost:4200' in the 'integration.config.ts' file.

So found the answer.
We are serving the Angular application with 'http-server'. It was only recognising the route '/' and was returning a 404 for any other app routes / pages.
We fixed this by adding --proxy http://localhost:4200? to the http-server command.

Related

404 on assets when using Laravel Vite + Sail

I wanted to try out Sail on my Windows machine, however, after installing Breeze on a brand new installation of Laravel and running sail npm run dev I received a 404 in the browser for http://localhost/css/app.css and http://localhost/js/app.js when navigating to http://localhost/login on my Windows host.
Laravel Vite Plugin Version: v0.6.0
Laravel Version: v9.19
Node Version: v16.18.0
NPM Version: v8.19.2
Host operating system: Windows
Web Browser & Version: Firefox 106.0.2 (64-bit)
I am able to navigate to http://localhost:5173/ in the browser which displays the informative message, so we know that it is working. When using inspect element on the /login page the following URLs are returned as a 404: http://localhost/css/app.css & http://localhost/js/app.js.
In previous attempts I did try adding the following snippet to my vite.config.js file, however, it made no difference and the problem persisted.
server: {
hmr: {
host: 'localhost',
},
},
This is a fresh install of Docker, WSL2 and Laravel with Breeze so in theory, it should all be working, but clearly, something is awry.
The result is seeing this: https://i.imgur.com/FUZsIYh.png
If anybody could point me in the right direction I would really appreciate it!

Laravel Vue.js components are not working on server

I am new to Laravel Vue and I recently came to a project. at my localhost everything working fine, but when I pushed my project to the server via git, the Vue components not working. it says this error in the console...
Uncaught SyntaxError: Unexpected token '<' app.js:1
there is no npm install on the server so I run the command locally "npm run production" and pushed the app.js and all other js files via git to the server.. the server files are the same as localhost but Vue components not working on the server, but they are running on localhost..., I am stuck to the problem with 3 days, any help will be highly appreciated.
Thanks
Just for clarity, the CSS file is rendering but the JS file not
In my console:
Resource interpreted as Stylesheet but transferred with MIME type text/html: /rider/auth/public/css/app.css.
Uncaught SyntaxError: Unexpected token '<' app.js:1
So the issue was in the .env file , and there was a variable "ASSET_URL = ./public" , this was not allowing the application to go to the correct path . Thanks #Aless55 for your great support

The photo failed to upload. Laravel Jetstream

Getting a 401 (Unauthorized) on the dashboard while trying to upload a profile picture. App URL is set properly and the feature is uncommented. the console which shows a post request to site.com/livewire/upload-file is showing unauthorized and the response is empty. screenshot
Check your tmp directory.
In php.ini, this is this line : sys_temp_dir = .....
In the code with : sys_get_temp_dir()
Verify if the directory exist
If we're talking about developer mode then it has to do with your URL. Start up the artisan server (within your project directory in your console/terminal write: "php artisan serve") and then go to http://127.0.0.1:8000/. You'll be able to upload the photo in a jiffy.

Laravel route works with internal webserver but not with WAMP

I defined the following route in /app/Http/routes.php:
Route::get('products', function () {
return App\Product::all();
});
My Laravel Installation sits in C:\wamp\www\product-service\
When running WAMP, Laravels Welcome Page will be displayed (URL: http://localhost/product-service/public/)
However, the URL http://localhost/product-service/public/products won't work, Error Message "Not Found. The requested URL /product-service/public/product was not found on this server".
Now, when I start the internal test server
php artisan serve --host=127.0.0.1
The URL http://localhost:8000/products will work fine.
Why is that?
First of all, check if you've the proper .htaccess in your public folder. If the file is present, maybe your WAMP environment has the mod_rewrite module disabled. Check the apache conf file in:
{wamp_dir}/apache/conf/httpd.conf
check for this line:
#LoadModule rewrite_module modules/mod_rewrite.so
remove the # at the beginning. Check then for the AllowedOverride param and change No to All. Restart your apache server and give it a try. Last but no least, check the Laravel docs here for another htaccess file that can be useful to you

Play 2x webjars deploy to heroku failed

I tried deploying the standard angular-play-seed project, which uses angularjs and requirejs webjars to heroku.
However, on heroku it throws an error because it cannot find require.js
Failed to load resource: the server responded with a status of 404 (Not Found)
Trying to fetch requirejs from the URL
/lib/requirejs/require.js
Update:
Thanks for the suggestion James, yes I am able to recreate this locally in activator clean start.
I'm pretty sure some configuration in my sbt-rjs is messed up but I don't know what.
This is what my folder structure looks like
public
/ui
/js
/myApp
/controllers.js
/services.js
/main.js
/paritals
/myApp
/partial1.html
I see this error both during activator start and sbt stage.
[info] Error: Error: /home/sajit/angular-play-seed/target/web/rjs/appdir/./main.js does not exist.
The scala.html page which launches the angular app, myApp has this
<script data-main="#routes.Assets.versioned("ui/js/myApp/main.js")" src="#routes.Assets.versioned("lib/requirejs/require.js")"></script>
What am I doing wrong?
Based on the sbt-rjs docs it looks like you need to set the appDir in your build.sbt, like:
appDir := "ui/js/myApp"

Resources