-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Getting started writing tests for Etherpad Lite
We have partnered with SauceLabs to provide onDemand testing for Etherpad Lite.
Checkout the latest develop
git clone https://github.com/ether/etherpad-lite.git
cd etherpad-lite
git checkout feature/testing
bin/installDeps.sh
cp config.tmp.js config.js
Edit config.js
Add your saucelabs username/key (If you need one then please get in touch and we will provide you with one)
To run all of the tests across all browsers:
node runner.js
To run one tests across all browsers:
node runner.js --spec=makeTextBold.js
To run one test in one browser:
node runner.js --spec=makeTextBold.js --browser=firefox
To get help / instructions:
node runner.js --help
We provide a sendkeys helper library for doing some operations but this is limited and sometimes you want to send keypresses using a jQuery trigger event.
An example of making the whole first line bold is this
//get the first text element out of the inner iframe
var $firstTextElement = inner$("div").first();
//select this text element
$firstTextElement.sendkeys('{selectall}');
var e = inner$.Event("keydown"); // define the event
e.ctrlKey = true; // Set the Control Key
e.which = 66; // Set the keyCode of 66 which is Character "B"
inner$("#innerdocbody").trigger(e); // trigger the event
Another way is to interact use the sendKeys library IE
//get the first text element out of the inner iframe
var $firstTextElement = inner$("div").first();
//select this text element
$firstTextElement.sendkeys('{selectall}');
//replace the first line with hello world
$firstTextElement.sendkeys('hello world');
Sendkeys can't do complex events such as Control Z but it is more readable for passing strings such as "Hello world"
To run the backend tests
cd src
then npm test
To run an individual test
npx mocha tests/backend/specs/api/chat.js
Or if you have mocha installed globally
mocha tests/backend/specs/api/chat.js
- Docs
- Translating
- HTTP API
- Plugin framework (API hooks)
- Plugins (available)
- Plugins (list)
- Plugins (wishlist)
- Etherpad URIs / URLs to specific resources IE export
- Etherpad Full data export
- Introduction to the source
- Release Procedure
- Etherpad Developer guidelines
- Project to-do list
- Changeset Library documentation
- Alternative Etherpad-Clients
- Contribution guidelines
- Installing Etherpad
- Deploying Etherpad as a service
- Deploying Etherpad on CloudFoundry
- Deploying Etherpad on Heroku
- Running Etherpad on Phusion Passenger
- Putting Etherpad behind a reverse Proxy (HTTPS/SSL)
- How to setup Etherpad on Ubuntu 12.04 using Ansible
- Migrating from old Etherpad to Etherpad
- Using Etherpad with MySQL
- Customizing the Etherpad web interface
- Enable import/export functionality with AbiWord
- Getting a list of all pads
- Providing encrypted web access to Etherpad using SSL certificates
- Optimizing Etherpad performance including faster page loads
- Getting to know the tools and scripts in the Etherpad /bin/ folder
- Embedding a pad using the jQuery plugin
- Using Embed Parameters
- Integrating Etherpad in a third party app (Drupal, MediaWiki, WordPress, Atlassian, PmWiki)
- HTTP API client libraries