我试图点击在赛普拉斯自动化过程中提交输入的按钮。在执行手动输入时,提交了数据,但通过Cypress提交时,输入没有提交,导致状态码:401 Unauthorized。赛普拉斯试车器
context("Checking Add Importer Functionality", () => {
it("submits the form accepting only the mandatory field", () => {
cy.login(data.username, data.password);
cy.get("[title=Static]").click().url().should("include", "/importer");
cy.get(".css-1uccc91-singleValue")
.contains("Importer")
.type("importer {enter}");
cy.get(".buttontext").contains("Add Importer").click();
cy.get("[placeholder=Name]").should("be.visible").type("Ironman");
cy.get("[name=nameNp]").should("be.visible").type("Ironman");
cy.get("[name=eximCode]").clear().type("1234567891234");
cy.get("[type=submit]").click();
一次性保存
你可以试试&通过保存浏览器cookie进行检查例:
beforeEach(() => {
Cypress.Cookies.preserveOnce('<id>')
})
https://docs.cypress.io/api/cypress-api/cookies Preserve-Once