Skip to main content

Utilities that make it easy to quickly write and develop Odoo tests using Selenium.

Project description

Vauxoo Logo

Build Status codecov version wheel supported-versions commits-since

odoo-selenium

This package provides utilities that make it easy to quickly write and develop Odoo tests using Selenium.

Usage

Just import SeleniumCase and make your Unit Test a subclass of it. Simple as that! Here is an example that demonstrates it:

from selenium.webdriver.common.by import By

from odoo.tests import tagged

from odoo_selenium import SeleniumCase


@tagged("-at_install", "post_install")
class TestSelenium(SeleniumCase):

    def test_login_page(self):
        self.navigate("/web/login")
        email_input = self.driver.find_element(By.ID, "login")

        self.assertEqual("Email", email_input.get_attribute("placeholder"))

Development

If you wish to contribute, it is easy to set up a development environment. Being a simple library meant to be integrated with Odoo, all that is needed is to clone the source code and start hacking away. Below you can find a simple overview of the project and its structure.

Project Structure

The project is divided in three sections, the library itself, tests and the supporting Docker files to run the test suite.

src

All library code should reside inside this folder. This is the code that will be imported by users on their Odoo tests.

tests_odoo

These are Odoo modules and form part of the test suite. Because this package is meant to be used as a utility library for Odoo, testing does not really make sense without Odoo. These modules only provide tests to be run in Odoo and verify the library integrates well and does not randomly explode.

Running the Test Suite

Since an Odoo instance is required to run the test suite, the project relies on Docker to provide this instance and other required infrastructure, like a PostgreSQL server. Running on a Docker container also means the project itself is installed as users would, meaning this environment is as close to possible as the 'real world'.

To run the test suite you can simply issue the following command:

docker compose -f .docker/chrome-compose.yaml up --build --abort-on-container-exit --force-recreate

Make sure the working directory when running said command is the repository's root. Docker automatically checks for changed files so nothing needs to be performed on your part (other than running the command above), this makes testing iterative changes really easy and quick.

By default, the test suite runs against the newest Odoo version. To run the test suite with a different Odoo version it is as easy as specifying it:

ODOO_VERSION=15 docker compose -f .docker/chrome-compose.yaml up --build --abort-on-container-exit --force-recreate

The command above will run tests against Odoo 15.0. Images are tagged as: vauxoo/odoo-selenium:${ODOO_VERSION} so if you wanted to inspect the image built above, you can simply use:

docker run -it --rm --entrypoint=/bin/bash vauxoo/odoo-selenium:15

Note: If your tests fail, and you see old code being referenced, you are using an old image! That's why --force-recreate is used.

Maintainer

This project is maintained by Vauxoo.

A Latin American company that provides training, coaching, development and implementation of enterprise management systems and bases its entire operation strategy in the use of Open Source Software and its main product Odoo.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

odoo_selenium-0.1.6.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

odoo_selenium-0.1.6-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file odoo_selenium-0.1.6.tar.gz.

File metadata

  • Download URL: odoo_selenium-0.1.6.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for odoo_selenium-0.1.6.tar.gz
Algorithm Hash digest
SHA256 c1313aee29e7605aa23bf52ccc44f09b7f512e91fd83d0ed1cb318f8ca26aad1
MD5 17c582ef1bb688dc276a91b477c1b096
BLAKE2b-256 a9e794e9c32232da35be4925f82a06479333b5d9cf8b43f9636b41cbf83363ca

See more details on using hashes here.

File details

Details for the file odoo_selenium-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for odoo_selenium-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 0b7f153244eee5f82aab230eeb447a115b33c777524434222da65c37ebe1d5d2
MD5 e3e3874020d2b357eefaf5a6ecb4bfe9
BLAKE2b-256 3b9186799354f31829d479a12c756783a5e655511943e13224dd4e3c28863621

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page