Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate pytests into GitHub Action "on push" #95

Closed
3 tasks done
rodja opened this issue Sep 25, 2022 · 6 comments
Closed
3 tasks done

Integrate pytests into GitHub Action "on push" #95

rodja opened this issue Sep 25, 2022 · 6 comments
Assignees

Comments

@rodja
Copy link
Member

rodja commented Sep 25, 2022

We want to run all our pytests for every push so no regressions creep in unnoticed. Most of the tests are based on selenium. Therefore the GithHub action "test.yml" needs to be extended accordingly.

Tasks:

  • add ChromeDriver to GitHub Action
  • run pytests
  • fix problems with custom components like scene, keyboard or joystick
@rodja
Copy link
Member Author

rodja commented Sep 25, 2022

The integration went quite well and easy. But now I've run into a blocker: Elements like ui.scene, ui.keyboard and ui.joystick are not working correctly on the GitHub Action. Locally they pass as expected. On GitHub instead of the expected template from their Vue components they just appear as elements like <keyboard></keyboard> or <joystick></joystick> without any functionality.

@rodja rodja self-assigned this Sep 25, 2022
@falkoschindler
Copy link
Contributor

falkoschindler commented Sep 25, 2022

Might be a routing issue for their dependencies. If, e.g., keyboard.js is not found, a keyboard element will only insert <keyboard></keyboard> in the DOM.

@rodja
Copy link
Member Author

rodja commented Sep 25, 2022

Very good, @falkoschindler. It seems that somehow the component response is wrapped in a html container. If I query /keyboard.js it returns

<html>
 <head>
  <meta content="light dark" name="color-scheme"/>
 </head>
 <body>
  <pre style="word-wrap: break-word; white-space: pre-wrap;">Vue.component("keyboard", {
  template: `&lt;span data-nicegui='keyboard' v-bind:id="jp_props.id" :class="jp_props.classes" :style="jp_props.style"&gt;&lt;/span&gt;`,
  mounted() {....

instead of the expected

Vue.component("keyboard", {
  template: `&lt;span data-nicegui='keyboard' v-bind:id="jp_props.id" :class="jp_props.classes" :style="jp_props.style"&gt;&lt;/span&gt;`,
  mounted() {....

@rodja
Copy link
Member Author

rodja commented Sep 25, 2022

No! The above observation is incorrect. The "wrapping" happend because I used BeautifulSoup to display the content. ::facepalm::

I verified with the "requests" lib that /keyboard.js indeed delivers the Vue component as expected. After I got the javascript console from Selenium to show up in the logs, the error is obvious:

http://localhost:3392/static/keyboard.js - Failed to load resource: the server responded with a status of 404 (Not Found)

But why is the component accessed via /static instead of /?

@rodja
Copy link
Member Author

rodja commented Sep 25, 2022

I finally found the problem: run.py imported globals.py before setting the template directory. But globals.py imported justpy for type annotations. Therefore justpy setted its directories before we could modify them as necessary. Fixed in 4fd338b.

@rodja
Copy link
Member Author

rodja commented Sep 25, 2022

All green :-)

@rodja rodja closed this as completed Sep 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants