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

test(tui): refactor tui tests to include tui tests in github actions workflow #45

Open
qascade opened this issue Oct 1, 2022 · 3 comments
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed yast/tests yast/tui

Comments

@qascade
Copy link
Owner

qascade commented Oct 1, 2022

For now, tests written to check and render tui are just written locally and are commented, before pushing on GitHub. The tests fail because BubbleTea can't find a terminal to render on while running an actions workflow. We need to find a way to make these tests run on GitHub actions as well to catch any unwanted behavior before pushing it to the main. We need to find a way to fool bubbletea that it is throwing output on a terminal and convert the output to a byte buffer, hash it using any hashing algorithm. Some functions to hash a string using SHA algo, already exist in the repo. and compare the hash with the desired output's hash, which was stored separately after manually verifying the correct output.

@qascade
Copy link
Owner Author

qascade commented Oct 1, 2022

Hard Coding a hash in a test will not be acceptable. It is better to store the desired byte buffer in a separate file and hash it during runtime because it might be possible that a different hash gets generated for the same byte buffer in a different environment.

@qascade
Copy link
Owner Author

qascade commented Oct 1, 2022

So, we need to refactor the tui tests code to produce the above-written behavior.
Acceptance Criteria:

  1. Work-flows should pass on GitHub actions in all environments without commenting the tui test codes.

@qascade qascade changed the title include TUI tests in github actions workflow Refactor tui tests to include tui tests in github actions workflow Oct 1, 2022
@qascade qascade added bug Something isn't working help wanted Extra attention is needed good first issue Good for newcomers yast/tui yast/tests hacktoberfest labels Oct 1, 2022
@qascade
Copy link
Owner Author

qascade commented Oct 1, 2022

One problem to be noted will be that tui tests will always require manual intervention as the output byte buffer is also subject to change, for example, in the case of ListModel while rendering results from a search query. So, we definitely have to make sure that all the models are properly getting rendered on the terminal. It might be possible that commenting ListModel tests is unavoidable but this condition will not be applicable to PlayerModel or any other model which will not change for a long period of time.

@qascade qascade changed the title Refactor tui tests to include tui tests in github actions workflow test(tui): refactor tui tests to include tui tests in github actions workflow May 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed yast/tests yast/tui
Projects
None yet
Development

No branches or pull requests

1 participant