【问题标题】:How to check if only one element from the table has specific class with Cypress如何使用赛普拉斯检查表中是否只有一个元素具有特定类
【发布时间】:2022-12-02 19:42:20
【问题描述】:

I have a table for emails with \"primary\" radiobuttons column which means only one of them could have class .checked. How can I check this with Cypress?

I tried this but it\'s not working for classes since it checks if all the elements in the column to have this class.

P.S I\'m using TypeScript and React. Each row is rendered separately

  it(\"check if rest of the emails\' primary setting are set to false\", () => {
    cy.get(\'td:nth-child(2)\')
    .should(\'not.have.class\', \'checked\')
    .should(\'have.length\', 1);

    标签: reactjs typescript cypress


    【解决方案1】:
    【解决方案2】:
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-02-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-16
    相关资源
    最近更新 更多