![](/img/trans.png)
[英]Act when element exists, but don't fail when it doesn't (Cypress E2E tests)
我正在 Cypress(版本 12.3.0)中編寫 E2E 測試。 我在多步驟創建過程中有一個包含表格的頁面,需要來自后端應用程序的一些數據。 在某些情況下(很少,但會發生)請求被卡住並且加載器永遠不會消失。 解決方法很簡單:go 回到上一步,回到“卡住”的表。 重新發送請求並且很可能會收到響應 ...
[英]Act when element exists, but don't fail when it doesn't (Cypress E2E tests)
我正在 Cypress(版本 12.3.0)中編寫 E2E 測試。 我在多步驟創建過程中有一個包含表格的頁面,需要來自后端應用程序的一些數據。 在某些情況下(很少,但會發生)請求被卡住並且加載器永遠不會消失。 解決方法很簡單:go 回到上一步,回到“卡住”的表。 重新發送請求並且很可能會收到響應 ...
[英]After updating to cypress 12.0.0, my test is throwing an error in the cypress-if package
更新到 cypress 12.0.0 后,出現以下錯誤,我該如何解決? ...
[英]Conditional Testing with Cypress e2e
我有一個帶有柏樹的網站測試用例。 然而,該網站是在 vue.js 中構建的,可以說有 2 個旅程。 其中一個有一個我想點擊的按鈕。 所以,我想做的是:if ('button exists') { cy.get(#"button-class").click() //basically cli ...
[英]Cypress - Conditional test with timeout
我正在嘗試做與這篇文章非常相似的事情: https://stackoverflow.com/questions/56145926/how-to-check-if-element-exists-using-cypress-io 我正在使用打字稿。 這是我的代碼: 問題是“this.timerLocat ...
[英]How to Skip a Test if an element is not present in Cypress
我正在編寫一個測試,如果我登陸一個頁面並且有任何記錄可用,我需要單擊記錄附近的三個點按鈕。 但是如果頁面上沒有可用的記錄,我應該跳過測試。 cy.get('body') .then(($body) => { if ($body.find('.ant-empty-des ...
[英]Is it possible to keep executing test if element wasn't found with Cypress
我有一個案例,我需要等待元素(廣告),如果它可見則需要單擊它,但如果在超時后未找到元素,則需要繼續執行測試。 如何處理 Cypress 的情況? ...
[英]How to have two different tests for conditional tables that render on a page based upon the prop passed by parent?
我有一個檢查頁面上表格的柏樹測試,但是有兩個不同的表格可以根據表格類型條件呈現。 如果表的類型是product ,一個表將呈現,如果類型是equipment ,另一個表將呈現。 我如何編寫此 cypress 測試來檢查頁面上是否存在該特定表,然后運行一組特定的檢查,反之亦然? 測試說明: 條件是s ...
[英]Conditional Tests in Cypress using data-cy attributes as selectors
我看到一些關於這個確切主題的帖子,但沒有一個像我一樣使用數據類作為選擇器,所以這使得這個條件測試更難編寫。 這個想法是我有一個帶有分頁的表格。 我的想法是檢查[data-cy-pagination-next]是否有或沒有disabled屬性,這意味着有多於一頁,因此測試可以繼續。 我看到的大多數帖子 ...
[英]cyoress test validate div tag ID contains value
在 HTML 頁面上有嵌套的 div 標簽。 div 標簽 ID = x 或標簽 ID = y。 在不同的 HTML 頁中。 <--! example 1 --> <body> <div> <div></div> <div id= ...
[英]How to proper Conditional Testing
我只想問如何正確地進行條件測試? 我這里有這段代碼 cy.get('[data-slug="add-to-any"] > .plugin-title > strong').then(($slug) => { if (expect($slug).not.to.exi ...
[英]How can I write if-else conditions in cypress according to element's value?
根據帶有 if 條件的元素的值變化,我如何運行這個 function? assertSwitch(){ cy.get('[data-test="form-switch"]').invoke('attr','value').then(($switchOnOff) ...
[英]Cypress - Element not found
找不到元素時如何克服這種情況。 我正在自動化一個表格,我故意在其中提供重復的名稱,因此將根據我所寫的內容顯示錯誤消息“限制名稱已存在” add.limitName().type('Movie Limits') // Giving duplicate name "Movie Limits" ...
[英]Cypress results with "pointer-events: none" error when using condition, what should I do?
我想點擊下一步按鈕來測試分頁,直到它的 class 被“禁用”。 我使用了下面的代碼。 但即使“下一步”按鈕已“禁用”class,它也會繼續單擊。賽普拉斯會在附件中拋出錯誤。 ...
[英]How to check for an element that may not exist using Cypress
我正在編寫 Cypress 測試以登錄網站。 有用username和password字段以及Submit按鈕。 大多數登錄都很簡單,但有時會首先出現一個警告對話框,必須將其關閉。 我試過這個:cy.get('#login-username').type('username'); cy.get('#l ...