Skip to main content

Test Storytelling for Selenium

Project description

https://github.com/lemoncheesecake/lemoncheesecake-selenium/actions/workflows/tests.yml/badge.svg https://codecov.io/gh/lemoncheesecake/lemoncheesecake-selenium/branch/master/graph/badge.svg https://img.shields.io/pypi/v/lemoncheesecake-selenium.svg https://img.shields.io/pypi/pyversions/lemoncheesecake-selenium.svg

lemoncheesecake-selenium provides logging facilities to the Selenium Python library for tests written with the lemoncheesecake test framework.

Here is a simple example of a search on https://www.python.org:

 # suites/python_org_search.py

import lemoncheesecake.api as lcc
from lemoncheesecake.matching import *
from lemoncheesecake_selenium import Selector, save_screenshot, is_in_page
from selenium import webdriver
from selenium.webdriver.common.keys import Keys

@lcc.test()
def python_org_search():
    driver = webdriver.Firefox()
    driver.implicitly_wait(10)
    driver.get("http://www.python.org")
    selector = Selector(driver)
    check_that("title", driver.title, contains_string("Python"))
    search_field = selector.by_name("q")
    search_field.clear()
    search_field.set_text("pycon")
    search_field.set_text(Keys.RETURN)
    selector.by_xpath("//h3[text()='Results']").check_element(is_in_page())
    save_screenshot(driver)
    driver.close()

We run the test:

$ lcc.py run
============================== python_org_search ==============================
 OK  1 # python_org_search.python_org_search

Statistics :
 * Duration: 10s
 * Tests: 1
 * Successes: 1 (100%)
 * Failures: 0

HTML report : file:///tmp/python_org_search/report/report.html

And here are the report details :

test result

Installation

Install through pip:

$ pip install lemoncheesecake-selenium

lemoncheesecake-selenium is compatible with Python 3.7-3.10 and Selenium 4.x.

You will also need to install a WebDriver to control your web browser.

Features

  • clicking, setting text, selecting element in a SELECT, etc..

  • checking DOM nodes

  • screenshots

Documentation

The documentation is available on https://lemoncheesecake-selenium.readthedocs.io.

Contact

Bug reports and improvement ideas are welcomed in tickets. A Google Groups forum is also available for discussions about lemoncheesecake: https://groups.google.com/forum/#!forum/lemoncheesecake.

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

lemoncheesecake-selenium-0.1.0.tar.gz (8.5 kB view details)

Uploaded Source

File details

Details for the file lemoncheesecake-selenium-0.1.0.tar.gz.

File metadata

  • Download URL: lemoncheesecake-selenium-0.1.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.26.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10

File hashes

Hashes for lemoncheesecake-selenium-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1d92c1c5ef82b667350776ed5a39f8c7894cd208c912135dc62500127323b73e
MD5 e376b4ba69a3f591e67e92dec0db0fb8
BLAKE2b-256 3ce6025dbcee2688fc42c17d0f830aa07b01b7a2c0ba1e9cc3e4e1569e597c6d

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