我使用Protular与Angular 1.x. 我想逐步迁移到Angular 2.0,但我没有在文档中看到Protractor .
自Angular 2以来,量角器已被丢弃吗?我应该在不使用Protractor的情况下编写测试,而不是使用Jasmine(或其他)吗?
可以通过两种不同的方式包含文件:
{% include 'fic.html.twig' %}
{{ include('fic.html.twig') }}
Run Code Online (Sandbox Code Playgroud)
这两种方法有什么区别?
资源:
我使用此属性来定义宽度和高度的屏幕:
var width = 1280;
var height = 600;
browser.driver.manage().window().setSize(width, height);
Run Code Online (Sandbox Code Playgroud)
在onPrepare()方法中,但是这个代码对于某些测试是有用的,而不是对所有测试都有用.这是为什么?我没有在测试中重新定义屏幕的大小.
问候,
约翰尼
编辑:使用Protactor 2.5.1,我的Node版本为0.10.33.
量角器的配置:
// Fichier de configuration pour Angular
exports.config = {
sauceUser: "",
sauceKey: "",
capabilities: {
'browserName': 'chrome',
'name': 'Protractor Circle CI'
},
specs: ["src/Bg/*Bundle/Tests/Angular/*Test.js"],
exclude: ['src/Bg/*Bundle/Tests/Angular/*AuthTest.js', 'src/Bg/*Bundle/Tests/Angular/*RapideTest.js'],
baseUrl: "http://bluegrey.circle.dev:8080/app_ci.php",
onPrepare: function() {
browser.driver.get('http://bluegrey.circle.dev:8080/app_ci.php/fr_FR/login');
browser.driver.findElement(by.id('username')).sendKeys('user@evolunium.fr');
browser.driver.findElement(by.id('password')).sendKeys('userpass');
browser.driver.findElement(by.id('_submit')).click();
return browser.driver.wait(function() {
return browser.driver.getCurrentUrl().then(function(url) {
return /dashboard/.test(url);
});
}, 600000);
var width = 1280;
var height = 600;
browser.driver.manage().window().setSize(width, height);
},
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: …Run Code Online (Sandbox Code Playgroud) 我使用API Rest.我想用AJAX和JQuery创建一个ressource .我的ressource是正确创建的,但调用了错误回调.
我的代码是:
$.ajax({
url: "/api/skills.json",
data: JSON.stringify(skill),
method: "POST",
contentType: "application/json",
statusCode: {
201: function (data) {
console.log("201");
}
},
success: function (data) {
console.log("success");
},
error: function (data) {
console.log("error");
},
complete: function (data) {
console.log("complete");
}
});
Run Code Online (Sandbox Code Playgroud)
从Firefox控制台导致"网络":
HTTP/1.1 201 Created
Date: Thu, 27 Oct 2016 08:29:08 GMT
Server: Apache
X-Powered-By: PHP/7.0.8
Cache-Control: no-cache
Location: http://localhost/api/skills/pdak12ada64d
Allow: POST
Content-Length: 0
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: application/json
Run Code Online (Sandbox Code Playgroud)
控制台的结果:
"201"
"error"
"complete"
Run Code Online (Sandbox Code Playgroud)
为什么JQuery调用201状态的错误回调?
我尝试使用快捷方法$.post …
写出什么是最好的,为什么?
class Chat
{
private $_couleur;
private $_race;
function __construct($couleur, $race)
{
$this->_couleur = $couleur;
$this->_race = "$race";
}
public function getCouleur() {
return $this->_couleur;
}
}
Run Code Online (Sandbox Code Playgroud)
要么
class Chat
{
function __construct($couleur, $race)
{
$this->_couleur = $couleur;
$this->_race = "$race";
}
public function getCouleur() {
return $this->_couleur;
}
}
Run Code Online (Sandbox Code Playgroud)
因为$this->_couleur在类被实例化时被初始化,所以在类中直接声明属性是没用的,不是吗?
我将Symfony用于我的项目,我需要构建一个API REST.
从技术上讲,我知道如何构建API Rest但我不知道如何围绕API REST构建我的其他bundle.
例如 :
src/
ApiBundle
CommentBundle
PageBundle
Run Code Online (Sandbox Code Playgroud)
ApiBundle允许创建/删除/更新(等)页面或注释.实体(和表单)必须是ApiBundle还是CommentBundle/PageBundle?
我用circle来运行JS和PHP测试(Protractor/Phpunit).
我想使用并行来赢得时间,但我不知道配置并行性.我激活圆参数(2个容器)中的并行度.
我的实际圈子配置(circle.yml):
# Depend de app/config/parameters.circle.yml (parametre symfony pour circle) et app/config/apache.circle (configuration d'Apache pour Circle)
# Configuration du serveur
machine:
php:
version: 5.4.21
timezone:
Europe/Paris
hosts:
bluegrey.circle.dev: 127.0.0.1
dependencies:
pre:
# SauceConnect (Angular)
- wget https://saucelabs.com/downloads/sc-latest-linux.tar.gz
- tar -xzf sc-latest-linux.tar.gz
- ./bin/sc -u johnnyEvo -k xxx:
background: true
pwd: sc-*-linux
# Installation protractor (Angular)
- npm install -g protractor
# On active XDebug
- sed -i 's/^;//' ~/.phpenv/versions/$(phpenv global)/etc/conf.d/xdebug.ini
- echo "xdebug.max_nesting_level = 250" > ~/.phpenv/versions/$(phpenv global)/etc/conf.d/xdebug.ini
# …Run Code Online (Sandbox Code Playgroud) 我正在使用 Heroku 以默认配置部署我的 Symfony2 应用程序,但不会转储资产。
我已经添加到 composer.json :
...
"scripts": {
"post-install-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"php app/console --env=prod assetic:dump"
]
},
...
Run Code Online (Sandbox Code Playgroud)
这是正确的方法吗?
在 Procfile 中,不起作用。与 :
heroku run php app/console --env=prod assetic:dump
Run Code Online (Sandbox Code Playgroud)
也不起作用。
谢谢,
参考:https : //devcenter.heroku.com/articles/getting-started-with-symfony2
我看了这个教程来创建一个REST API,但是我从其他软件包中看到了这些做法,如FOSUser,FOSComment等......
该教程解释(引用Symfony)最好将控制器的逻辑外包出去.我理解,我认为这很棒.但为什么要创建接口?
我不知道为什么通过我们的实体和我们的处理程序的接口更安全.我不明白接口的实用程序来声明两次我们的方法.
我来自前端开发,我对后端环境并不完全熟悉,我的问题可能看起来很愚蠢.
问候,