I'm getting the error from the title for this function:
it('should change comment status to SOLVED',
async function() {
await page.click("#view_replies3");
await change_comment_status(page, 5, 'SOLVED');
expect(await page.content())
.to.include('comm1')
.to.include('"timeline-comment-status bg-success" name="5"');
var comment_ids = await page.$$eval('li.timeline-comment',
elements => elements.map((element) => element.getAttribute('name')));
var comment_statuses = await page.$$eval(
'input.custom-control-input',
elements => elements.map((element) => element.checked)
);
expect(comment_ids).to.deep.equal(['1', '3', '5', '7', '6', '4']);
expect(comment_statuses).to.deep.equal(
[true, false, true, false, false, false]
);
}).timeout(0);
After debugging I have figured out that the problem is in the function "change_comment_status()":
async function change_comment_status(page, comment_id, status) {
const selector = "input.custom-control-input[name='" +
comment_id.toString() + "']";
page.waitForSelector(selector);
await page.evaluate(selector => {
let element = document.querySelector(selector);
element.click();
}, selector);
}
the variable 'element' is null after the call
-
all the elements appear correctly in the page and the page looks like is fully loaded during the test running
Thanks, guys!
Aucun commentaire:
Enregistrer un commentaire