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

Improve tests result consistency #581

Merged
merged 16 commits into from
Jan 5, 2024
Merged

Improve tests result consistency #581

merged 16 commits into from
Jan 5, 2024

Conversation

ahangarha
Copy link
Contributor

@ahangarha ahangarha commented Dec 31, 2023

The changes in rescript_spec.rb and turbo_spec.rb improve our test accuracy.

The changes in spec/system/* fix the test failure when these tests run before others (leading to their failure).

I am not sure why we have tests in the system directory that should have the type of feature, but it fixes our issues. I need to study deeper to understand what is happening under the hood.

Should I move these feature tests into the feature directory, or we can keep them this way for now?

This change is Reviewable

@ahangarha ahangarha changed the title Reduces the tests false failure frequencies WIP - Reduces the tests false failure frequencies Dec 31, 2023
In this commit, a deply is put between UI interaction and database
check. This, fixed false positive test pass for not updating database on
empty form submission.
@ahangarha ahangarha changed the title WIP - Reduces the tests false failure frequencies Improve tests result consistency Jan 1, 2024
sleep(1)

# This will ensure we wait enough for the changes to be applied
expect(page).to have_text("")
Copy link
Member

Choose a reason for hiding this comment

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

@ahangarha, this is a very strange assertion!

Please add self-review comments for WTF's like this!

CC: @Judahmeek

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As I mentioned in the comment above that line, we need to put some delay before getting assertion for comment count change. Before I fixed it with sleep but that is not efficient. This assertion makes it more efficient.

Copy link
Member

Choose a reason for hiding this comment

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

expect page to display the new comment in the right format block (not in the input field).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We already had a test to ensure the new comment is displayed on the page. This test was to ensure the comment was added to the database.

Now, we combine them into one test with multiple assertions.

@@ -52,27 +52,36 @@
fill_in author_field, with: comment.author
fill_in text_field, with: comment.text
Copy link
Member

Choose a reason for hiding this comment

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

make sure the text is some unique value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When this test runs, we have a fresh database.

sleep(1)

# This will ensure we wait enough for the changes to be applied
expect(page).to have_text("")
Copy link
Member

Choose a reason for hiding this comment

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

expect page to display the new comment in the right format block (not in the input field).

sleep(1)

# This will ensure we wait enough for the changes to be applied
expect(page).to have_text("")
Copy link
Member

Choose a reason for hiding this comment

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

image

@justin808
Copy link
Member

@ahangarha see my changes.

@justin808 justin808 merged commit 0c254ee into master Jan 5, 2024
3 checks passed
@justin808 justin808 deleted the reduce-test-failures branch January 5, 2024 00:49
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.

2 participants