在过去的3天里,我一直在我的头上撞墙.
我正在使用sailsjs和捆绑的水线ORM.我想一个接一个地运行数据库调用.我知道我可以通过嵌套"then"调用来做到这一点,但它只是看起来不对.
我已经多次查看了Q文档和教程,但我仍然没有得到如何连接并从现有的Promises中依次点击"then"调用:(
我想要:
我的代码看起来像
var mail = 'test@test.com';
Users.create({email:mail, name:''}).then(console.log).fail(console.log);
Actions.create({actionID:123})
.then(function(error, action){
Users.findOneByEmail(mail).then(function(person){
person.actions.add(action.id);
person.save(console.log);
}).fail(console.log)
});
Users.update({email:mail},{name:'Brian'}).exec(console.log);
Actions.update({actionID:123},{now:'running'}).exec(console.log);
Run Code Online (Sandbox Code Playgroud)
正如你从代码中看到的那样,我一直在使用exec然后混合:P
我认为方法是连接Users.create(...).然后 - > Action.create(...).然后 - > Users.findOneByEmail(...).然后 - >*和更新.
非常感谢任何帮助
我继承了一个没有文档的工作项目.这是一个sails.js应用程序.有一小组单元测试和端到端测试.
当我尝试使用grunt运行端到端测试时.我明白了:
$ grunt e2e
Running "nightwatch" task
started - PID: 5440
>> Executing "default" tests (standalone)
[Index] Test Suite
==================
Running: Should clean the collection
removing 0 places
>> Connection refused! Is selenium server started?
Run Code Online (Sandbox Code Playgroud)
我不知道自己错过了什么.这让我停留了一个多星期.
该项目在grunt- nightwatch中有一个selenium-server-standalone-2.40.0.jar.所以我把PID作为selenium服务器启动.如果我先启动jar(在grunt之外),我会得到
$ grunt e2e
org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
18:38:46.189 WARN - Failed to start: SocketListener0@0.0.0.0:4444
Exception in thread "main" java.net.BindException: Selenium is already running on port 4444. Or some other service is.
at org.openqa.selenium.server.SeleniumServer.start(SeleniumServer.java:491)
at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:300) …Run Code Online (Sandbox Code Playgroud) 我正在组装一个 react-native 应用程序,并希望顶部有标签。我正在为选项卡使用createMaterialTopTabNavigator,这很好用。但是,当我在最新的 iPhone 模拟器上运行该应用程序时,标签会渗入传感器栏。在试图解决这个问题时,人们建议使用safeareaview,但它似乎没有关于如何将其与外部选项卡父级结合的任何信息。
你们能提供的任何帮助我将不胜感激。谢谢
sails.js ×2
javascript ×1
node.js ×1
orm ×1
promise ×1
q ×1
react-native ×1
selenium ×1
testing ×1
waterline ×1