Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Merge end-to-end tests #3537

Merged
merged 298 commits into from
Oct 21, 2019
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
298 commits
Select commit Hold shift + click to select a range
edf37e3
add support for passing chrome path as env var
bwindels Jul 27, 2018
c3b7e6c
make scripts executable, running them with sh does something weird on…
bwindels Jul 27, 2018
e8f626b
exit on error
bwindels Jul 27, 2018
976f041
remove test exit, and use port we are semi-sure is free
bwindels Jul 27, 2018
5cd52e2
show browser logs on error
bwindels Jul 27, 2018
758da78
dont fail when trying to stop riot and its not running
bwindels Jul 27, 2018
29d6885
stop servers on error in run script
bwindels Jul 27, 2018
5129bb5
log all requests with their response code
bwindels Jul 27, 2018
31fcf08
only allow one riot server instance simultaneously
bwindels Jul 31, 2018
e50420d
apply config file when starting riot, not installing, so we can suppo…
bwindels Jul 27, 2018
a5c8911
output document html on error and dont make a screenshot on submit
bwindels Jul 27, 2018
d738b40
try upgrading puppeteer
bwindels Jul 30, 2018
c357a01
no need to log contents of zip files
bwindels Jul 30, 2018
9a2f309
xhr and console logs are done for all tests now, no need to do it in …
bwindels Jul 31, 2018
3876577
log when using external chrome!
bwindels Jul 31, 2018
f57628e
dont swallow riot server errors
bwindels Jul 31, 2018
97fa7e0
dont swallow synapse startup errors
bwindels Jul 31, 2018
1b01867
Merge pull request #3 from matrix-org/bwindels/ci_script
dbkr Aug 2, 2018
7c91eca
create session object to scope a user, move helper methods there
bwindels Aug 7, 2018
6b843ea
move log buffers into session, start logging implicitely
bwindels Aug 7, 2018
4c0ab11
move outputting steps to session to scope it to username
bwindels Aug 7, 2018
5fe3861
create second user and join room first user creates
bwindels Aug 7, 2018
4e7df21
move step logging to tests, DRY; put test scenario in separate file, …
bwindels Aug 7, 2018
aaa5ee1
more consistent naming on session methods
bwindels Aug 7, 2018
2a7438e
no need to double select here, might speed things up slightly
bwindels Aug 7, 2018
643af2d
run synapse on custom port so it doesn't interfere with other synapse…
bwindels Aug 7, 2018
a78c095
add support for changing the room settings
bwindels Aug 8, 2018
1fd379b
wait to receive message from other user
bwindels Aug 8, 2018
c5f064e
make receiving a bit more robust
bwindels Aug 8, 2018
73c88fe
prepare for more tests
bwindels Aug 8, 2018
dc87e2b
avoid typos
bwindels Aug 8, 2018
af0c0c0
add test scenario for e2e encryption
bwindels Aug 8, 2018
2c983f8
fix composer issue and more
bwindels Aug 9, 2018
4c3386a
Merge pull request #4 from matrix-org/bwindels/2usersjoin
bwindels Aug 14, 2018
a54f13c
Merge pull request #6 from matrix-org/bwindels/e2erooms
bwindels Aug 14, 2018
377a20f
bring indentation in line with other front-end projects
bwindels Aug 14, 2018
9566882
Merge pull request #8 from matrix-org/bwindels/indentation
dbkr Aug 14, 2018
8507cf8
add argument for passing riot server, makes local testing easier
bwindels Aug 15, 2018
0e56250
didnt mean to commit this
bwindels Aug 15, 2018
4f76ad8
increase timeout
bwindels Aug 15, 2018
26e4645
Merge pull request #10 from matrix-org/bwindels/increasetimeout
bwindels Aug 15, 2018
440b103
increase receive message timeout
bwindels Aug 15, 2018
c49f1b3
Merge pull request #11 from matrix-org/bwindels/increasetimeout2
bwindels Aug 15, 2018
1e0baa8
Merge pull request #9 from matrix-org/bwindels/commander
dbkr Aug 17, 2018
fd67ace
increase timeouts so the tests dont timeout on build server
bwindels Aug 22, 2018
f49b858
remove specific timeout for selectors
bwindels Aug 22, 2018
6be5975
dont assume new target is a new page
bwindels Aug 23, 2018
a65d6af
encryption dialogs dont always appear coming back from settings... weird
bwindels Aug 23, 2018
2321e43
commander inverts the meaning of program args by itself ... nice, I g…
bwindels Aug 23, 2018
3e8b55b
Merge pull request #12 from matrix-org/bwindels/fixbuild
dbkr Aug 23, 2018
98aafd6
add rest/non-browser session, which we can create a lot more off
bwindels Sep 11, 2018
afc678f
pass rest session creator to scenario
bwindels Sep 11, 2018
3c5e73d
support setting the display name on rest session
bwindels Sep 11, 2018
48d95c2
creator instead of factory, as it does registration and authentication
bwindels Sep 11, 2018
827e636
add wrapper around multiple rest sessions
bwindels Sep 11, 2018
4057710
Merge branch 'master' into bwindels/lltests
bwindels Sep 11, 2018
4a4b1f6
wait for the message to be sent
bwindels Sep 11, 2018
be4c1cb
support setting the room alias
bwindels Sep 11, 2018
2be413b
allow clients to send messages faster, in order to speed up the test
bwindels Sep 11, 2018
ff20bc7
support joining with a room alias for rest session
bwindels Sep 11, 2018
abc7c4c
join use cases that touch settings in one file, as selectors are similar
bwindels Sep 11, 2018
3db32c9
past rest creator to scenario to also be able to call createSessionRange
bwindels Sep 11, 2018
dcf96e1
WIP for LL test
bwindels Sep 11, 2018
244d5b0
dont show all 20 send messages
bwindels Sep 12, 2018
249cf4f
implement reading and scrolling timeline, group timeline related code
bwindels Sep 12, 2018
4057ec8
store displayName on RestSession to use it in tests
bwindels Sep 12, 2018
29aec25
finish basic LL test to see if display names appear from lazy loaded …
bwindels Sep 12, 2018
7bcb255
increase timeout here in case this wouldnt be enough for the CI server
bwindels Sep 12, 2018
e843d53
these changes were not needed in the end
bwindels Sep 12, 2018
c8fec94
structure flags better and document them
bwindels Sep 12, 2018
5745e9e
move Logger and LogBuffer to own module
bwindels Sep 12, 2018
923ae90
move range and delay over to util module
bwindels Sep 12, 2018
5ec8f6f
rename tests folder to the more accurate usecases
bwindels Sep 12, 2018
1725e75
split up scenarios in multiple files as lazy-loading scenarios grow
bwindels Sep 13, 2018
5d06c65
split up ll tests in several functions
bwindels Sep 13, 2018
239e6a4
add ll tests to check if all expected members are in memberlist
bwindels Sep 13, 2018
9f4cf77
make receiveMessage more robust by checking first if the message is n…
bwindels Sep 13, 2018
af255c6
dont assert the first time in receiveMessage, as it will show an ugly…
bwindels Sep 14, 2018
6deb595
add logging to rest session actions
bwindels Sep 14, 2018
16b2f09
Test if members joining while user is offline are received after retu…
bwindels Sep 14, 2018
58d52f9
Merge pull request #17 from matrix-org/bwindels/flagsandreadme
dbkr Sep 14, 2018
36708cc
wait for next sync before inspecting memberlist
bwindels Sep 14, 2018
992a0be
DRY usernames
bwindels Sep 14, 2018
8cff961
use develop for now as LL with gappy syncs is fixed on that branch fo…
bwindels Sep 14, 2018
5e8a3db
Merge pull request #16 from matrix-org/bwindels/lltests
bwindels Sep 14, 2018
320e39b
Merge pull request #19 from matrix-org/bwindels/lltests2
bwindels Sep 14, 2018
1906661
Merge branch 'master' into bwindels/lltests3
bwindels Sep 14, 2018
f26c50c
Merge pull request #22 from matrix-org/bwindels/lltests3
bwindels Sep 17, 2018
42c1b95
spit out logs for creating REST users to figure out what is going on …
bwindels Sep 18, 2018
3de9f6e
Merge pull request #23 from matrix-org/bwindels/restlogs
bwindels Sep 18, 2018
0d86b82
increase timeout for server notices room
bwindels Sep 18, 2018
d1d8865
Merge pull request #24 from matrix-org/bwindels/increaseservernoticet…
bwindels Sep 18, 2018
a84162e
use patched synapse so admin rest api works with python 2.7.6
bwindels Sep 18, 2018
1c85536
Merge pull request #25 from matrix-org/bwindels/fixadminapiusage
bwindels Sep 18, 2018
cf397ef
disable LL tests on travis CI
bwindels Sep 18, 2018
d47f782
Revert "increase timeout for server notices room"
bwindels Sep 18, 2018
6e97215
Merge pull request #27 from matrix-org/revert-24-bwindels/increaseser…
bwindels Sep 18, 2018
70eb480
Revert "use patched synapse so admin rest api works with python 2.7.6"
bwindels Sep 18, 2018
fec1447
Merge pull request #28 from matrix-org/revert-25-bwindels/fixadminapi…
bwindels Sep 18, 2018
13b20bb
pass parameters through instead of hardcoding --travis
bwindels Sep 19, 2018
64608af
Merge pull request #26 from matrix-org/bwindels/disablelltests
bwindels Sep 19, 2018
a637ad8
set a room alias for a public room, as required now
bwindels Sep 21, 2018
4aad156
Merge pull request #29 from matrix-org/bwindels/fixroomaliasrequirements
dbkr Sep 21, 2018
8ee7623
current tests need riot develop to set a room alias without a domain …
bwindels Sep 25, 2018
04b64db
Some changes to make the testing script run on mac, too, + a multithr…
lampholder Sep 25, 2018
861af62
Make the sed usage cross-platform compatible
lampholder Sep 27, 2018
1147508
list of tests we want to write
bwindels Sep 27, 2018
a1cd2ae
Merge pull request #31 from matrix-org/bwindels/lltestsonlyrunondevelop
dbkr Oct 1, 2018
b2bd134
add config file instructions to run with --riot-url
bwindels Oct 8, 2018
1a22546
test leaving members disappear from memberlist
bwindels Oct 9, 2018
f607cb2
Fix the registration process to handle m.login.terms auth
turt2live Nov 1, 2018
d57a56d
There is no more server notices invite on signup
turt2live Nov 2, 2018
daa9624
Merge pull request #39 from matrix-org/travis/fix-consent
bwindels Nov 5, 2018
1a0f095
Tell synapse to require consent at registration
turt2live Nov 7, 2018
2559786
Merge pull request #41 from matrix-org/travis/fix-consent-register
bwindels Nov 8, 2018
2e839d5
Click the 'Accept' button as part of the signup process
turt2live Nov 16, 2018
259d4d6
Merge pull request #42 from matrix-org/travis/fix-consent-signup
turt2live Nov 16, 2018
19c4f4a
Install jinja2
turt2live Dec 22, 2018
8f55455
Merge pull request #43 from matrix-org/travis/fix-build
turt2live Dec 29, 2018
7ac19b0
adjust synapse install script for python3 and config file changes
bwindels Mar 29, 2019
3056d93
use yarn and update dependencies, commit lock file
bwindels Mar 29, 2019
ab5a245
fix signup
bwindels Mar 29, 2019
65ca1b3
fix creating a room
bwindels Mar 29, 2019
a27b92a
fix changing the room settings
bwindels Mar 29, 2019
fe6a273
fix joining a room through the room directory
bwindels Mar 29, 2019
5598214
fix writing in composer
bwindels Mar 29, 2019
a150597
missed this when making createRoom export non-default earlier
bwindels Mar 29, 2019
2bf51da
fix enabling e2e encryption in room settings
bwindels Apr 2, 2019
ae5dc9d
fix inviting someone
bwindels Apr 2, 2019
9ab1692
fix verification, replace device id/key with SAS verification.
bwindels Apr 2, 2019
28bba49
fix detecting e2e message in timeline
bwindels Apr 2, 2019
34171ea
doing wait for /sync request to receive message, doesn't work well
bwindels Apr 2, 2019
c1312f0
fix import
bwindels Apr 2, 2019
f197e9f
lazy loading is not in labs anymore
bwindels Apr 2, 2019
450430d
remove travis flag
bwindels Apr 2, 2019
2449ddc
"disable" rate limiting for rest users
bwindels Apr 2, 2019
d63a0c5
fix gete2e info and open settings, even though not used currently
bwindels Apr 2, 2019
e147cc9
this dialog isn't shown anymore and this was accepting the SAS dialog
bwindels Apr 3, 2019
e10e4b0
nicer output, comment
bwindels Apr 3, 2019
2b2a486
forgot to add consent listener again, this will fix REST registration
bwindels Apr 3, 2019
5939d62
fix scrollpanel selector
bwindels Apr 3, 2019
3affb8f
section for creating rest users
bwindels Apr 3, 2019
240c715
Merge pull request #36 from matrix-org/bwindels/checkleavesmemberlist
bwindels Apr 3, 2019
ed772e2
Merge branch 'master' into bwindels/redesignfixes
bwindels Apr 3, 2019
9c41ccc
use shorter .bak suffix approach
bwindels Apr 3, 2019
c1464aa
Merge branch 'master' into toml/install-scripts-fail-fast
bwindels Apr 3, 2019
6852851
Merge pull request #32 from matrix-org/toml/install-scripts-fail-fast
bwindels Apr 3, 2019
2228ba8
Merge branch 'master' into bwindels/redesignfixes
bwindels Apr 3, 2019
5d4ded0
use yarn
bwindels Apr 3, 2019
146549a
keep complexhttpserver installation within riot folder and gitignore …
bwindels Apr 3, 2019
d93e6ed
use python3 to install riot webserver
bwindels Apr 3, 2019
04e06c3
PR feedback
bwindels Apr 4, 2019
58e6d1b
Merge pull request #46 from matrix-org/bwindels/redesignfixes
bwindels Apr 4, 2019
cfff4a9
install ComplexHttpServer regardless of whether riot is already insta…
bwindels Apr 5, 2019
4e1ddf8
c/p error
bwindels Apr 5, 2019
53eab47
pass --no-sandbox to puppeteer
bwindels Apr 5, 2019
7e2d35f
moar sandbox flags
bwindels Apr 5, 2019
492d810
support writing logs to file
bwindels Apr 8, 2019
bdd7191
Merge pull request #47 from matrix-org/bwindels/logstofile
bwindels Apr 8, 2019
d1df0d9
avoid ipv6, see if that makes buildkite happy
bwindels Apr 9, 2019
4591b26
show all of create rest user command output on failure
bwindels Apr 9, 2019
b88dc0f
show browser version when running tests
bwindels Apr 9, 2019
4c79e3b
better error handling when creating rest user fails
bwindels Apr 9, 2019
7fbfe31
dont assume bash when creating rest users
bwindels Apr 9, 2019
200f95b
rest users dont need to be admin
bwindels Apr 9, 2019
d978ce6
test upload artefacts on failure
bwindels Apr 9, 2019
6958fdb
write html, console and network logs to different files
bwindels Apr 9, 2019
f55a448
add screenshots to logs directory upon failure
bwindels Apr 9, 2019
b0fb36d
remove debug error
bwindels Apr 9, 2019
be32414
fix broken selector
bwindels Apr 10, 2019
b01e126
wait longer to arrive at #home but poll every 100ms
bwindels Apr 16, 2019
f489f55
increase dialog timeout a bit
bwindels Apr 16, 2019
945daf2
log messages in timeline when expected not found (debug code)
bwindels Apr 16, 2019
9610e9b
take into account continuation tiles in when checking timeline messages
bwindels Apr 16, 2019
20c3023
use session.poll as well for polling when receiving a message
bwindels Apr 16, 2019
ee46c2b
wait for opponent label to appear in sas dialog
bwindels Apr 16, 2019
ef59c59
poll these as well as ci is slowwww
bwindels Apr 16, 2019
c40f7f6
add flag to throttle cpu to get failures because of slow ci locally
bwindels Apr 16, 2019
48c1d46
remove explicit timeouts from tests for selectors
bwindels Apr 16, 2019
eae830a
update readme
bwindels Apr 16, 2019
ee1e585
remove explicit timeout for polling as well
bwindels Apr 16, 2019
bf02966
Update TODO.md
bwindels Apr 16, 2019
20d80e6
adjust selectors for join and accept button in room preview bar
bwindels Apr 17, 2019
370741f
Merge pull request #48 from matrix-org/bwindels/stylepreviewbar
bwindels Apr 18, 2019
2527995
Only install the minimum deps to pass
jryans Apr 25, 2019
1ffe0d1
Report location of Synpase log
jryans Apr 25, 2019
f82f9ec
Use a stronger password
jryans Apr 25, 2019
3e6719e
Wait for password validation
jryans Apr 25, 2019
7a15acf
install synapse/develop (and deps) from pip
bwindels Jun 24, 2019
894a074
generate signing keys without generating config file and then overwr. it
bwindels Jun 24, 2019
26f9dd0
Merge pull request #50 from matrix-org/bwindels/fixsynapseinstallation
dbkr Jun 24, 2019
d9def18
adjust path to register script for pip installation
bwindels Jun 24, 2019
c76dc87
Merge pull request #51 from matrix-org/bwindels/fixsynapseinstallation2
dbkr Jun 24, 2019
a729345
look for activate in cwd
bwindels Jun 24, 2019
6b6de05
Merge pull request #52 from matrix-org/bwindels/fixsynapseinstallation3
dbkr Jun 24, 2019
8a247e0
Bump lodash from 4.17.11 to 4.17.15
dependabot[bot] Aug 22, 2019
6414ac9
Merge pull request #54 from matrix-org/dependabot/npm_and_yarn/lodash…
turt2live Aug 22, 2019
7635e93
Adjust tests for hidden IS field
jryans Aug 28, 2019
a3abde5
Merge pull request #55 from matrix-org/jryans/hide-is-field-during-auth
jryans Aug 28, 2019
67b03b5
Fix signup: set custom hs through advanced section, and accept IS step
bwindels Sep 10, 2019
f66f5be
Adjust how room directory and create room dialog should be opened
bwindels Sep 10, 2019
b8b2ef2
Merge pull request #56 from matrix-org/bwindels/fix-signup
bwindels Sep 10, 2019
1659171
Revert "Fix signup: set custom hs through advanced section, and accep…
bwindels Sep 10, 2019
ad10148
Merge pull request #58 from matrix-org/revert-56-bwindels/fix-signup
bwindels Sep 10, 2019
e3f7246
Merge pull request #57 from matrix-org/bwindels/fix-open-directory
bwindels Sep 11, 2019
f2a3a13
find new join button in room directory
bwindels Sep 11, 2019
7be47b2
Merge pull request #59 from matrix-org/bwindels/fix-roomdirectory-join
bwindels Sep 11, 2019
a25056f
retry getting the scroll panel when retrying to get the scrolltop
bwindels Sep 13, 2019
87be5fb
try to fix selecting all text in Field components
bwindels Sep 13, 2019
c36673b
Revert "Revert "Fix signup: set custom hs through advanced section, a…
bwindels Sep 13, 2019
04f7514
Merge pull request #60 from matrix-org/bwindels/somefixes
bwindels Sep 16, 2019
5f03854
Merge pull request #61 from matrix-org/revert-58-revert-56-bwindels/f…
bwindels Sep 16, 2019
1ea5047
only need 2 clicks, not 3
bwindels Sep 16, 2019
912a974
Merge pull request #62 from matrix-org/bwindels/morecustomhsregisterfix
bwindels Sep 16, 2019
06af5b3
look for a change (HS) link in the registration but don't fail if its…
bwindels Sep 17, 2019
9694dcd
Merge pull request #63 from matrix-org/bwindels/optionalchangelink
bwindels Sep 17, 2019
03d928b
adjust create room dialog name field selector
bwindels Sep 20, 2019
7d1cb43
Merge pull request #64 from matrix-org/bwindels/createroomadjustments
bwindels Sep 23, 2019
fe1b786
unbreak tests; we no longer prompt for IS at register
ara4n Sep 23, 2019
f5b605b
unbreak tests (take 2); we no longer prompt for IS at register
ara4n Sep 23, 2019
5b71cf5
use correct css class for cider composer
bwindels Oct 4, 2019
6cb9ef7
remove editorconfig
bwindels Oct 9, 2019
ca86969
move everything to subfolder to merge into react-sdk
bwindels Oct 9, 2019
ae38e0b
Merge remote-tracking branch 'e2etests/bwindels/bigmerge' into bwinde…
bwindels Oct 9, 2019
cad7191
only run riot static server if no riot url has been provided
bwindels Oct 9, 2019
5b9bfae
first attempt at running local e2e tests from CI
bwindels Oct 9, 2019
de21cb2
Merge remote-tracking branch 'e2etests/bwindels/use-cider' into bwind…
bwindels Oct 9, 2019
59cc36c
don't fetch riot/master by default when installing e2e tests
bwindels Oct 9, 2019
f8358fa
make e2e test safe to run from anywhere
bwindels Oct 9, 2019
ebc2bba
warn if not installed yet when running e2e tests
bwindels Oct 9, 2019
3e971e4
provide yarn command to run e2e tests
bwindels Oct 9, 2019
2d848bb
fix lint
bwindels Oct 9, 2019
645a9d8
install static webserver for server symlinked riot on CI
bwindels Oct 10, 2019
6f96049
copyright
bwindels Oct 10, 2019
867739e
switch e2e tests to xlarge queue
bwindels Oct 10, 2019
4b9a29c
put exec perms back on install script
bwindels Oct 10, 2019
15bbf3a
fix the lint fix
bwindels Oct 10, 2019
d20b2ee
document how to run the e2e tests locally
bwindels Oct 10, 2019
683947e
Update test/end-to-end-tests/README.md
bwindels Oct 18, 2019
6236909
Update test/end-to-end-tests/README.md
bwindels Oct 18, 2019
8a02802
Update test/end-to-end-tests/install.sh
bwindels Oct 18, 2019
5025a0f
Update test/end-to-end-tests/README.md
bwindels Oct 18, 2019
06e69d1
Update test/end-to-end-tests/README.md
bwindels Oct 18, 2019
142a32b
Update test/end-to-end-tests/README.md
bwindels Oct 18, 2019
76c7f58
Update test/end-to-end-tests/README.md
bwindels Oct 18, 2019
15a7573
Update test/end-to-end-tests/README.md
bwindels Oct 18, 2019
e2e7303
Update README.md
bwindels Oct 18, 2019
3d15026
Update test/end-to-end-tests/run.sh
bwindels Oct 18, 2019
dca9683
Update test/end-to-end-tests/run.sh
bwindels Oct 18, 2019
b03ebb9
split up installing static webserver and riot copy
bwindels Oct 18, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .buildkite/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ steps:

- label: ":chains: End-to-End Tests"
agents:
# We use a medium sized instance instead of the normal small ones because
# We use a xlarge sized instance instead of the normal small ones because
# e2e tests otherwise take +-8min
queue: "medium"
queue: "xlarge"
command:
# TODO: Remove hacky chmod for BuildKite
- "echo '--- Setup'"
Expand Down Expand Up @@ -96,7 +96,7 @@ steps:
image: "node:10"

- wait

- label: "🐴 Trigger riot-web"
trigger: "riot-web"
branches: "develop"
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,8 @@ Ensure you've followed the above development instructions and then:
```bash
yarn test
```

## End-to-End tests

Make sure you've got your riot development server running (by doing `yarn start` in riot-web), and then in this project, run `yarn run e2etests`.
bwindels marked this conversation as resolved.
Show resolved Hide resolved
See `test/end-to-end-tests/README.md` for more information.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
"clean": "rimraf lib",
"prepare": "yarn clean && yarn build && git rev-parse HEAD > git-revision.txt",
"test": "karma start --single-run=true --browsers VectorChromeHeadless",
"test-multi": "karma start"
"test-multi": "karma start",
"e2etests": "./test/end-to-end-tests/run.sh --riot-url http://localhost:8080"
},
"dependencies": {
"babel-plugin-syntax-dynamic-import": "^6.18.0",
Expand Down
6 changes: 3 additions & 3 deletions scripts/ci/end-to-end-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ REACT_SDK_DIR=`pwd`
echo "--- Building Riot"
scripts/ci/build.sh
# run end to end tests
echo "--- Fetching end-to-end tests from master"
scripts/fetchdep.sh matrix-org matrix-react-end-to-end-tests master
pushd matrix-react-end-to-end-tests
pushd test/end-to-end-tests
ln -s $REACT_SDK_DIR/$RIOT_WEB_DIR riot/riot-web
# PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true ./install.sh
# CHROME_PATH=$(which google-chrome-stable) ./run.sh
echo "--- Install synapse & other dependencies"
./install.sh
# install (only) static webserver to server symlinked local copy of riot
./riot/install.sh --without-riot
mkdir logs
echo "+++ Running end-to-end tests"
TESTS_STARTED=1
Expand Down
3 changes: 3 additions & 0 deletions test/end-to-end-tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
*.png
riot/env
43 changes: 43 additions & 0 deletions test/end-to-end-tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Matrix React Web App End-to-End tests
bwindels marked this conversation as resolved.
Show resolved Hide resolved

This repository contains tests for the matrix-react-sdk web app. The tests fire up a headless chrome and simulate user interaction (end-to-end). Note that end-to-end has little to do with the end-to-end encryption matrix supports, just that we test the full stack, going from user interaction to expected DOM in the browser.
bwindels marked this conversation as resolved.
Show resolved Hide resolved

## Setup

Run `./install.sh`. This will:
- install synapse, fetches the master branch at the moment. If anything fails here, please refer to the synapse README to see if you're missing one of the prerequisites.
bwindels marked this conversation as resolved.
Show resolved Hide resolved
- install riot, this fetches the master branch at the moment.
bwindels marked this conversation as resolved.
Show resolved Hide resolved
- install dependencies (will download copy of chrome)

## Running the tests

Run tests with `./run.sh`.

### Debug tests locally.

`./run.sh` will run the tests against the riot copy present in `riot/riot-web` served by a static python http server. You can symlink your `riot-web` develop copy here but that doesn't work well with webpack recompiling. You can run the test runner directly and specify parameters to get more insight into a failure or run the tests against your local webpack server.
bwindels marked this conversation as resolved.
Show resolved Hide resolved

```
./synapse/stop.sh && \
./synapse/start.sh && \
node start.js <parameters>
```
It's important to always stop and start synapse before each run of the tests to clear the in-memory sqlite database it uses, as the tests assume a blank slate.
bwindels marked this conversation as resolved.
Show resolved Hide resolved

start.js accepts these parameters (and more, see `node start.js --help`) that can help running the tests locally:

- `--riot-url <url>` don't use the riot copy and static server provided by the tests, but use a running server like the webpack watch server to run the tests against. Make sure to have the following local config:
bwindels marked this conversation as resolved.
Show resolved Hide resolved
- `welcomeUserId` disabled as the tests assume there is no riot-bot currently.
- `--slow-mo` type at a human speed, useful with `--windowed`.
- `--throttle-cpu <factor>` throttle cpu in the browser by the given factor. Useful to reproduce failures because of insufficient timeouts happening on the slower CI server.
- `--windowed` run the tests in an actual browser window Try to limit interacting with the windows while the tests are running. Hovering over the window tends to fail the tests, dragging the title bar should be fine though.
- `--dev-tools` open the devtools in the browser window, only applies if `--windowed` is set as well.

Developer Guide
===============

Please follow the standard Matrix contributor's guide:
/~https://github.com/matrix-org/synapse/tree/master/CONTRIBUTING.rst

Please follow the Matrix JS/React code style as per:
/~https://github.com/matrix-org/matrix-react-sdk/blob/master/code_style.md
8 changes: 8 additions & 0 deletions test/end-to-end-tests/TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

- join a peekable room by directory
- join a peekable room by invite
- join a non-peekable room by directory
- join a non-peekable room by invite
- leave a room and check we move to the "next" room
- get kicked from a room and check that we show the correct message
- get banned "
24 changes: 24 additions & 0 deletions test/end-to-end-tests/has_custom_riot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
Copyright 2019 The Matrix.org Foundation C.I.C.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// used from run.sh as getopts doesn't support long parameters
const idx = process.argv.indexOf("--riot-url");
let hasRiotUrl = false;
if (idx !== -1) {
const value = process.argv[idx + 1];
hasRiotUrl = !!value;
}
process.stdout.write(hasRiotUrl ? "1" : "0" );
8 changes: 8 additions & 0 deletions test/end-to-end-tests/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
# run with PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true sh install.sh if chrome is already installed
set -e
./synapse/install.sh
# both CI and local testing don't need a riot fetched from master,
bwindels marked this conversation as resolved.
Show resolved Hide resolved
# so not installing this by default anymore
# ./riot/install.sh
yarn install
19 changes: 19 additions & 0 deletions test/end-to-end-tests/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "e2e-tests",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"cheerio": "^1.0.0-rc.2",
"commander": "^2.19.0",
"puppeteer": "^1.14.0",
"request": "^2.88.0",
"request-promise-native": "^1.0.7",
"uuid": "^3.3.2"
}
}
2 changes: 2 additions & 0 deletions test/end-to-end-tests/riot/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
riot-web
riot.pid
33 changes: 33 additions & 0 deletions test/end-to-end-tests/riot/config-template/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"default_hs_url": "http://localhost:5005",
"default_is_url": "https://vector.im",
"disable_custom_urls": false,
"disable_guests": false,
"disable_login_language_selector": false,
"disable_3pid_login": false,
"brand": "Riot",
"integrations_ui_url": "https://scalar.vector.im/",
"integrations_rest_url": "https://scalar.vector.im/api",
"bug_report_endpoint_url": "https://riot.im/bugreports/submit",
"features": {
"feature_groups": "labs",
"feature_pinning": "labs"
},
"default_federate": true,
"welcomePageUrl": "home.html",
"default_theme": "light",
"roomDirectory": {
"servers": [
"localhost:5005"
]
},
"piwik": {
"url": "https://piwik.riot.im/",
"whitelistedHSUrls": ["http://localhost:5005"],
"whitelistedISUrls": ["https://vector.im", "https://matrix.org"],
"siteId": 1
},
"enable_presence_by_hs_url": {
"https://matrix.org": false
}
}
45 changes: 45 additions & 0 deletions test/end-to-end-tests/riot/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash
set -e
RIOT_BRANCH=develop

with_riot=1

for i in $@; do
if [ "$i" == "--without-riot" ] ; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit perplexing to have a "Riot" install script which also takes an option "no Riot"... Maybe it would be easier to follow by moving the HTTP server bit to it's own script?

Then this script can call the new script (so caller of this don't need to change), and end-to-end-tests.sh would only call the HTTP server script.

with_riot=0
fi
done

BASE_DIR=$(cd $(dirname $0) && pwd)
cd $BASE_DIR
# Install ComplexHttpServer (a drop in replacement for Python's SimpleHttpServer
# but with support for multiple threads) into a virtualenv.
(
virtualenv -p python3 env
source env/bin/activate

# Having been bitten by pip SSL fail too many times, I don't trust the existing pip
# to be able to --upgrade itself, so grab a new one fresh from source.
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
rm get-pip.py

pip install ComplexHttpServer

deactivate
)

if [ -d $BASE_DIR/riot-web ]; then
echo "riot is already installed"
exit
fi

if [ $with_riot -eq 1 ]; then
curl -L /~https://github.com/vector-im/riot-web/archive/${RIOT_BRANCH}.zip --output riot.zip
unzip -q riot.zip
rm riot.zip
mv riot-web-${RIOT_BRANCH} riot-web
cd riot-web
yarn install
yarn run build
fi
54 changes: 54 additions & 0 deletions test/end-to-end-tests/riot/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env bash
set -e

PORT=5000
BASE_DIR=$(cd $(dirname $0) && pwd)
PIDFILE=$BASE_DIR/riot.pid
CONFIG_BACKUP=config.e2etests_backup.json

if [ -f $PIDFILE ]; then
exit
fi

cd $BASE_DIR/
echo -n "starting riot on http://localhost:$PORT ... "
pushd riot-web/webapp/ > /dev/null

# backup config file before we copy template
if [ -f config.json ]; then
mv config.json $CONFIG_BACKUP
fi
cp $BASE_DIR/config-template/config.json .

LOGFILE=$(mktemp)
# run web server in the background, showing output on error
(
source $BASE_DIR/env/bin/activate
python -m ComplexHTTPServer $PORT > $LOGFILE 2>&1 &
PID=$!
echo $PID > $PIDFILE
# wait so subshell does not exit
# otherwise sleep below would not work
wait $PID; RESULT=$?

# NOT expected SIGTERM (128 + 15)
# from stop.sh?
if [ $RESULT -ne 143 ]; then
echo "failed"
cat $LOGFILE
rm $PIDFILE 2> /dev/null
fi
rm $LOGFILE
exit $RESULT
)&
# to be able to return the exit code for immediate errors (like address already in use)
# we wait for a short amount of time in the background and exit when the first
# child process exits
sleep 0.5 &
# wait the first child process to exit (python or sleep)
wait -n; RESULT=$?
# return exit code of first child to exit
if [ $RESULT -eq 0 ]; then
echo "running"
fi
exit $RESULT
22 changes: 22 additions & 0 deletions test/end-to-end-tests/riot/stop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
set -e

BASE_DIR=$(cd $(dirname $0) && pwd)
PIDFILE=riot.pid
CONFIG_BACKUP=config.e2etests_backup.json

cd $BASE_DIR

if [ -f $PIDFILE ]; then
echo "stopping riot server ..."
PID=$(cat $PIDFILE)
rm $PIDFILE
kill $PID

# revert config file
cd riot-web/webapp
rm config.json
if [ -f $CONFIG_BACKUP ]; then
mv $CONFIG_BACKUP config.json
fi
fi
39 changes: 39 additions & 0 deletions test/end-to-end-tests/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash
set -e

BASE_DIR=$(cd $(dirname $0) && pwd)
pushd $BASE_DIR

if [ ! -d "synapse/installations" ] || [ ! -d "node_modules" ]; then
echo "please, first run $BASE_DIR/install.sh"
bwindels marked this conversation as resolved.
Show resolved Hide resolved
exit 1
fi

has_custom_riot=$(node has_custom_riot.js $@)

if [ ! -d "riot/riot-web" ] && [ $has_custom_riot -ne "1" ]; then
echo "please provide an instance of riot to test against by passing --riot-url <url> or running $BASE_DIR/riot/install.sh"
bwindels marked this conversation as resolved.
Show resolved Hide resolved
exit 1
fi

stop_servers() {
if [ $has_custom_riot -ne "1" ]; then
./riot/stop.sh
fi
./synapse/stop.sh
}

handle_error() {
EXIT_CODE=$?
stop_servers
exit $EXIT_CODE
}

trap 'handle_error' ERR

./synapse/start.sh
if [ $has_custom_riot -ne "1" ]; then
./riot/start.sh
fi
node start.js $@
stop_servers
Loading