小编Mar*_*cía的帖子

没有这样的属性:类的 api:groovy.lang.Binding 错误

我试图在 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)

groovy jenkins-groovy jenkins-pipeline

10
推荐指数
1
解决办法
5万
查看次数

Cypress 装置 - 无法读取未定义的属性(读取“数据”)

我正在尝试使用固定装置来保存不同测试的数据,特别是用户凭据。这是代码的示例。当进行第二次测试时,我得到了'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)

fixtures cypress

6
推荐指数
2
解决办法
3万
查看次数

在浏览器的输入中检测Ctrl + C和Ctrl + V.

我正在使用直接跟随,我没有检测到复制和粘贴输入内的键,有人会知道如何?谢谢!

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)

directive keyboard-events onkeydown angular

5
推荐指数
3
解决办法
8935
查看次数

如何解析 dotnet 测试中的 Microsoft.NET.Test.Sdk 引用?

我正在进行 dotnet 测试,但出现此错误:

确保测试项目具有包“Microsoft.NET.Test.Sdk”的 nuget 引用并且框架版本设置合适。

.net

5
推荐指数
1
解决办法
7121
查看次数