我试图在 Jenkins 上构建一个在节点上运行命令并通知我以下错误的管道:
groovy.lang.MissingPropertyException: No such property: api for class: groovy.lang.Binding
at groovy.lang.Binding.getVariable(Binding.java:63)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:270)
at org.kohsuke.groovy.sandbox.impl.Checker$6.call(Checker.java:289)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:293)
at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.getProperty(SandboxInvoker.java:29)
at com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:20)
Run Code Online (Sandbox Code Playgroud)
我不知道节点命令是错误命令还是另一个错误,这是管道文件:
def call() {
pipeline {
agent any
parameters {
string(name: 'branch', defaultValue: 'refs/heads/develop', description: 'git branch where fetch sourcecode')
}
environment {
GIT_URL = getGitRepoURL()
GIT_CREDENTIALS = '*******'
}
tools {
nodejs "node"
}
triggers {
cron('H 06 * * 1-5')
}
stages {
stage ('Initialize'){
steps {
echo 'initializing'
deleteDir()
bat '''
echo "PATH = …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用固定装置来保存不同测试的数据,特别是用户凭据。这是代码的示例。当进行第二次测试时,我得到了'Cannot read properties of undefined (reading 'data')'。
有什么想法以及如何解决这个问题吗?这是错误的吗?
before(function () {
cy.fixture('credentials').then(function (data) {
this.data = data;
})
})
it('Login correct', () => {
cy.visit('/')
loginPage.signIn(this.data.admin.username,this.data.admin.password)
cy.wait(5000)
// assertion
cy.contains('Dashboard').should('be.visible')
})
Run Code Online (Sandbox Code Playgroud)
这是我的credentials.json文件:
{
"admin": {
"username": "*****",
"password": "*****"
}
}
Run Code Online (Sandbox Code Playgroud) 我正在使用直接跟随,我没有检测到复制和粘贴输入内的键,有人会知道如何?谢谢!
export class OnlyNumberDirective {
// Allow decimal numbers. The \, is only allowed once to occur
private regex: RegExp = new RegExp(/[0-9]+(\,[0-9]{0,1}){0,1}$/g);
// Allow key codes for special events. Reflect :
// Backspace, tab, end, home
private specialKeys: Array<string> = [ 'Backspace', 'Tab', 'End', 'Home', 'Delete', 'Del', 'Ctrl', 'ArrowLeft', 'ArrowRight', 'Left', 'Right' ];
constructor(private el: ElementRef) {
}
@HostListener('keydown', [ '$event' ])
onKeyDown(event: KeyboardEvent): string {
// Allow Backspace, tab, end, and home keys
if (this.specialKeys.indexOf(event.key) !== -1) { …Run Code Online (Sandbox Code Playgroud) 我正在进行 dotnet 测试,但出现此错误:
确保测试项目具有包“Microsoft.NET.Test.Sdk”的 nuget 引用并且框架版本设置合适。