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
Adding Webhooks selenium tests #2911
Conversation
The Java checkstyle failed. Please run You can install the pre-commit hooks with |
public class Webhooks { | ||
WebDriver webDriver; | ||
|
||
public Webhooks(WebDriver webDriver) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use lombok RequiredArgsConstructor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated lombok @requiredargsconstructor
Events.sendKeys(webDriver, webhooks.getEndpoint(), "test.com"); | ||
Events.click(webDriver, webhooks.getSaveWebhook()); | ||
WebElement errorMessage = webDriver.findElement(common.errorMessage()); | ||
if (errorMessage.isDisplayed()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the test fail if error message is not displayed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test is to check if error message is displayed on sending blank endpoint or blank name. Should I surround the error message with try catch block and throw exception if no such element exists?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We expect errorMessage to be displayed.
So the test would be:
if(errorMessae.IsDisplayed()) {
Assert.assertEquals(errorMessage.getText(), "Webhook event filters are required.");
} else {
Assert.fail("Expected error message to be displayed")
}
This way it tests that error message is displayed and when it does the message is correct. All other cases it should fail.
In the current implementation it tests if error message is correct only if it is displayed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can simplify this further...
Assert.true(errorMessae.IsDisplayed());
Assert.assertEquals(errorMessage.getText(), "Webhook event filters are required.");
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay,I will make the changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kshinde2512 We should avoid conditions in E2E tests when we are expecting some particular behaviour to occur. This applies for positive as well as negative test cases.
PS: @mithmatt correct me if I have misjudged.
The Java checkstyle failed. Please run You can install the pre-commit hooks with |
[catalog] Kudos, SonarCloud Quality Gate passed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding these tests and incorporating review feedback
Describe your changes :
I worked on the adding selenium tests for Webhooks page
Type of change :
Checklist:
Reviewers
@darth-coder00 @shahsank3t