我正在使用nightwatchJS进行浏览器自动化.我看到的一个常见用例是,我网页中的大部分内容都是通过来自ajax调用的数据进行更新的.所以,在我的测试中,我正在寻找一种方法来保持我的测试,直到我从Ajax获得结果.我没能在夜间观察或硒中找到任何api.
我试过了waitForElementVisible,但我觉得这还不够.如果我的ajax调用没有返回任何数据,会发生什么.
以前有人试过这个吗?
我有一个字符串 (100*##G. Mobile Dashboard||Android App ( Practo.com )||# of new installs@@-##G. Mobile Dashboard||Android App ( Practo.com )||# of uninstalls@@
我想以返回以下结果的方式拆分字符串(即它匹配以开头##和结尾的所有字符,并@@用匹配的字符拆分字符串)
["(100*", "G. Mobile Dashboard||Android App ( Practo.com )||# of new installs", '-', 'G. Mobile Dashboard||Android App ( Practo.com )||# of uninstalls'
Run Code Online (Sandbox Code Playgroud) 我试图在部署完成后触发我们的冒烟测试。部署可以通过任何平台(如 vercel、GitHub 等)完成。我正在侦听deployment_status来自 GitHub 操作的事件,如果是success,我会根据 获取 PR 详细信息github.sha。代码如下:
name: Run Cypress Smoke Tests
on: [deployment_status]
....
steps:
- name: GitHub API Request
uses: octokit/request-action@v2.x
id: octokit
with:
route: GET /repos/:repository/commits/:commit_sha/pulls
mediaType: |
previews:
- antiope
- groot-preview
repository: ${{ github.repository }}
commit_sha: ${{github.sha}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Run Code Online (Sandbox Code Playgroud)
但有时github.sha并不正确。我从合并分支获取提交 ID 的值,而不是如上所述的实际存储库https://github.community/t/github-sha-not-the-same-as-the-triggering-commit/18286/2。
如何获取活动的正确分支名称或 PR 编号或提交 ID deployment_status?
提前致谢。
我是Mithril JS框架的新手,并试图将Mitril视图与angularJS集成.有人曾尝试过这个吗?
我想检查如何绑定角度控制器方法以单击在Mitril中创建的元素的事件.
我通过这个代码得到了这个
var e = document.getElementById('elementId');
var scope = angular.element(e).scope();
m("a[href='javascript:;']", {
onclick : scope.someMethod
}, "Test");
Run Code Online (Sandbox Code Playgroud)
但我不确定这是否是正确的方法.
我正在尝试使用 Jest 和酶解决承诺后测试这些方法。我的组件/功能代码:
// Functional Code
let functionAfterAsync = () => {
console.log('functionAfterAsync called');
}
const asyncFunction = () => {
return new Promise(resolve => resolve());
}
const functionWithAsyncCode = () => {
// ... some more code here
console.log('functionWithAsyncCode');
asyncFunction().then((res: any) => {
functionAfterAsync();
})
}
Run Code Online (Sandbox Code Playgroud)
我的测试:
functionAfterAsync = jest.fn();
// Tests
describe('<Async Test />', () => {
it('Call function after promise', () => {
functionWithAsyncCode();
expect(functionAfterAsync).toBeCalled();
})
});
Run Code Online (Sandbox Code Playgroud)
但是functionAfterAsync没有被调用,我得到的错误是:
expect(jest.fn()).toBeCalled() Expected mock function to have been …
javascript ×2
angularjs ×1
automation ×1
deployment ×1
git ×1
jestjs ×1
mithril.js ×1
regex ×1
string ×1