我需要有关此代码的帮助
/// <reference types="cypress" />
import { get } from 'lodash';
const jsQuery = require('json-query');
const utils = require('../../../support/utils')
const roles = utils.roles;
const uri = Cypress.env('res_URL')
const AUT = roles.Admin;
const LONG_TIMEOUT = 10 * 1000;
describe('Alphabetical name sorting', () => {
before(function () {
//Log in
cy.login_Res(AUT.username, AUT.password)
})
it("sorting test", () => {
cy.visit(`${Cypress.env('res_URL')}/testpage`);
const checkAscSort = (value, limit) => {
const recordsUiAsc = cy.get('#Cust').children().map(function(){ return this.label;});
//const ascSorted = [];
cy.get(value).then(rows => {
const end = limit || rows.length;`enter code here`
for (let i = 1; i < end; i++) {
const text = rows[i].innerText.toLowerCase();
recordsUiAsc.push(text);
ascSorted.push(text);
}
const sortArray = recordsUiAsc.sort();
expect(recordsUiAsc).to.equal(sortArray);
});
}
});
}) //End of Spec这是数组cy.get(‘#Cust’).children().map(.map(){ return this.label;});,它返回#Cust的所有姓名和姓氏,但在运行cypress时,它不会显示expect已运行
发布于 2021-11-25 10:48:54
需要更多信息。在哪里调用checkAscSort?函数定义在但从未调用过的veriable中。它是其参数value和limit的内容。我猜limit是一个数字。
发布于 2021-11-25 14:05:55
当我调用CheckAscSort时,它会告诉我cy.get...map()不是函数(正确的是数组),所以出现了问题。Limit是一个数字权限。调用函数时,got cy.get().children(...).map不是函数
https://stackoverflow.com/questions/70109528
复制相似问题