Codecept run provides different result on travis than in local - symfony

I am running some codeception tests. They are successful when I launch them locally.
For integration tests, I add them on Travis, but a lot of test failed!
So, I add this command on .travis.yml: cat tests/_output/*
The result explain why tests are failing. Here is the output of a page on travis environment:
<html>
<head>
<meta charset="UTF-8" />
</head>
<body>
[THE FORM]
</body>
</html>
As you can see, my base template is not loaded on travis environment.
Here is a truncate part of the same login page locally generated:
<html lang="en">
<head>
<meta charset="UTF-8" />
<link href="/css/f5f986f_app_1.css" type="text/css" rel="stylesheet" media="screen" />
<link href="/css/f5f986f_bootstrap.min_2.css" type="text/css" rel="stylesheet" media="screen" />
<link href="/css/f5f986f_bootstrap-theme.min_3.css" type="text/css" rel="stylesheet" media="screen" />
<link href="/css/f5f986f_font-awesome.min_4.css" type="text/css" rel="stylesheet" media="screen" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript" src="/js/52ec12c_jquery.min_1.js"></script>
<title>G-Equip • Log in</title>
<link rel="shortcut icon" href="/favicon.ico" /> </head>
<body>
[....]
[THE FORM]
[....]
</body>
</html>
Here is my test:
class AuthCest
{
public function _before(FunctionalTester $I)
{
$I->amOnPage('/login');
//Menu verification
$I->seeInTitle('Log in');
}
}
So, in local the page is well loaded with its template. But on Travis, I don't have my full template, I don't have the title tag! So, this test failed on: $I->seeInTitle('Log in')
Codeception throw this failure:
Fail Tag element with <title> was not found.
Why the views are different on travis environment?
Here is a simplified version of my .travis.yml file:
# Project language
language: php
# Allows use container-based infrastructure
sudo: false
# Start mysql service
services:
- mysql
# Cache composer packages so "composer install" is faster
cache:
directories:
- $HOME/.composer/cache/files
php:
# aliased to a recent 7.1.x version
- 7.1
# Define an environment variable
env:
- SYMFONY_VERSION="3.3.*" DB=mysql
# Update composer
before-install:
- composer self-update
before_script:
- cp app/config/parameters.yml.travis app/config/parameters.yml
- composer install
- mysql -e 'create database symfony;'
- php bin/console doctrine:migrations:migrate --no-interaction
# loading data for phpunit and codeconcept tests
- php bin/console doctrine:fixtures:load --fixtures ./src/AppBundle/DataFixtures -n --env=test
script:
# Server must be started for codeconcept tests.
- php bin/console server:start
- php vendor/bin/codecept run
- php bin/console server:stop
- cat tests/_output/*
Something is certainly misconfigured, do you have an idea?

Related

ERROR: Deploy VueJS App in Firebase Hosting

I have a vue application, I install firebase tools and upload the application to firebase hosting, the first time all done and I make npm run build and firebase deploy, but when I realise any change, and later do npm run serve or build or firebase deploy I have the next error:
Template execution failed: ReferenceError: features is not defined
ReferenceError: features is not defined
- index.html:4 eval
[.]/[html-webpack-plugin]/lib/loader.js!./public/index.html:4:10
- index.html:7 module.exports
[.]/[html-webpack-plugin]/lib/loader.js!./public/index.html:7:3
- index.js:284 Promise.resolve.then
[real]/[html-webpack-plugin]/index.js:284:18
- next_tick.js:188 process._tickCallback
internal/process/next_tick.js:188:7
Any idea? I don't know why this problem succeed. Thank you.
When you installed firebase tools, it generated a public folder for you. Inside that public folder, there is an index.html file(this file is the cause of the error). Just delete everything inside that index.html file, then replace with your own content.
In firebase.json file in hosting change "public": "public" to "public": "dist"
When you installed firebase, it changed the file public/index.html, the original version looks like this:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>hello-world-vuetify</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/#mdi/font#latest/css/materialdesignicons.min.css">
</head>
<body>
<noscript>
<strong>We're sorry but hello-world-vuetify doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
Replace the content, it worked for me

Assetic on Symfony won't work in production Symfony

I uploaded my SF Application from my local (machine) to production (Cpanel server)
everything looks fine on production except the css, js, etc. (All files inside the web directory.
I open the var/logs/prod.log just to check whats happening and I find out these errors.
request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET /stylesheets/base.css" (from "http://example.com/admin/login")" etc.........
Now, what I did is to open the base.html.twig and made changes on the path of css/js files.
From
<link href="{{ asset('stylesheets/base.css') }}" rel="stylesheet" />
To the full directory.
<link href="{{ asset('/home2/swipecom/public_html/web/stylesheets/base.css') }}" rel="stylesheet" />
By the way, here's the directory of the application in the server.
home/swipecom
cache
contactless (Where SF directories live)
- public_html (/web the only SF directory)
var
ssl
tmp
public_ftp
logs
I made it work using this code
<link href="{{ asset('web/stylesheets/base.css') }}" rel="stylesheet" />

Issue loading CSS and JavaScript files in Laravel

I'm having a strange issue in my Laravel 5.2 app. Specifically with loading some CSS and JavaScript files. I have this in the folder public/assets so, I have something like this:
|--public
|----/assets
|-------/css
|------------/auth
|---------------login.css
|----------main.css
|-------/js
|---------email.js
|---------/modules
|------------faq.js
That is my directory, so I'm loading the CSS with:
<link href="{{ URL::asset('assets/css/main.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ URL::asset('assets/css/auth/login.css') }}" rel="stylesheet" type="text/css" />
And the JavaScript files with:
<script src="{{ asset('assets/js/email.js') }}" type="text/javascript"></script>
<script src="{{ asset('assets/js/modules/faq.js') }}" type="text/javascript"></script>
Also I'm loading another files as well but I'm explaining the basic situation. So, the thing is that the load of login.css and faq.js are giving me 404 error but the other files are loaded correctly, I even checked open the files through the absolute paths and they're loaded fine, also I made chown to www-data of the public folder but nothing works, so I don't know why a 404 error is triggered. What else should I check?
In the console of the browser the links that are loaded are:
http://mydomain/assets/js/modules/faq.js
http://mydomain/assets/css/auth/login.css
But they give 404 error, and the other files doesn't
first check those 404 files are in there definitely
check those files have readable permisstion

Some files in /assets/css not found [Playframework]

Hi I was having this problem with an unresolved dependency:
sbt.ResolveException: unresolved dependency: play#sbt-plugin;2.2.0:
not found
and then I found the solution here: Upgrading project to version 2.2.0 of the Play Framework
I followed the steps now when I compile or run play there are not errors but when I load the webpage I'm working with it can't find some of the files in /assets/css. After all the changes proposed on the solution I use the command clean, but still the same problem [Status Code:404 Not Found].
This is how I call the files in assets:
> layout.scala.html
<link rel="stylesheet" href="#routes.Assets.at("css/layout.min.css")" type="text/css">
<link rel="stylesheet" href="#routes.Assets.at("css/style.min.css")" type="text/css">
<link rel="stylesheet" href="#routes.Assets.at("css/blocks.min.css")" type="text/css">
I'm using play 2.2.0. Any idea about how to solve it? Thanks

Assetic not creating combined links

Just having a few problems trying to get Assetic to generate the combined links in rendered webpages. The files themselves are being generated fine, but in the web page in the production environment, I'm continuing to see the seperate file URLs (which do not work in production, as those uncombined files aren't available).
In a template, I have:
{% stylesheets
'#TBundle/Resources/public/css/bootstrap/bootstrap.css'
'#TBundle/Resources/public/css/bootstrap/bootstrap-responsive.css'
'#TBundle/Resources/public/css/jquery-selectbox/jquery.selectBox.css'
%}
<link href="{{ asset_url }}" rel="stylesheet" media="screen" />
{% endstylesheets %}
In production, this is still rendered as:
<link href="/css/2f787d0_bootstrap_1.css" rel="stylesheet" media="screen" />
<link href="/css/2f787d0_bootstrap-responsive_2.css" rel="stylesheet" media="screen" />
<link href="/css/2f787d0_jquery.selectBox_3.css" rel="stylesheet" media="screen" />
Despite that, when I invoke php app/console assetic:dump --env=prod I get:
11:13:43 [dir+] /var/www/tbundle/app/../web/css
11:13:43 [file+] /var/www/tbundle/app/../web/css/2f787d0.css
I'm using the default Assetic settings from Symfony2. Any thoughts on what might be causing this?
I had this exact same problem, and for me the issue was in my app.php file. I was loading the kernel as follows:
$kernel = new AppKernel('prod', true);
It appears as though this caused the function to not run in debug mode and combine the assets. When i changed the second argument to false, the assets successfully combined on production and remained uncombined on dev:
$kernel = new AppKernel('prod', false);
Also, you can pass combine=true as an argument to explicitly request that the assets get combined just to test that this functionality is working properly.

Resources