Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.
44

Well, apart from the obvious answer like "QA engineer should learn JavaScript to be able to use TA frameworks which work with JavaScript" I would say that a QA engineer should learn JS because knowing even basic aspects of how JS works or how it is applied to Web development brings you to a new level of defect hunting. Knowing basics of JS will let you: ...


14

One of the reasons would be to write end-to-end automated tests using Protractor. Protractor is an end-to-end test framework for Angular and AngularJS applications, where you write tests in javascript. It is designed to work better with angular applications better than pure Selenium. Additionally, knowledge of a programming language used in a project may be ...


11

The more you learn about the technologies your developers use, the better you will be at your job, and the more valuable you will be. In other words, even if you never write a line a JavaScript for your job, you will still be in a better position to test someone else’s JavaScript.


10

Please use below code. driver.get("http://www.flipkart.com/"); driver.manage().window().maximize(); driver.findElement(By.linkText("Trimmer")).click(); WebElement scroll = driver.findElement(By.id("brand")); scroll.sendKeys(Keys.PAGE_DOWN);


10

To answer your questions: 1: What is the use of JavaScript for QA? UI Testing of web pages, when the UI is written using JS-based UI front-end frameworks like Angular and friends as is the current standard (there are many: Short and Brutal Lifecycle of JavaScript Frameworks) 2: If JavaScript is used for testing, what kind of things are tested using ...


9

Here is a script which loads jQuery through WebDriver. I've been using it successfully for quite some time. Features: -- will not overwrite any existing jQuery instance. -- will not alter the DOM under test or pollute the global namespace -- cleans up after itself to avoid memory leaks -- waits for jQuery to be fully loaded before returning. -- takes an ...


9

See, you can learn Selenium with any language, whether it is C#, Java, Ruby, Python etc. It doesn't matter whether the application you are going to test has been developed in the same language that you would use to write your test scripts, you can test an application developed using C# in Selenium with test scripts written in Java. In addition to that, you ...


6

I am assuming that you: want to become competent programmer, with goal to learn programming beyond Selenium automation. have nobody around to ask for guidance (if you do, ask locally) also want to be able to write simple tools supporting QA tasks, and beyond. Python is widely considered as best language for beginners (MIT among others). It works much ...


6

There are much better ways to locate the element aside from using XPath, don't focus on XPath too much - this is, generally speaking, the slowest and the least readable way to locate elements. I would locate the element by the link text instead, example in Protractor/WebDriverJS: element(by.linkText("Sign Out")).click(); Example in Java: driver....


6

I discovered the following points while speeding up my protractor(selenium) tests: Run tests in a headless browser(from version 59, chrome can be run headless natively) Run tests as direct connection(directConnect: true) Don't log off & reuse user session between tests with the same base state(Home Page) wherever possible. Make short & simple to ...


6

I think the basic question should be "Why a software QA engineer should learn programming". Which programming language to learn is not important, it can always change. As a QA Engineer, you can work on projects from several platforms (web frontend, web backend, mobile, desktop, IoT devices etc). A QA Engineer could be required to: perform only manual ...


5

In terms of UI automation, neither Javascript or jquery are used much at all. I don't know of any tools that allow you to write UI automation in Javascript, although I bet if you looked you could find some. Javascript and jquery are useful for unit testing or more advanced integration testing, but that doesn't sound like exactly what you were asking for. ...


5

I recommend you try TestCafe. It is a web testing framework, using which you can run tests on remote computers and mobile devices, in multiple browsers and on multiple machines simultaneously. It also eliminates out of process browser plug-ins and provides wrapper-free access to DOM via jQuery or a browser's API. The built-in traffic analysis tool ...


5

Yes - For Unit Testing Javascript I've been working with this concept over the last few years and I've come to the following, multi-tier approach: Unit testing on the backend. For example with Ruby or Java on the server code. User acceptance testing on the UI using Selenium and a programming language such as Ruby with Capybara Unit testing on the front ...


5

The nice thing of TypeScript you do not have to migrate at once. TypeScript is a superset and can parse plain JavaScript as well. You can keep your old code and start using TypeScript for new code or just some features. Read this story about gradually switching at Slack: One of the reasons why the Slack team chose TypeScript is its being a superset of ...


5

A few things to consider come to mind: Only run in Chrome Controversial huh? Let me explain more fully though. My question for multi-browser and indeed multi-device (responsive web sites) testing is always what kind of browser / device specific issues have we seen and do we expect to see? How many browser specific errors have occurred in the last year. ...


4

Selenium is not designed to play in this way. Still on Selenium you can run your own JavaScript functions. In this case you can try override function which you want to disable (e.g. function functionWhichYouWantToBeDisabled(){return null;}). In this way it not be disabled but removed/changed functionality temporally. All what I say is more in theory level, I ...


4

I haven't tested this, but in theory it should work. You can use javascript like this to load new js files into memory: var scriptElt = document.createElement('script'); scriptElt.type = 'text/javascript'; scriptElt.src = jsFile; document.getElementsByTagName('head')[0].appendChild(scriptElt); You would need to load all of the jquery javascript libraries ...


4

I use PhantomJS to regression test the look and layout of Web Pages, it is written in Javascript. You might also want to look into CasperJS, PhantomCSS and dpxdt (developed by some testers at Google) which are all related. TestComplete generates code in JScript (equivalent to JavaScript), which is a pretty powerful functional testing tool. As mentioned ...


4

You need to tell it to return the value. Change this line: String mainURL = (String) js.executeScript("productObj.mainURL"); to: String mainURL = (String) js.executeScript("return productObj.mainURL");


4

Given that there is disagreement, the answers this question attracts will probably gravitate toward sometimes rather than yes/no. My opinion is that page objects should have assertions in their constructors, so that my code doesn't offer page methods for a page I never reached. In a made up example, I don't want to return an account page object when I've ...


4

There are two sides of your question which I am interpreting (and may be I am wrong), but this is how I see it : You can choose your language based on the ease of learning. You can choose your language based on the support for that particular implementation. Let's talk about first- I have used both Python and Java implementations and I agree with Peter, ...


4

If your edit class is unique on the page, then you can do .edit If you need to be a bit more specific, you could do more along the lines of .active.editing input.edit The point is, theres no "right" answer here, there are often many different css selectors you can build that can point to the same element. You want to find the balance between being short, ...


4

We have recently started with writing WebDriver tests in JavaScript and I have to agree that the asynchronous execution is adding an unneeded complexity. Pro's: Same test-runner as other (front-end) unit-tests Everyone knows JavaScript (e.g. front-end development with Angular, Vue or React) If you use JavaScript (e.g. NodeJS) also on the back-end, sticking ...


4

As you mention, the asynchronous chaining API seen in "selenium-webdriver" NPM package and also in nightwatch, protractor, testcafe, cypress, intern and wd.js etc can be quite hard to understand. Luckily there is a way to write E2E tests in Node and still get an API that feels intuitive and synchronous, namely http://webdriver.io Webdriver.io is able to do ...


4

What parameters would you consider to determine if a CSS selector is resistant to a change? What makes a reliable CSS locator? Some factors I would consider: To start with, the basics are: Locator should not include page layout structure Don't base selector on the actual page text Work within your existing framework(s) Prefer css over xpath for ...


4

NO. I would not suggest doing so until you have a specific objective to be met by doing it. In my opinion, its only worth the effort if you are working on large development project but for comparatively smaller UI automation projects with less than 1K tests, I would not suggest so. Also, there are a lot of misconceptions about the advantages of moving ...


4

TL;DR: convenience of programmers not the only deciding factor when selecting the implementation language. Promises are necessary when programming page events and response to asynchronous AJAX calls. But for browser automation testing (which is supposed to mimic user's interaction with a page), they are not necessary at all. User usually initiates an ...


4

With the popularity of JS Frameworks like Angular, React, Nodejs, there has been a surge in the testing frameworks using JS- be it an E2E framework like Protractor, Nightwatch, Cypress or API testing frameworks like Chakram etc. I agree with Peter's answer and I think it puts a lot of valid points. A frequent argument for the surge of these JS frameworks ...


4

I would expect directly referencing it by a few milliseconds. However premature optimization ('efficiency, performance') without a clear issue to address will 'fix' the wrong problem and lead to less readable and maintainable code, which is more important. So 'faster today' will quickly lead to 'but slower 'tomorrow' (i.e. the next time a change is needed) ...


Only top voted, non community-wiki answers of a minimum length are eligible