<commit_before>edx-e2e-tests
=============

End-to-end tests for edX applications.

Overview
--------

UI-level tests for edX applications:

- ``pages``: PageObjects for interacting with pages under test.
- ``e2e_test``: Bokchoy tests for the Learning Management System (LMS) and Studio.


Installation
------------

We recommend using the provided Vagrant environment to develop and run tests.

1. `Install Vagrant <http://docs.vagrantup.com/v2/installation/index.html>`_


2. In the `edx-e2e-tests` directory, execute this command:

.. code:: bash

    vagrant up

3. This will create and provision a new Vagrant environment.

4. Enter a terminal session in the virtual environment with:

.. code:: bash

    vagrant ssh


You will also need a deployed installation of edX lms and studio to run the tests against.
See `edx/configuration <http://github.com/edx/configuration>`_ for instructions on provisioning an edX instance.



Configuration
-------------

1. Before running the commands change your working directory to `edx-e2e-tests`. Note that
   the 'e2e' python virtual environment will automatically be activated.

.. code:: bash

    cd edx-e2e-tests/

2. Update the base python requirements in case they have changed
   since you created the vagrant environment:

.. code:: bash

    pip install -r requirements/base.txt

3. OPTIONAL: Cloning the edx-platform repo into a mounted directory in a vagrant environment
   can take a long time (several minutes). An alternative is to navigate to the lib directory
   back on your host system and clone the edx-platform repo there before proceeding.

4. Install the page objects for the application from the edx platform repo. This will
   clone the entire repo into lib/edx-platform so that it can use the page objects and
   helper methods from common/test/acceptance. We also install capa and xmodule into the
   virtual environment from common/lib.


.. code:: bash

    paver install_pages


Running Tests Locally
---------------------
Make sure you are in the correct folder.

.. code:: bash

    cd $HOME/edx-e2e-tests


To run the tests locally, following environmental variables needs to be changed before running tests.

.. code:: bash

    ==> BASIC_AUTH_USER
    ==> BASIC_AUTH_PASSWORD
    ==> USER_LOGIN_EMAIL
    ==> USER_LOGIN_PASSWORD


To run all the tests:

.. code:: bash

    paver e2e_test


The commands also accept nose-style specifiers for test case or module:

To run all the tests in the file:

.. code:: bash

    paver e2e_test lms/test_dashboard.py

To run all the tests in a particular class:

.. code:: bash

    paver e2e_test lms/test_dashboard.py:DashboardTest

To run a single test:

.. code:: bash

    paver e2e_test lms/test_dashboard.py:DashboardTest.test_resume_course


To update page objects installed from external repos:

.. code:: bash

    paver install_pages


License
-------

The code in this repository is licensed under version 3 of the AGPL unless
otherwise noted.
<commit_msg>documentation on how to change target environment<commit_after>edx-e2e-tests
=============

End-to-end tests for edX applications.

Overview
--------

UI-level tests for edX applications:

- ``pages``: PageObjects for interacting with pages under test.
- ``e2e_test``: Bokchoy tests for the Learning Management System (LMS) and Studio.


Installation
------------

We recommend using the provided Vagrant environment to develop and run tests.

1. `Install Vagrant <http://docs.vagrantup.com/v2/installation/index.html>`_


2. In the `edx-e2e-tests` directory, execute this command:

.. code:: bash

    vagrant up

3. This will create and provision a new Vagrant environment.

4. Enter a terminal session in the virtual environment with:

.. code:: bash

    vagrant ssh


You will also need a deployed installation of edX lms and studio to run the tests against.
See `edx/configuration <http://github.com/edx/configuration>`_ for instructions on provisioning an edX instance.



Configuration
-------------

1. Before running the commands change your working directory to `edx-e2e-tests`. Note that
   the 'e2e' python virtual environment will automatically be activated.

.. code:: bash

    cd edx-e2e-tests/

2. Update the base python requirements in case they have changed
   since you created the vagrant environment:

.. code:: bash

    pip install -r requirements/base.txt

3. OPTIONAL: Cloning the edx-platform repo into a mounted directory in a vagrant environment
   can take a long time (several minutes). An alternative is to navigate to the lib directory
   back on your host system and clone the edx-platform repo there before proceeding.

4. Install the page objects for the application from the edx platform repo. This will
   clone the entire repo into lib/edx-platform so that it can use the page objects and
   helper methods from common/test/acceptance. We also install capa and xmodule into the
   virtual environment from common/lib.


.. code:: bash

    paver install_pages


How to run tests?
---------------------
Make sure you are in the correct folder.

.. code:: bash

    cd $HOME/edx-e2e-tests

Before running tests, please ensure that following environment variables are set.

.. code:: bash

    ==> BASIC_AUTH_USER
    ==> BASIC_AUTH_PASSWORD
    ==> USER_LOGIN_EMAIL
    ==> USER_LOGIN_PASSWORD


To run all the tests:

.. code:: bash

    paver e2e_test


The commands also accept nose-style specifiers for test case or module:

To run all the tests in the file:

.. code:: bash

    paver e2e_test lms/test_dashboard.py

To run all the tests in a particular class:

.. code:: bash

    paver e2e_test lms/test_dashboard.py:DashboardTest

To run a single test:

.. code:: bash

    paver e2e_test lms/test_dashboard.py:DashboardTest.test_resume_course


To update page objects installed from external repos:

.. code:: bash

    paver install_pages


How to change target environment?
-------

Studio and LMS urls for stage are ``https://studio.stage.edx.org``
and ``https://courses.stage.edx.org`` respectively. We don't need to
do anything extra to run tests on the stage. By default, all tests
run on the stage.

If we want to change this behaviour then we would need to set
environment variables to point to our desired environment.
To be specific, we would need to set

1. For studio, ``STUDIO_BASE_URL`` which defaults to ``studio.stage.edx.org`` and

2. For LMS, ``LMS_BASE_URL`` which defaults to ``courses.stage.edx.org``.

Lets say we want to run tests on a sandbox which has studio and LMS urls as ``https://studio.sandbox.edx.org``
and ``https://lms.sandbox.edx.org`` respectively. To let repo know, set environment variables as

.. code:: bash

    export STUDIO_BASE_URL=studio.sandbox.edx.org
    export LMS_BASE_URL=lms.sandbox.edx.org

To run tests back on stage, unset the above set environment variables.

.. code:: bash

    unset STUDIO_BASE_URL
    unset LMS_BASE_URL


License
-------

The code in this repository is licensed under version 3 of the AGPL unless
otherwise noted.

{'fraction_non_alphanumeric': 0.08781668089951608, 'fraction_numerical': 0.0062624537432393965, 'mean_word_length': 3.321648216482165, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4382850', 'n_tokens_mistral': 2108, 'n_tokens_neox': 2027, 'n_words': 891}