Automated testing of webpage - javascript

I've recently started designing websites for fun and I just started learning Javascript and HTML. I'm wondering if there's a way that I can setup some kind of script to run to simulate users using the website, i.e. clicking specific buttons. Any sort of lead would be helpful,
Thanks!

Selenium (http://www.seleniumhq.org/) is an excellent resource for browser automation. It supports multiple languages and platforms so you can code it in a language that you're comfortable with.

Related

Embedding other programs in an Electron app

I have recently begun working with JavaScript and have learned of the Electron framework. I am very interested in this framework (and the whole web technologies for desktop use concept). My programming capabilities could be best described as hobbyist. I have written a few small games and apps for my own use, and have a number of shell scripts to help me automate some of my workflow in Linux. My question is, is it possible to use an Electron app that is powered by a language other than JavaScript? For example, I have a bunch of Python scripts (and recently, some Haskell and F# ones too) to help me with my statistics, calculus, and accounting courses in school. I don't mind running a bunch of different scripts to do what I want but lately I've gotten the idea of potentially making some of them available for general distribution. But my scripts are, as I mentioned, written in several different languages, most of them functional languages and none of them in JavaScript. Is it possible to wrap these scripts into something like an Electron app? If not, does JavaScript have any features similar to a functional language? How would one go about creating a JavaScript library or framework to fullfil this need?
I am aware of platforms like SageMath and GNU Octave, but the whole point is to create something of my own.
I would appreciate any thoughts or suggestions. Thank you.
The short answer is there's no direct/easy way to do what you want.
But you have some options.
There's a Electron compiler, but it works only with Javascript based languages like TypeScript and CoffeeScript.
You can, of course, develop a local web application and communicate with your Electron UI using HTTP requests, here is an example using Python.
You can also use sockets for interprocess communication: https://www.npmjs.com/package/electron-ipc-socket
And you also has the option to just start a child process directly from your Electron Application.
Hope it helps and don't make you more confuse :)

how do i implement a google doc-like app on mobile?

I'm currently working on a project similar to google docs. Basically, it allows
multiple users to edit word documents concurently in a web browser. I've been
working extensively in pure javascript nodejs and socket.io. The web based
text editor was written from scratch using HTML5, CSS and Javascript. I handled
Operational Transformation(OT) with shareJS(server & client library that allows
realtime editing).
The challenge I'm having now is with mobile development, where I typically want
to develop for both android and iOS. I've been unsure about the right workflow and
technical decisions to make. Below is what has been going through my mind:
How do I incorporate my javascript application into a native iOS/Android app? Should
I just build an exact clone of what I have on the web from scratch? I mean build a
replica of my web implementation in iOS(Swift)/Android(Java). Of course this would mean
re-writing my text editor and OT scripts from scratch in the native language. Does that
make sense?
I know of NativeScript and phonegap. But then, when it comes to mobile, I prefer leaning
towards the native language. Is there a way to wrap my javascript into Swift/Android in
order to call my javascript functions?
Have been thinkin about this for weeks now, pondering over how to go about this. I think i need suggestions,
thoughts and advice from other frames of reference. Thanks in advance

JavaScript basics/instructional

I have just begun giving JavaScript a try on a programmer friend's suggestion (though I have used it to some extent before with websites using jQuery without fully understanding the intricacies of the language itself) and was wondering how certain features work.
Question:
What other uses of JavaScript are there aside from websites (by itself and/or with jQuery framework)? Is there a difference between making a site interactive and an actual "web app"? I've heard the term and don't know the difference.
To add to my main question:
I've read and done some tutorials on prototyping and am not sure on its actual application (since what little I've dabbled in, by making a website more interactive, I've never seen them used). Can someone link a website with extensive deep/heavy JavaScript use so I can check it out?
Gist:
In essence, what I'm trying to understand is where heavy use of JavaScript comes into play because so far, all JavaScript I've experienced is superficial.
Appreciate in advance any advice/help in this matter!
What other uses of Javascript are there aside from websites (by itself and/or with jQuery framework)?
Check out node.js. It runs JavaScript programs not intended for web use. Node offers a bunch of imports for things like file system IO, socket IO and a bunch of others. I personally use it for a WebSocket server because I don't like my alternatives.
Further, JavaScript has native support in many operating systems, including all Windows versions after and including XP (not sure about before). Windows Script Host runs .js files as JScript and these can be used to achieve things like those node can. It's a convenient way to do things batch can't.

Clientsided data-cleaning and analysis with sturts2

right now I'm trying to implement a webapp that does data cleaning and analysis and I have already a prototype written in Java. For the analysis part I tend to use WEKA (http://www.cs.waikato.ac.nz/ml/weka/). Because of performance reasons I thought it might be a good idea to let the client do most of the work. I started to learn struts2 and I have no experience using JavaScript. My questions are:
Is struts2 the right choise for this task?
Should I write a Java Applet or can it also be done by Java Script?
I don't have enough experience nor have I found a good solution searching the internet. Can you perhaps post some tutorials or websites that might help me with my questions?
If you want to do it client-side then you need to distribute an app, or use an applet. JavaScript is not Java, and you can't use the browser's JavaScript to run Weka.
If you want to do it client-side, why are you trying to implement a web app?
Struts 2 is fine, but it depends on what you're actually doing. There are many JVM-based web frameworks: Spring MVC, Grails, Play, etc. If you want to move analysis onto the client it probably doesn't matter what framework you use, but it's impossible to say from the info you've provided.

Progressive enhancement / Graceful degradation and web applications

I am building a web application that uses a lot of Javascript. Now I am wondering does it make sense to make the application work without Javascript? I can understand for normal websites that you want to make sure everybody can use it but can you say the same of complex web applications?
I checked out some big web apps and it seems some do it and some don't. For example GMail has a basic version that works without Javascript.
If you look at Google Docs it doesn't work at all without Javascript. Creating an app like GDocs without Javascript is most likely not possible.
Is that a good standard to go by: if it's impossible to fall back to a non-Javascript working applicaiton you don't do it?
It really depends on what is your project about and who is your target audience.
For projects that are rather sites/pages than applications, there should be an option to browse through with JS disabled, but it's okay if only in read-only mode. This very site (SO) is an example of that approach.
For projects that are rather applications and involve very complex UI composition and dependencies, there is probably no other alternative. For instance, ASP.NET projects won't work without JavaScript but nobody would usually complain given the powerful abstraction it brings to play.

Categories

Resources