-
Notifications
You must be signed in to change notification settings - Fork 211
Add GUI tests #1698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add GUI tests #1698
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
78e4b71
Add GUI tests
GuillaumeGomez 57f0a83
Update to newest browser-ui-test version
GuillaumeGomez 32539dd
Move GUI tests into their own
GuillaumeGomez 3bbec56
Fix missing environment setup
GuillaumeGomez caf422e
Stop bash script at first error
GuillaumeGomez dfb87e4
Fix CI compilation error
GuillaumeGomez fb26bf8
Remove `docker build` command
GuillaumeGomez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
FROM ubuntu:22.04 AS build | ||
|
||
# Install packaged dependencies | ||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ | ||
build-essential git curl cmake gcc g++ pkg-config libmagic-dev \ | ||
libssl-dev zlib1g-dev ca-certificates | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
ca-certificates \ | ||
curl \ | ||
docker.io \ | ||
gcc \ | ||
git \ | ||
libssl-dev \ | ||
pkg-config \ | ||
xz-utils | ||
|
||
# Install dependencies for chromium browser | ||
RUN apt-get install -y \ | ||
gconf-service \ | ||
libasound2 \ | ||
libatk1.0-0 \ | ||
libatk-bridge2.0-0 \ | ||
libc6 \ | ||
libcairo2 \ | ||
libcups2 \ | ||
libdbus-1-3 \ | ||
libexpat1 \ | ||
libfontconfig1 \ | ||
libgbm-dev \ | ||
libgcc1 \ | ||
libgconf-2-4 \ | ||
libgdk-pixbuf2.0-0 \ | ||
libglib2.0-0 \ | ||
libgtk-3-0 \ | ||
libnspr4 \ | ||
libpango-1.0-0 \ | ||
libpangocairo-1.0-0 \ | ||
libstdc++6 \ | ||
libx11-6 \ | ||
libx11-xcb1 \ | ||
libxcb1 \ | ||
libxcomposite1 \ | ||
libxcursor1 \ | ||
libxdamage1 \ | ||
libxext6 \ | ||
libxfixes3 \ | ||
libxi6 \ | ||
libxrandr2 \ | ||
libxrender1 \ | ||
libxss1 \ | ||
libxtst6 \ | ||
fonts-liberation \ | ||
libappindicator1 \ | ||
libnss3 \ | ||
lsb-release \ | ||
xdg-utils \ | ||
wget | ||
|
||
# Install rust | ||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y --default-toolchain nightly --no-modify-path --profile minimal | ||
ENV PATH="/root/.cargo/bin:${PATH}" | ||
|
||
RUN curl -sL https://nodejs.org/dist/v14.4.0/node-v14.4.0-linux-x64.tar.xz | tar -xJ | ||
ENV PATH="/node-v14.4.0-linux-x64/bin:${PATH}" | ||
ENV NODE_PATH="/node-v14.4.0-linux-x64/lib/node_modules/" | ||
|
||
WORKDIR /build | ||
|
||
RUN mkdir out | ||
|
||
# For now, we need to use `--unsafe-perm=true` to go around an issue when npm tries | ||
# to create a new folder. For reference: | ||
# https://github.com/puppeteer/puppeteer/issues/375 | ||
# | ||
# We also specify the version in case we need to update it to go around cache limitations. | ||
RUN npm install -g [email protected] --unsafe-perm=true | ||
|
||
EXPOSE 3000 | ||
|
||
CMD ["node", "/build/out/gui-tests/tester.js"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
# Just in case it's running, we stop the web server. | ||
docker-compose stop web | ||
|
||
docker-compose up -d db s3 | ||
|
||
# If we have a .env file, we need to temporarily move it so | ||
# it doesn't make sqlx fail compilation. | ||
if [ -f .env ]; then | ||
mv .env .tmp.env | ||
fi | ||
|
||
# We add the information we need. | ||
cargo run -- database migrate | ||
cargo run -- build update-toolchain | ||
cargo run -- build crate sysinfo 0.23.4 | ||
syphar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
cargo run -- build crate sysinfo 0.23.5 | ||
cargo run -- build add-essential-files | ||
|
||
if [ -f .tmp.env ]; then | ||
mv .tmp.env .env | ||
fi | ||
|
||
# In case we don't have a `.env`, we create one. | ||
if [ ! -f .env ]; then | ||
cp .env.sample .env | ||
fi | ||
|
||
. .env | ||
|
||
cargo run -- start-web-server & | ||
SERVER_PID=$! | ||
|
||
docker build . -f dockerfiles/Dockerfile-gui-tests -t gui_tests | ||
|
||
# status="docker run . -v `pwd`:/build/out:ro gui_tests" | ||
docker-compose run gui_tests | ||
syphar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
status=$? | ||
exit $status |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Checks the content of the 404 page. | ||
go-to: |DOC_PATH| + "/non-existing-crate" | ||
assert-text: ("#crate-title", "The requested crate does not exist") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Checks that the "latest" URL leads us to the last version of the `sysinfo` crate. | ||
go-to: |DOC_PATH| + "/sysinfo" | ||
// We first check if the redirection worked as expected: | ||
assert-document-property: ({"URL": "/sysinfo/latest/sysinfo/"}, ENDS_WITH) | ||
// Now we go to the actual version we're interested into. | ||
go-to: |DOC_PATH| + "/sysinfo/0.23.5/sysinfo/index.html" | ||
assert: "//*[@class='title' and text()='sysinfo-0.23.5']" | ||
// And we also confirm we're on a rustdoc page. | ||
assert: "#rustdoc_body_wrapper" | ||
|
||
// Let's go to the docs.rs page of the crate. | ||
go-to: |DOC_PATH| + "/crate/sysinfo/0.23.5" | ||
assert-false: "#rustdoc_body_wrapper" | ||
assert-text: ("#crate-title", "sysinfo 0.23.5", CONTAINS) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.