by
4
10
11k
5
Top 1% !
Popular
Famous
Pearl of Wisdom
Tagged
Easy-to-find
Specified
Refined
Debate
OpenSource
Popularity: 383rd place

Published on:

Architecturex86_64
Extension.js
Frameworkdalekjs
LanguageJavascript
LicenseMIT_X11

Dalekjs - Simple automated web test

This snippet is a simple test for web page using Dalekjs testing tool.
Here I import functions from a 'functions' file (placed in the same dir of this file, called functions.js).

The test will execute three tests, 'Snip2code footer', 'LogOut' and 'Sign Up'.

More info about dalekjs tool here
Site: dalekjs.com
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/26014/Dalekjs---Simple-automated-web-test?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
//var S2CSettings = require('s2c_settings'); var S2Cfns = require('./s2c_functions'); var domain = "http://www.snip2code.com/" var appName = "Snip2Code" module.exports = { 'Snip2code footer': function (test) { test .open(domain) .assert.url(domain, 'URL is as expected') .assert.title().is('Snip2Code', 'It has title') .assert.exists('a[href="/Static/ToS"]', 'ToS exists') .assert.exists('a[href="/Static/Privacy"]', 'Privacy exists') .assert.exists('a[href="/Static/AboutUs"]', 'AboutUs exists') .assert.exists('a[href="mailto:info@snip2code.com"]', 'Mailto exists') .assert.exists('a[href="/Static/Downloads"]', 'Downloads exists') .assert.exists('a[href="http://blog.snip2code.com"]', 'Blog exists') .assert.exists('a[href="/Static/Docs"]', 'API exists') .done(); }, 'Logout': S2Cfns.S2CLogout.bind(S2Cfns, domain), 'Sign Up': function (test) { test .open(domain) .click('#signupBigBt') .assert.title().is('Snip2Code - Sign Up', 'Sign Up is loaded') .assert.url().to.contain(domain + 'Access/Signup', 'URL is as expected') .type('#EMail', 'email@test.com') .type('#Username', 'Pinkman') .type('#Password', 'Walt') .wait(5000) .done(); } };

Other Steps and Solutions

If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus