Skip to content

chge/tasty

Repository files navigation

Tasty

npm build windows coverage code climate

Tasty helps to test fully assembled web applications in near-production environments on real web clients by emulating real users.

npm install -g tasty

Tasty supports both multiple and single page applications (with server rendering too) and code coverage. It respects Content Security Policy and SSL/TLS.

How it works

Tasty server controls connected web clients to run your tests in runner of your choice against your application.

console

Client can emulate real user: navigate, fill forms, check page contents.

browser

  1. Add tasty.js module to your assembly or markup.
  2. Assemble and serve your application from staging server.
  3. Provide CSP directives for Tasty and use test certificates, if needed.
  4. Write tests for your preferred test framework using Tasty async tools.
  5. Run Tasty server. Open application in any of your clients.
  6. For each client Tasty will run your tests and return all output.
  7. Edit tests, Tasty will re-run them automatically, if needed.

Is Selenium server required?

No. Tasty client is intended to run inside browser environment without WebDriver.

But you'll probably need Selenium-driven clients or tools like PhantomJS, Puppeteer and SlimerJS for automation.

Why Tasty?

The main purposes are:

  1. Emulate real user experience.
  2. Support any web client without WebDriver.
  3. Keep test scripts as simple as possible.

Tasty gives you only high-level tools to help treat your application as a black box, just like real user does. Interact with text and graphics, not with heartless HTML elements. Try not to use knowledge of your application's markup, assume you're helping a real person to achieve some goals.

Similar tools

Protractor and WebdriverIO are Selenium-based end-to-end test frameworks useful for intergration testing. Also take a look at Appium, CasperJS and Selendroid.

Karma and Testee are great tools for cross-browser unit testing.

Example

Serve your application.

<html>
	<head>
		...
		<script src="//localhost:8765/tasty.js"></script>
	</head>
	<body>
		<form action="/dashboard">
			Welcome!
			<input placeholder="Username" type="text" />
			<input placeholder="Password" type="password" />
			<input value="Log in" type="submit" />
		</form>
	</body>
</html>

Write a test (this one uses Mocha).

describe('login form', function() {
	it('logs user in', function() {
		is(text('Welcome!'));
		click(text('Username'));
		type(tasty.config.username);
		click(text('Password'));
		type(tasty.config.password);
		click(text('Log in'));
		is(location('/dashboard'));

		return now();
	});
});

Run Tasty server.

tasty test.js --runner mocha --username 'John Doe' --password 'secret!'

Open your application in your client. Tasty will run the test, print all output and exit.

Documentation

Browser support

sauce labs

browser support

Building

npm run prepublish

Testing

npm test

Main tests use SlimerJS and PhantomJS. SlimerJS itself requires Firefox to be installed. PhantomJS suite requires phantomjs to be available via command prompt.

Because of tests for obsolete AppCache manifest, PhantomJS could put HTML page into persistent cache and then ignore clearMemoryCache API calls. This may require to delete cache files manually from the following locations:

  • %HOMEDRIVE%%HOMEPATH%\AppData\Local\Ofi Labs\PhantomJS
  • ~/Library/Caches/Ofi Labs/PhantomJS
  • ~/.local/share/Ofi Labs/PhantomJS/

Browser support

npm run support

Real-browser support tests are made possible by SauceLabs. Automation requires SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables, which are kindly provided by TravisCI.

Windows

windows

Everything works fine, yay!

About

Integration testing helper for web

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published