dwyl / mvp

๐Ÿ“ฒ simplest version of the @dwyl app
https://mvp.fly.dev
GNU General Public License v2.0
87 stars 2 forks source link

Chore: Failing Timer Test #283

Closed nelsonic closed 1 year ago

nelsonic commented 1 year ago

Build is failing on main due to an issue with a Timer:

1) test handle_info/2 update with editing open (start) (AppWeb.AppLiveTest)
Error:      test/app_web/live/app_live_test.exs:99
     Assertion with =~ failed
     code:  assert render(view) =~ now_string
     left:  "<div data-phx-main=\"true\" data-phx-session=\"" data-phx-static=\"SFMyNTY.g2gDaAJhBXQAAAADZAAKYXNzaWduX25ld2wAAAABZAAIbG9nZ2VkaW5qZAAFZmxhc2h0AAAAAGQAAmlkbQAAABRwaHgtRnowMU9vbUozT1VKcUJXaG4GAAd5JeOFAWIAAVGA.6R03aQF61Z_UEp69xyAlmeI-LGXqdtDVAPBo8Jgi-38\" id=\"phx-Fz01OomJ3OUJqBWh\"><main class=\"font-sans container mx-auto\">
<form class=\"w-full lg:w-1/2 m-auto\" phx-submit=\"create\">
<textarea class=\"w-full py-1 px-1 text-slate-800 text-3xl\n        bg-white bg-clip-padding\n        resize-none\n        max-h-100\n        transition ease-in-out\n        border border-b border-slate-200\n        focus:border-none focus:outline-none\n        my-2\" name=\"text\" id=\"textval\" phx-change=\"validate\" phx-debounce=\"2000\" placeholder=\"Capture what is on your mind ...\" required=\"required\" x-data=\"{resize() {\n           $el.style.height = &#39;100px&#39;;\n           $el.style.height = $el.scrollHeight + &#39;px&#39;;\n        }\n      }\" x-on:focus=\"\" x-init=\"$el.selectionStart= $el.value.length;\n      $el.selectionEnd= $el.value.length;\n      $el.focus();\n      
resize\" x-on:input=\"resize\">
</textarea><!-- Select Input --><div class=\"lg:w-1/2 \" x-data=\"{open: false}\" x-on:click.away=\"open = false\" x-on:keydown.escape=\"open = false\"><input type=\"text\" name=\"tag\" class=\"w-full my-2\" x-on:focus=\"open = true\" phx-keyup=\"filter-tags\" phx-debounce=\"250\" autocomplete=\"off\" placeholder=\"tags\"/><div class=\"relative z-10 drop-shadow-lg w-auto\" x-show=\"open\" x-transition=\"x-transition\" x-cloak=\"x-cloak\">
<ul class=\"absolute border bg-white max-h-64 overflow-auto w-full\">
<li class=\"border-b p-2 cursor-pointer hover:bg-slate-200\">
<a class=\"block w-full text-center\" href=\"/tags\">edit tags</a></li></ul></div></div><!-- End Select Input -->
<!-- Display the selected tags --><div class=\"\"></div>
<!-- Want to help \"DRY\" this? see: https://github.com/dwyl/app-mvp-phoenix/issues/105 --><!-- https://tailwindcss.com/docs/justify-content#end --><div class=\"flex justify-end mr-1\">
<button class=\"inline-flex items-center px-2 py-1 mt-1 h-9\n        bg-green-700 hover:bg-green-800 text-white rounded-md\"><svg xmlns=\"http://www.w3.org/2000/svg\" class=\"h-5 w-5 mr-2\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M15 13l-3 3m0 0l-3-3m3 3V8m0 13a9 9 0 110-18 9 9 0 010 18z\"></path></svg>\n        Save\n      
</button></div></form><!-- List of items with inline buttons and controls -->
<ul class=\"w-full\"><li data-id=\"21\" class=\"mt-2 flex w-full border-t border-slate-200 py-2\">
<!-- if item is \"done\" (status: 4) strike-through and show \"Archive\" button -->
<!-- Show checkbox so the item can be marked as \"done\" --><label>
<div class=\"hidden\">\n                Toggle the checkbox to set an item&#39;s status to done.\n            
 </div><input type=\"checkbox\" phx-value-id=\"21\" phx-click=\"toggle\" class=\"flex-none p-4 m-2 form-checkbox hover:text-slate-[60](https://github.com/dwyl/mvp/actions/runs/3994842614/jobs/6853015066#step:8:61)0\"/></label><!-- Editing renders the textarea and \"save\" button - near identical (duplicate) code from above\n          Help wanted DRY-ing this ... see: https://github.com/dwyl/app-mvp-phoenix/issues/105 --><div class=\"flex flex-col grow\">
<form phx-submit=\"update-item\" id=\"form-update-item-21\" class=\"w-full pr-2\">
<textarea id=\"textarea-editing-of-item-21\" class=\"w-full flex-auto text-slate-800\n   bg-white bg-clip-padding\n                  transition ease-in-out\n                  border border-b border-slate-200\n                  focus:border-none focus:outline-none\" name=\"text\" placeholder=\"What is on your mind?\" autofocus=\"autofocus\" required=\"required\" value=\"Always Learning\">Always Learning</textarea><!--<input\n                    id={\"tag-of-item-\#{item.id}\"}\n                    type=\"text" <> ...
     right: "2023-01-24T09:39:21"
Warning:      stacktrace:
       test/app_web/live/app_live_test.exs:125: (test)

https://github.com/dwyl/mvp/actions/runs/3994842614/jobs/6853015066#step:8:58

image

The code in question is: https://github.com/dwyl/mvp/blob/55c75b09610aba73df9f52057a2481634feab69c/test/app_web/live/app_live_test.exs#L99-L126

Todo

@LuchoTurtle if you're free, please help. ๐Ÿ™ (join us on Zoom to remote-debug)

nelsonic commented 1 year ago

@seaneady ref: https://github.com/dwyl/technical-glossary#technical-debt

nelsonic commented 1 year ago

I'm picking this up now with @seaneady and live-debugging it on Zoom as a fun exercise. ๐Ÿ˜œ

nelsonic commented 1 year ago

This is passing on my localhost on main:

image

So I'm having a little trouble replicating the issue.

nelsonic commented 1 year ago

Re-running all jobs on GitHub Actions:

image image

Failed. Running one more time:

image
nelsonic commented 1 year ago

The re-run passed: https://github.com/dwyl/mvp/actions/runs/3994842614

image
nelsonic commented 1 year ago

Build passing on main: https://github.com/dwyl/mvp/commits/main

image

This was an annoying waste of time. ๐Ÿ™„ Closing. Will re-open if it resurfaces. ๐Ÿ‘Œ