IO-2327 converting a job tests

This commit is contained in:
swtmply
2023-06-15 00:22:17 +08:00
parent 8f8fdf7548
commit 76b17cd249
3 changed files with 101 additions and 5 deletions

View File

@@ -49,3 +49,26 @@ Cypress.on("uncaught:exception", (err, runnable) => {
// failing the test
return false;
});
Cypress.Commands.add("antdSelect", (selector) => {
cy.get(`.ant-select-${selector} > .ant-select-selector`).click();
cy.get(`.ant-select-${selector} .ant-select-selection-search input`)
.invoke("attr", "id")
.then((selElm) => {
const dropDownSelector = `#${selElm}_list`;
cy.get(dropDownSelector)
.next()
.find(".ant-select-item-option-content")
.first()
.click();
});
});
Cypress.Commands.add("antdFormSelect", (name, text, cb) => {
cy.get(".ant-form-item-required").then(($field) => {
if ($field.text().includes(text)) {
if (name) cy.antdSelect(name);
cb?.();
}
});
});