Write Tests - WebdriverIO Tutorial | #3
Вставка
- Опубліковано 14 жов 2024
- Support this channel by buying me a cup of coffee ☕️ -
www.buymeacoff...
#webdriverio #tests #javascript
In this video, we will begin to write our tests from scratch. We will cover different ways to access elements, learn about CSS selectors, and create our own custom selectors for our tests.
In this tutorial series, we will be building a fully functional test automation framework in JavaScript using WebdriverIO and integrate our tests with Mocha, Chai, Allure, BrowserStack, JUnit, and Jenkins.
• WebdriverIO - Tutorial...
All the code is available on Github - github.com/aut...
........................
📧 Subscribe to my mailing list for all the latest updates -
automationbro....
✒️ Check out my blogs at - automationbro.com
🚀 Enjoying my content and would like to support my work? Why not buy me a coffee! or Subscribe to this channel! 🚀
www.buymeacoff...
www.youtube.co...
Thanks for watching :)
Automation Bro
Hi All, for those of you getting errors such as 'addValue is not a function' are due to some of the changes that happened with WebdriverIO sync mode. I created a video on that explaining what the change is and what you will need to do to get your code working with latest WebdriverIO - ua-cam.com/video/Jk6giesyECA/v-deo.html
Amazing video, got my code to work for the first time. Really excited.
Would love to have a short video on creating custom CSS. Thank you.
Great to hear that!
I'll be putting a video out on commonly used selectors and how to create your own custom selector. Stay tuned.
@@sdetunicorns Awesome. Looking forward to it
Thank you very much, I really appreciate your work, this is very useful for me, God Bless you!
This is really good...thanks a lot for posting these excellent videos.
Great Thank you !!
This is really good...thanks a lot.Awsome.
Awesome teaching bro.
Thank you! Very good lesson!
Excellent Video !! Thanks
I am eagerly waiting for async method and please make the videos on mocha framework as it is required in my project
Hi Aditya, I have a full course on this already on Udemy which you can check it out, if interested. You can use the coupon linked - www.udemy.com/course/webdriverio-complete-beginner-course/?couponCode=TEST-DEC-013
Hi Dilpreet, I really appreciate the video ...Thank you! Can you please share which extensions you installed in VSC? Thank you, again.
Thank you. I am using ES6 Mocha Snippets
@@sdetunicorns Thank you for the speedy response! I owe you a coffee!
Hello Dilpreet Johal. I find your video very description as I am a new to Webdriverio. Please how do I handle 'cookies' message on website. You need to do aa video on it as there are little info of this on the web
Hi, I am glad you are liking the videos. Typically, "cookies" message on website are just like other web elements that you can accept/cancel by clicking on a button. Once you identify what kind of web element it is, you should be able to handle that accordingly.
Are you familiar with mocha-steps for test case dependencies? Can you please make a short video on it? I searched entire you-tube, no content related to it.
I have used it in the past, however, try to not use mocha-steps as your tests become dependent on each other. You should focus on your tests keeping as isolated as possible so that you can take advantage of parallelization.
@@sdetunicorns hmm.. satisfied but it has to be used. Do you have any link which can be followed for implementing mocha-steps!
If you need to have dependent tests, I'd use the suites in WebdriverIO to specify which files should run first - webdriver.io/docs/organizingsuites.html
can you open your tests in a chrome with a profile?
First of all, thank you very much for the tutorial! I have one issue. When I use function respond on ts, the error 'Property 'respond' does not exist on type 'Mock'.ts' is occur. How can I fix it?
can you please make short video on selectors
Yes I'm planning to do one some time soon
Hi, the second test case is failling for me "SearchInput.setValue is not a function" all other test cases are passing. How to fix this?
You can compare your code here to make sure you have entered all the details correctly - github.com/automationbro/webdriverio-tutorial
@@sdetunicorns I see, it was addValue instead of setValue but still gives me same TypeError message using WebDriverIO version 7.
hi i am also facing the same issue....please help
@@vinayfrommexico7350 problem is in the package.json Adding @wdio/sync dependency fixed it for me.
@@swatOP ok buddy will try it... Thanks
i have all tests passed even when they should not be passed. Do you know something about this problem?
Yes, that's because you need to use async-await for latest WebdriverIO versions to handle promises. I have covered that in detail in my course here - www.udemy.com/course/webdriverio-complete-beginner-course/?couponCode=AUG-WDIO-SALE-19
Hi! I have an issue. When I run the test, the driver doesn't open the web page.Could you help me?
what error does it give you?
@@sdetunicorns Oh, sorry for interrupted you. The web page has been opening.
I am getting SearchInput.addValue is not a function error while execuing the 2nd test case.. Its not detecting any object i belive.. I am able to open the browser and URL.
Hi, that's due to some of the latest changes that happened with WebdriverIO sync mode. I created a video recently to talk about this exact issue - ua-cam.com/video/Jk6giesyECA/v-deo.html
Essentially, you will need to install the @wdio/sync package to follow along with the videos. You can find out more about it in the video I mentioned.
Why would I pick this over Cypress?
There are many advantages to go with WebdriverIO such as cross-browser compatibility, support for both Web and Mobile, can be paired with multiple testing frameworks or assertion libraries (mocha, jasmine, cucumber), some small things such as working with multiple tabs/browser windows at the same time.
That being said, depending on what your requirement is you can compare both and decide what works best in your case.
Hi ,
In the application I work, I have to click and pick a slot from a calendar(Which is a Plugin). I have tried to click a slot using Xpath which worked fine when I tried the same thing in Java Selenium using actions class, However am not able to do the click here in Webdriver IO, I used the waits, click method, move to, Nothing worked.
Getting an "Element Intercepted exception, Other elements would receive the click".
When I read click method in web driver IO docs, they asked to handle this using "execute" command, however, I don't know how to do it. Can you help me with some inputs pls?
Hi, this typically happens when there's another item overlaying your element. Try to see if you can find that element and remove it via execute command. I've shown how to use execute command in this video - ua-cam.com/video/2hcfNWobjdM/v-deo.html. You can skip to 6:45 to see how I am using 'execute' command to show a hidden element which was not intractable. You can use it similar way to remove an overlaying element and then try to click your main element.
@@sdetunicorns Okay Thanks, I will look into the video and try if it works in my case. I will get back to you if I get stuck anywhere.
Hi,
I have tried to find the overlaying element and removed it using the below code
browser.execute(
function (value) {
return document.querySelector('.fc-slot36 td div').remove();
}, undefined
);
But still, no luck, getting the same exception. Don't know where it's going wrong.
so we can test web & app & ios ?
Yes you can
I don't see any id just a class, what should I do?
You can use class to access it then by doing '.classname'
Hi, I tried this code and I'm getting this error. can you pleas help TypeError: searchInput.setValue is not a function
did you add parentheses after setValue ? searchInput.setValue()
@@sdetunicorns searchInput.setValue('mouton'); this is what I have used
@@sdetunicorns Hi, installing the sync package fixed the issue. Thanks for the support
Yes, they have made some changes which requires to install the sync package now. Glad you figured it out
hi dilpreet i need your help
plz help me