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

Dataview search e2e Tests #1468

Open
wants to merge 7 commits into
base: development
Choose a base branch
from

Conversation

felabel
Copy link

@felabel felabel commented Nov 18, 2024

Wrote e2e automation tests to handle;

  • Verification data view search results for a keyword
  • Data-view search for special characters

Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you undo the changes in the Cypress env

Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you not make any changes to the env file that is outside the e2e-testing folder

Copy link
Author

Choose a reason for hiding this comment

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

reverted the changes

@@ -18,7 +18,8 @@ const DataViewLocators = {
publishPostBtn: '[data-qa="btn-publish-post"]',

postDetails: '[data-qa="post-details"]',

searchInput: '[data-qa="search-form__search-posts"]',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you refer to the previous comment about the [data-qa] attribute

Copy link
Author

Choose a reason for hiding this comment

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

done

search_and_verify_results_with_special_characters(keyword) {
const specialCharacterRegex = /^[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?`~]+$/;
if (!specialCharacterRegex.test(keyword)) {
throw new Error('Provided keyword does not contain only special characters');
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this message consistent with what is returned in the mzima application

@shakirandagire
Copy link
Collaborator

The tests seem to be failing for the last changes pushed.
https://github.com/ushahidi/platform-client-mzima/actions/runs/12054005583/job/33611020898?pr=1468
Check failing cypress tests.
should display posts with the keyword in title or description:
AssertionError: expected '\n\nfalse misinformation anonymous 2 years ago publishedvia twitter' to include 'election'
at Context.eval (webpack://new-platform-e2e-testing/./cypress/functions/DataViewFunctions/DataViewFunctions.js:42:42)

@@ -25,6 +25,32 @@ class DataViewFunctions {
.children(DataViewLocators.postItem)
.contains('Automated Title Response');
}
search_and_verify_results(keyword) {
this.click_data_view_btn();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Before searching for the keyword, could you add a post with the keyword so that the post exists that you are searching for.

Copy link
Author

Choose a reason for hiding this comment

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

do you mean to create a new post in the test block? because there are posts with the election keyword before now...

Copy link
Author

Choose a reason for hiding this comment

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

An update has been made for this, kindly review @shakirandagire

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