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

Added isVisible Missing Command (Fixes #4037) #4065

Closed

Conversation

Honey2339
Copy link

  • Create a new branch from master (e.g. features/my-new-feature or issue/123-my-bugfix);
  • If you're fixing a bug also create an issue if one doesn't exist yet;
  • If it's a new feature explain why do you think it's necessary. Please check with the maintainers beforehand to make sure it is something that we will accept. Usually we only accept new features if we feel that they will benefit the entire community;
  • Please avoid sending PRs which contain drastic or low level changes. If you are certain that the changes are needed, please discuss them beforehand and indicate what the impact will be;
  • If your change is based on existing functionality please consider refactoring first. Pull requests that duplicate code will most likely be ignored;
  • Do not include changes that are not related to the issue at hand;
  • Follow the same coding style with regards to spaces, semicolons, variable naming etc.;
  • Always add unit tests - PRs without tests are most of the times ignored.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@Honey2339
Copy link
Author

I've added the isVisible command to address issue #4037 . Please review the changes and provide your feedback. Thanks!

Copy link
Member

@garg3133 garg3133 left a comment

Choose a reason for hiding this comment

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

Writing tests to test the functionality of the code you added is important whenever you raise a PR.

There's already a PR under work for this command so we won't be merging this, but you're encouraged to learn how the tests work and then try to work on some other issue.

Comment on lines +6 to +17
* @example
* export default {
* demoTest(browser: NightwatchAPI): void {
* const result = browser.element('#main ul li a.first').isVisible();
* .assert.valueEquals('custom text');
* },
*
* async demoTestAsync(browser: NightwatchAPI): Promise<void> {
* const result = await browser.element('#main ul li a.first').isVisible();
* console.log('element text:', result);
* }
* }
Copy link
Member

Choose a reason for hiding this comment

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

If you're adding some example to JSDoc or anywhere else, it should be tested by you first by running them in one of the example test files. This example code won't work.

Copy link
Author

Choose a reason for hiding this comment

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

alrighty ill take care of this in future

Comment on lines +19 to +26
* @since 3.0.0
* @method isVisible
* @memberof ScopedWebElement
* @instance
* @syntax browser.element(selector).isVisible()
* @see https://www.w3.org/TR/webdriver#dfn-get-element-text
* @returns {ScopedValue<string>}
* @alias isDisplayed
Copy link
Member

Choose a reason for hiding this comment

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

This needs to be updated as well.

Comment on lines +549 to +554
async isVisibleElement(id) {
const element = await this.getWebElement(id);
const elementVisible = await element.isDisplayed();

return elementVisible;
},
Copy link
Member

Choose a reason for hiding this comment

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

We don't need to create this again, there's already a isElementDisplayed method which does the same.

Copy link
Author

Choose a reason for hiding this comment

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

Oh i didnt notice isElementDisplayed because i was taking reference from getText()

@Honey2339
Copy link
Author

Thank you for the feedback and guidance regarding writing tests for the code I added. I will make sure to include all the changes in future which u have mentioned in the comments above

@Honey2339 Honey2339 closed this Mar 5, 2024
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.

None yet

3 participants