UMB-CS-682-Team-03 / tracker

0 stars 0 forks source link

Check fallback operation if web component fails to register - add method to test #16

Closed rouilj closed 5 months ago

rouilj commented 7 months ago

Add a method to prevent initialization of the web component. This allows testing of the fallback support if js is turned off, fails to load, gets filtered etc.

Also if the user can't use the REST interface (it's a separate permission than using the web interface), the web-component should not be enabled since it will break.

So this ticket checks these failing conditions. I think it's as simple as not running:

customElements.define("roundup-classhelper", ClassHelper);

at the end of the js file.

Perhaps a small function or an if check wrapping the define call that looks at the URL and if a specific fragment (e.g. #classhelper-wc-toggle) is present, skip loading the component? This should be quick to check with: document.URL.endsWith('#classhelper-wc-toggle') or similar check. For now, no need to make it persistent (via cookie or something).

patel-malav commented 6 months ago

This works but needs to be tested with testing framework

rouilj commented 6 months ago

@BharathKanama am I correct that you have a test for this in your selenium suite?

rouilj commented 6 months ago

Bharath you have marked this as ready for review, but I don't see a fallback test case in test_classhelper.py. Maybe it's not pushed to github or not pushed to main?

BharathKanama commented 5 months ago

It is now pushed into main.