Commit Graph

56 Commits

Author SHA1 Message Date
Vishnu Ks 1f250a3fd2 casper: Add support for exporting results as XUnit XML file. 2019-07-07 22:30:01 -07:00
Wyatt Hoodes a238795823 run_casper: Add error output regarding Casper artifacts in CircleCI. 2019-07-03 14:58:48 -07:00
Puneeth Chaganti 3cab98169b casper: Fix link to casper Zulip docs. 2019-06-26 16:15:08 -07:00
Puneeth Chaganti 9c33261728 casper: Add a verbose flag to run casper tests in verbose mode. 2019-06-26 16:15:08 -07:00
Aman Agrawal b2b49089fd tools: Extract get_provisioning_status check logic.
Move get_provisioning_status check logic into
assert_provisioning_status_ok and use it instead of duplicating the
check code.
2019-06-23 21:55:02 -07:00
Tim Abbott e6cb83b6e9 docs: Add a new heading section on Casper debugging.
Also enhance the error output from the casper tool.
2019-06-16 22:20:41 -07:00
Anders Kaseorg 9a99d76296 tools: Remove pointless uses of shell=True.
Which, not coincidentally, is all of them.  Don’t use shell=True.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2018-07-30 22:39:06 -07:00
Anders Kaseorg f15cef27db frontend_tests/run-casper: Avoid shelling out for mkdir, rm.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2018-07-19 10:43:37 -07:00
Steve Howell 93d5a33f2a casper tests: Show the server output inline.
Showing the server output transparently in casper tests
will save developers headaches chasing down flakes.  It's
particularly important to see server output intermingled
with the Casper output.
2018-01-16 13:25:19 -05:00
Steve Howell 2da8e0d521 casper tests: Fix bug related to iago's credentials.
Before this change, we were pulling iago's credentials from
the wrong database, which usually was a non-issue (dev and test
are populated the same way), but which would break things if
you modified iago's credentials in dev.

Now the credentials properly come from the test database.
2018-01-05 07:53:47 -05:00
David Rosa Tamsen 7072fa5b37 docs: Reorganize developer docs to improve navigation.
This commit helps reduce clutter on the navigation sidebar.
Creates new directories and moves relevant files into them.
Modifies index.rst, symlinks, and image paths accordingly.

This commit also enables expandable/collapsible navigation items,
renames files in docs/development and docs/production,
modifies /tools/test-documentation so that it overrides a theme setting,
Also updates links to other docs, file paths in the codebase that point
to developer documents, and files that should be excluded from lint tests.

Note that this commit does not update direct links to
zulip.readthedocs.io in the codebase; those will be resolved in an
upcoming follow-up commit (it'll be easier to verify all the links
once this is merged and ReadTheDocs is updated).

Fixes #5265.
2017-11-16 09:45:08 -08:00
rht 77f32a1e0c frontend_tests: Use python 3 syntax for typing. 2017-11-04 19:57:55 -07:00
rht 2ce9e4d9a1 frontend_tests: Replace optparse with argparse.
Tweaked by tabbott to fix the command name being reported properly.
2017-09-30 09:31:06 -07:00
rht c2290b0328 Remove the rest of print_function. 2017-09-27 18:06:47 -07:00
Tim Abbott 02d931a53e tools: Fix running full-stack tests from tools/ directory.
Previously these tests required you to run them with the root of the
Zulip repository as the current working directory, just due to
sloppiness.

We clean this up, while also making the path handling more consistent
and involving less fragile code.

Fixes #4169.
2017-09-17 11:12:51 -07:00
Tim Abbott 4069b166ea run-casper: Fix a mypy annotation error. 2017-08-24 21:02:32 -07:00
Tim Abbott 0148338a05 casper: Always use REALMS_HAVE_SUBDOMAINS.
This is preparation for setting REALMS_HAVE_SUBDOMAINS to be
permanently True.
2017-08-24 20:44:37 -07:00
Greg Price a099e698e2 py3: Switch almost all shebang lines to use `python3`.
This causes `upgrade-zulip-from-git`, as well as a no-option run of
`tools/build-release-tarball`, to produce a Zulip install running
Python 3, rather than Python 2.  In particular this means that the
virtualenv we create, in which all application code runs, is Python 3.

One shebang line, on `zulip-ec2-configure-interfaces`, explicitly
keeps Python 2, and at least one external ops script, `wal-e`, also
still runs on Python 2.  See discussion on the respective previous
commits that made those explicit.  There may also be some other
third-party scripts we use, outside of this source tree and running
outside our virtualenv, that still run on Python 2.
2017-08-16 17:54:43 -07:00
Ayush Jain 518d25a0cf Disable proxy setting for test-backend and test-js-with-casper.
This fixes the fact that our test suites would have trouble connecting
to the other parts of the Zulip service when run with a proxy
configuration (e.g. trying to send requests to localhost through the
proxy!).

Thanks for Vishnu Ks for his work on this.

Fixes #971.
2017-04-18 12:35:44 -07:00
sinwar eab355b0cd tools: Create more consistent checks for venv.
This helps make the Zulip development environment somewhat more robust
to new contributors, since it will give them a nice warning if they
try running any of our development tools outside the Zulip virtualenv.

Fixes #3468.
2017-02-06 21:50:32 -08:00
Steve Howell 38f5f3a76e tests: Move logging into test_server.py for Casper. 2017-01-25 16:33:19 -08:00
Steve Howell c6b2d531ef Extract tools/lib/test_server.py
This new module abstracts the setting up of a test
server for tests to run, pulling existing code from
casper and paving the way for API tests in the future.
2017-01-16 21:12:39 -08:00
Steve Howell 29ef623ce9 Add option to skip flaky Casper tests. 2017-01-16 21:12:39 -08:00
Rafid Aslam e1ac6fbece Add --force to `tools/run-dev.py` when run `run-casper` with --force
Add `--force` option to `tools/run-dev.py` when run
`frontend_tests/run-casper` with `--force` option.
2017-01-03 11:42:53 -08:00
Umair Khan 770a899239 Django 1.10: Use single cache prefix for casper tests.
There is a change in Django 1.10 due to which whenever the password
of the user is changed the session hash changes. This change affects
us because we cache user profile objects and these cached objects need
to be refreshed. However, the signal sent by Django in which objects are
refreshed fails to refresh the cache for Tornado because it uses a
different cache prefix.

Note: Backend tests are not affected because they don't rely on Tornado.
2016-12-14 22:40:33 -08:00
Rafid Aslam e6fa4bc2fd tests: Change doc file in run-casper 'Tips for debugging'.
Change `docs/testing.rst` to `docs/testing-with-casper.md` in
'Tips for debugging' because there is no `testing.rst` file, and
remote debugging description is placed in `testing-with-casper.md`.
2016-12-03 10:45:44 -08:00
Rishi Gupta a3400a6862 casper tests: Keep var/casper/server.log till it has 100kb.
Previously, var/casper/server.log was overwritten before every run of
run-casper. This commit implements the simplest form of log rotation,
by overwriting server.log only if it has more than 100kb.
2016-11-02 22:04:16 -07:00
sonali0901 f9f0f29298 casper: Add support for passing just the test number to run a test.
Fixes #2178.
2016-11-02 21:38:42 -07:00
hackerkid b5816bf99e Don't use zulipdev.com when subdomain support is disabled. 2016-10-25 13:52:13 -07:00
Steve Howell 241b03e427 Add --force option to run-casper. 2016-10-16 14:52:15 -07:00
Steve Howell f48c5e55dc Check provisioning status in run-casper. 2016-10-16 14:52:14 -07:00
Steve Howell a845b15a54 casper: Remove then_log_out flakiness and sleep.
We were getting flakes from then_log_out() due to it
making an assert too early.  With this race condition removed,
I can run without the 0.3 sleep.
2016-10-12 22:03:55 -07:00
Tim Abbott d5f28abac7 casper: Use zulipdev.com rather than localhost consistently.
This fixes a problem where any absolute redirects in the routes
visited by the Casper tests will cause failures due to switching the
users to a "different" server where the cookies they'd received are no
longer valid.

Now, we at least consistently use the same hostname in the Casper
tests as EXTERNAL_HOST.
2016-10-11 15:54:05 -07:00
Steve Howell 0bdc9fef5c Upgrade caspersjs to version 1.1.3. (w/acrefoot)
(Most of this work was done by acrefoot in an earlier branch.
I took over the branch to fix casper tests that were broken during
the upgrade (which were fixed in a different commit).  I also
made most of the changes to run-casper.)

This also upgrades phantomjs to 2.1.7.

The huge structural change here is that we no longer vendor casperjs
or download phantomjs with our own script.  Instead, we just use
casperjs and phantomjs from npm, via package.json.

Another thing that we do now is run casperjs tests individually, so
that we don't get strange test flakes from test interactions.  (Tests
can still influence each other in terms of changing data, since we
don't yet have code to clear the test database in between tests.)

A lot of this diff is just removing files and obsolete configurations.

The main new piece is in package.json, which causes npm to install the
new version.

Also, run-casper now runs files individually, as mentioned above.

We had vendored casperjs in the past.  I didn't bring over any of our
changes.  Some of the changes were performance-related (primarily
5fd58cf249), so the upgraded version may
be slower in some instances.  (I didn't do much measurement of that,
since most of our slowness when running tests is about the setup
environment, not casper itself.)  Any bug fixes that we may have
implemented in the past were either magically fixed by changes to
casper itself or by improvements we have made in the tests themselves
over the years.

Tim tested the Casper suite on his machine and running the full Casper
test suite is faster than it was before this change (1m30 vs. 1m50),
so we're at least not regressing overall performance.
2016-10-08 12:08:43 -07:00
Tomasz Kolek dbeab6aa6f Optimize checks of test database state by moving into Python.
Previously, the generate-fixtures shell script by called into Django
multiple times in order to check whether the database was in a
reasonable state.  Since there's a lot of overhead to starting up
Django, this resulted in `test-backend` and `test-js-with-casper`
being quite slow to run a single small test (2.8s or so) even on my
very fast laptop.

We fix this is by moving the checks into a new Python library, so that
we can avoid paying the Django startup overhead 3 times unnecessarily.
The result saves about 1.2s (~40%) from the time required to run a
single backend test.

Fixes #1221.
2016-10-05 10:40:19 -07:00
Tim Abbott 9b30594bb6 run-casper: Fix buggy comments about subdomains testing. 2016-10-04 18:16:53 -07:00
hackerkid ea39fb2556 Add option for hosting each realm on its own subdomain.
This adds support for running a Zulip production server with each
realm on its own unique subdomain, e.g. https://realm_name.example.com.

This patch includes a ton of important features:
* Configuring the Zulip sesion middleware to issue cookier correctly
  for the subdomains case.
* Throwing an error if the user tries to visit an invalid subdomain.
* Runs a portion of the Casper tests with REALMS_HAVE_SUBDOMAINS
  enabled to test the subdomain signup process.
* Updating our integrations documentation to refer to the current subdomain.
* Enforces that users can only login to the subdomain of their realm
  (but does not restrict the API; that will be tightened in a future commit).

Note that toggling settings.REALMS_HAVE_SUBDOMAINS on a live server is
not supported without manual intervention (the main problem will be
adding "subdomain" values for all the existing realms).

[substantially modified by tabbott as part of merging]
2016-09-27 23:24:14 -07:00
Umair Khan 0f01aeaec9 Create failure images for casper in var/casper. 2016-09-27 09:30:18 -07:00
Tim Abbott 97e0306795 Replace localhost with 127.0.0.1 in casper tests. 2016-07-27 13:47:26 -07:00
Taranjeet Singh a131fc74f0 frontend_tests/run-casper: Move server.log to var/casper. 2016-07-25 14:39:16 -07:00
Eklavya Sharma 1820f961b3 frontend_tests/run-casper: Fix annotations. 2016-07-24 10:52:54 +05:30
Tim Abbott 175e9f1593 run-casper: Move remote_debug argument construction earlier. 2016-07-20 20:35:48 -07:00
Tim Abbott 345d7b670a run-casper: Move list of files to be run_tests arguments. 2016-07-20 20:35:48 -07:00
Tim Abbott 2187ba231e run_casper: Move run_tests into a function. 2016-07-20 20:35:47 -07:00
Tim Abbott b58e1fd5fc run-casper: Add server argument to server_is_up. 2016-07-20 20:24:43 -07:00
Tim Abbott 69a9db17d3 run_casper: Move some setup tasks later in the file. 2016-07-20 20:17:40 -07:00
Aakash Tyagi 7a9a7189ae Added help text for running single casper tests.
[formatting tweaked by tabbott]
2016-06-27 14:15:32 -07:00
Tim Abbott 2595ce4a35 Annotate frontend_tests/run-casper. 2016-06-06 13:41:44 -07:00
Tim Abbott be53c9e39e tests: Check for presence of typing in venv guard.
Since relatively few systems have the typing module, this makes the
checks for whether the user is properly running our test scripts in
the virtualenv more likely to trigger well.
2016-06-06 13:41:34 -07:00
Ernesto Vargas ffb2f9e84b lint/tests: Give nice error message for common import failures.
This should make users much more likely to be able to debug issues
where they ran Zulip outside the Vagrant environment or virtualenv.

[error messages tweaked by tabbott]
2016-06-06 13:39:26 -07:00