Giter Club home page Giter Club logo

rocketchat-tests-based-on-splinter's Introduction

rocketchat-tests-based-on-splinter

A set of Splinter-based tests of Rocket.Chat and some Hubot scripts.

Features

The set of tests includes:

Prerequisites

Some of the general Rocket.Chat tests are related to the clipboard, so install xclip. On Debian or Ubuntu:

$ sudo apt-get install xclip

On Fedora:

$ sudo dnf install xclip

Installation

Docker

Clone the git repository and build the Docker image:

git clone https://github.com/tolstoyevsky/rocketchat-tests-based-on-splinter.git
cd  rocketchat-tests-based-on-splinter/docker
make

Manual

Clone the git repository and install the dependencies:

git clone https://github.com/tolstoyevsky/rocketchat-tests-based-on-splinter.git
cd  rocketchat-tests-based-on-splinter
pip3 install -r requirements.txt

Getting started

You have the following options:

  • run only the general Rocket.Chat tests;
  • run the general Rocket.Chat tests with either all the available Hubot scripts tests (see Features) or only with specified ones.

To run only the general Rocket.Chat tests, go to the root of the project and execute

./run_tests.sh -s rc

To run the general Rocket.Chat tests with all the available Hubot scripts, execute

./run_tests.sh -s all

To specify a particular Hubot script test, play with the -s option. In the following example the general Rocket.Chat tests will be run only with the hubot-happy-birthder tests.

./run_tests.sh -s happy_birthder_script

Note, that the name of the target test is the name of its Python module without the _tests.py prefix.

To run all the available tests in the Docker container, execute

./run_tests_in_container.sh

To see only the logs related to the tests, execute

./run_tests_in_container.sh logs

In comparison with run_tests.sh all the magic in run_tests_in_container.sh is done not via the command line, but via the docker/docker-compose.yml file. So, in order to specify a particular Hubot script test and run it in the Docker container, edit the command parameter. Under the hood the value of the parameter will be passed to run_tests.sh, so have a look at the examples above.

When the tests are done or you simply want them to be interrupted, execute

./run_tests_in_container.sh down

Configuration

The tests can be configured via the following environment variables (called parameters) which can be passed via either the env program or the .env file.

All the parameters mentioned below are mandatory, so don't forget to provide the values for the parameters which don't have default values.

Parameter Description Default
Rocket.Chat
ADDR Domain or IP of the Rocket.Chat host. 127.0.0.1
BOT_NAME Name that will be used as a bot name (for Docker container only). meeseeks
PORT Port the Rocket.Chat server listens on. 8006
USERNAME Username of an administrator on the server.
PASSWORD Password of an administrator on the server.
PYTHON Python interpreter which will be used for running the tests. python3
RUNNING_WAIT Number of seconds that tests will be waiting for the bot running (for Docker container only). 120
hubot-pugme
PUGS_LIMIT Maximum number of pugs. 5
hubot-happy-birthder
WAIT Amount in second which test script is waiting for hubot reaction. 100

Note that the tests are very sensible to:

  • the condition of the database. It's recommended to have as compact database as possible to run the Hubot scripts.
  • the local configuration of the Hubot scripts you want to test and especially to the timers. We provide some recommended configuration of them to make the tests run:
Parameter Recommended value
hubot-happy-birthder
Ensure that the most of the hubot-happy-birthder parameters are set to default values. See the description for all the parameters related to the script in its original README.
HAPPY_REMINDER_SCHEDULER /1 * * * * *
CREATE_BIRTHDAY_CHANNELS true
hubot-viva-las-vegas
Ensure that the most of the hubot-viva-las-vegas parameters are set to default values. See the description for all the parameters related to the script in its original README.
VIVA_REMINDER_SCHEDULER /1 * * * * *

Authors

See AUTHORS.

Licensing

rocketchat-tests-based-on-splinter is available under the Apache License, Version 2.0.

rocketchat-tests-based-on-splinter's People

Contributors

abslord avatar eugulixes avatar imrandeveloper avatar polina-popova avatar sergei-vb avatar ya7on avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rocketchat-tests-based-on-splinter's Issues

Improve general Rocket.Chat tests

Improve general Rocket.Chat tests:

  • use check_with_retries function instead of waiting for a specified amount of time,
  • use API call where it is needed,
  • transform _delete_channels to be a proper test case, use an API call to clean up environment instead.

Set up Travis CI for pylint

  • base.py
  • happy_birthder_script_tests.py
  • pugme_script_tests.py
  • rc_tests.py
  • viva_las_vegas_script_tests.py
  • vote_or_die_script_tests.py
  • docker/is_bot_online.py
  • docker/wizard.py

Provide the clean up at the tests end

Write a method which will finalize the tests scenario (even interrupted by user) and delete all artifacts created by the tests (users, channels and so on).

Getting error when run `./run_tests.sh`

traceback:

Running login... success
Running test_check_version... success
Running choose_general_channel... success
Running test_pasting_string_from_clipboard... success
Running test_pasting_file_from_clipboard... Traceback (most recent call last):
  File "rc_tests.py", line 153, in <module>
    main()
  File "rc_tests.py", line 149, in main
    test_cases.run()
  File "/home/sergei/projects/rocketchat-tests-based-on-splinter/base.py", line 103, in run
    method()
  File "rc_tests.py", line 72, in test_pasting_file_from_clipboard
    self._copy_image_to_clipboard()
  File "rc_tests.py", line 53, in _copy_image_to_clipboard
    self.choose_general_channel()
  File "/home/sergei/projects/rocketchat-tests-based-on-splinter/base.py", line 193, in choose_general_channel
    general_channel[0].click()
  File "/home/sergei/projects/rocketchat-tests-based-on-splinter/venv/lib/python3.5/site-packages/selenium/webdriver/remote/webelement.py", line 80, in click
    self._execute(Command.CLICK_ELEMENT)
  File "/home/sergei/projects/rocketchat-tests-based-on-splinter/venv/lib/python3.5/site-packages/selenium/webdriver/remote/webelement.py", line 633, in _execute
    return self._parent.execute(command, params)
  File "/home/sergei/projects/rocketchat-tests-based-on-splinter/venv/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/home/sergei/projects/rocketchat-tests-based-on-splinter/venv/lib/python3.5/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Element <div class="sidebar-item__ellipsis">...</div> is not clickable at point (100, 112). Other element would receive the click: <div class="rc-modal-wrapper">...</div>
  (Session info: chrome=70.0.3538.77)
  (Driver info: chromedriver=2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7),platform=Linux 4.15.0-36-generic x86_64)

Test case for changing Accepted Media Types

The test case should simulate the following behaviour. The admin changes the value in the Accepted Media Types field, closes the administration panel, opens it again and checks that the value in the Accepted Media Types field hasn't been changed. It seems to be a bug.

Stop all tests by pressing Ctrl+C

Now when the user presses Ctrl+C, the current tests stop and the next ones start, resulting in the need for pressing Ctrl+C one more time.

hubot-vote-or-die: test case for emojis

hubot-vote-or-die allows building emojis-based polls, so there should be a test case which compares the numbers of options and the number of emojis related to them.

Expand viva_las_vegas tests

Expand viva_las_vegas tests:

  • test command список заявок
  • test command @username хочет в отпуск
  • test command viva reset
  • test daily reminder
  • test reminders to inform customer before leaving
  • test filtering of inactive users
  • test resetting user status after coming back from vacation and if it is impossible to ask for the second leave request

Part of these tests cases is required for the implementation of issue #68 (for test cases where multiple users are in use).

Check all requirements for all scripts before running some tests

I guess in general it is better to check all requirements for all scripts before running the tests. In other case I need to wait again for running all general RochetChat test to get the info that it is lack of some mandatory parameters for birthder tests (which is not mentioned in README).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.