在我试图引用柏树 - Xpath的文件中,这就是我所拥有的:
/// <reference types="cypress" />
/// <reference types="cypress-xpath" />
describe("Test Contact Us form via Automation Test Store", () => {
it("Should be able to submit a successful submission via contact us form", () => {
cy.visit("https://www.automationteststore.com/");
//cy.get('.info_links_footer > :nth-child(5) > a').click();
cy.get('#ContactUsFrm_first_name').type("Joe");
cy.get('#ContactUsFrm_email').type("[email protected]");
cy.get('#ContactUsFrm_enquiry').type("Test");
cy.get('.col-md-6 > .btn').click();
})
})
const { defineConfig } = require("cypress");
module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
},
specPattern: "cypress/e2e/**/*.{js,jsx,ts,tsx,feature}"
},
});
我在这里尝试了一些答案,并尝试了各种终端命令,这些终端命令可能会解决问题,但没有任何效果。我不确定如何继续解决这个问题,任何帮助都将不胜感激。
类型参考线
/// <reference types="cypress-xpath" />
看起来像旧的(不推荐使用的)软件包。
集成软件包包括一个类型定义文件index.d.ts
应该使用访问该文件
/// <reference types="@cypress/xpath" />
我的项目不使用Typescript,而是使用JavaScript的Cypress,但是Cypress-Xpath无法识别。那会做同样的工作吗?toxpance.json具有键“类型”:“ src”,index.d.ts在该文件夹中。