【发布时间】:2021-11-25 10:32:17
【问题描述】:
我需要有关此代码的帮助
/// <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(function(){ return this.label;}); 返回#Cust 的所有姓名和姓氏 但是当运行 cypress 时,它并没有显示期望已运行
【问题讨论】:
标签: javascript cypress