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

Add cypress tests for web UI #1269

Merged
merged 1 commit into from
Apr 18, 2023
Merged

Add cypress tests for web UI #1269

merged 1 commit into from
Apr 18, 2023

Conversation

Itxaka
Copy link
Member

@Itxaka Itxaka commented Apr 11, 2023

What this PR does / why we need it:

This adds basic webUI tests to our workflows based of cypress.
Currently the deployment and test is simplified, as it runs a local webui agent inside earthly and tests several parts on the UI and some of the functionality (validation)

Hopefully in the near future this is expanded to use a full qemu VM with the webui running and we can trigger the full install from there although its a bit nastey as it would be earthly -> ginkgo -> qemu -> cypress

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

@Itxaka Itxaka requested a review from a team April 11, 2023 07:11
@netlify
Copy link

netlify bot commented Apr 11, 2023

Deploy Preview for kairos-io canceled.

Name Link
🔨 Latest commit 0938647
🔍 Latest deploy log https://app.netlify.com/sites/kairos-io/deploys/643e85888d068a000946bd49

@codecov-commenter
Copy link

codecov-commenter commented Apr 11, 2023

Codecov Report

Merging #1269 (fc4b06f) into master (7bb9af9) will decrease coverage by 1.69%.
The diff coverage is 44.50%.

❗ Current head fc4b06f differs from pull request most recent head 0938647. Consider uploading reports for the commit 0938647 to get more accurate results

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##           master    #1269      +/-   ##
==========================================
- Coverage   22.79%   21.10%   -1.69%     
==========================================
  Files          22       16       -6     
  Lines        1610     1284     -326     
==========================================
- Hits          367      271      -96     
+ Misses       1179      962     -217     
+ Partials       64       51      -13     
Impacted Files Coverage Δ
internal/agent/config.go 0.00% <ø> (ø)
internal/agent/interactive_install.go 0.00% <ø> (ø)
internal/agent/notify.go 0.00% <0.00%> (ø)
internal/agent/recovery.go 0.00% <ø> (ø)
internal/agent/reset.go 0.00% <0.00%> (ø)
internal/agent/upgrade.go 0.00% <0.00%> (ø)
pkg/config/config.go 0.00% <0.00%> (-51.36%) ⬇️
internal/agent/install.go 5.10% <21.21%> (+5.10%) ⬆️
pkg/config/collector/options.go 64.51% <37.50%> (ø)
pkg/config/collector/collector.go 61.13% <61.13%> (ø)
... and 2 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

mauromorales
mauromorales previously approved these changes Apr 11, 2023
Copy link
Member

@mauromorales mauromorales left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noiiice! 👏

mudler
mudler previously approved these changes Apr 11, 2023
Copy link
Member

@mudler mudler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely!!!

@@ -105,21 +105,21 @@ <h1>Welcome to the Installer!</h1>

codeMirrorEditor.on('change', () => content = codeMirrorEditor.getValue())
"
x-on:keydown="validateYAML"
x-on:keydown.debounce="validateYAML"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is so there is a delay after keys of 250ms. Otherwise, this keeps firing while you write and can send a lot of data to the validation endpoint which is not nice. Having this means that after the last keydown has been sent and no other one key has been pressed in 250ms then event fires. This was causing a lot of calls to the validate endpoint while writing (one per key!)

cy.get("#validator-alert").invoke("text").should("match", /Failed validating syntax/)

})
it('should install', function () {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesnt really work, it fails to find the agent but we should probably hijack the call and check that all data was passed correctly.

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
Copy link
Member

@mauromorales mauromorales left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't have to be in this PR, but I think it might make sense to somehow keep track of the report. So we can give an idea of how much the coverage went up/down

Copy link
Member

@mudler mudler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super!

@Itxaka Itxaka merged commit ee465e6 into kairos-io:master Apr 18, 2023
@Itxaka
Copy link
Member Author

Itxaka commented Apr 19, 2023

Doesn't have to be in this PR, but I think it might make sense to somehow keep track of the report. So we can give an idea of how much the coverage went up/down

that is a really good point! Gonna have a look to see if we can also use codecov for this or it will get confused and break :D

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

Successfully merging this pull request may close these issues.

4 participants