Prevent use of wait in cypress test to make it more resilient.

This commit is contained in:
Dillon Kearns 2022-11-18 10:21:58 -08:00
parent d16c1699f1
commit 0685561fd1
2 changed files with 3 additions and 3 deletions

View File

@ -12,7 +12,6 @@ context("fetchers", () => {
addItem("5"); addItem("5");
cy.wait(100); cy.wait(100);
addItem("501"); addItem("501");
cy.wait(1000);
expectList("5", "500", "501"); expectList("5", "500", "501");
}); });
}); });
@ -23,8 +22,9 @@ function addItem(itemName) {
} }
function expectList(...list) { function expectList(...list) {
cy.get("ul#items>li.loading").should("have.length", 0);
cy.get("ul#items>li") cy.get("ul#items>li")
.should("have.length", 3) .should("have.length", list.length)
.then(($els) => { .then(($els) => {
// source: https://glebbahmutov.com/cypress-examples/7.1.0/recipes/get-text-list.html#getting-text-from-list-of-elements // source: https://glebbahmutov.com/cypress-examples/7.1.0/recipes/get-text-list.html#getting-text-from-list-of-elements
// we get a list of jQuery elements // we get a list of jQuery elements

View File

@ -247,7 +247,7 @@ view maybeUrl sharedModel model app =
(\item -> (\item ->
case item of case item of
Pending name -> Pending name ->
Html.li [] [ Html.text <| name ++ "..." ] Html.li [ Attr.class "loading" ] [ Html.text <| name ++ "..." ]
Created name -> Created name ->
Html.li [] [ Html.text name ] Html.li [] [ Html.text name ]