Skip to content

Commit

Permalink
Update to newest browser-ui-test version
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Oct 16, 2023
1 parent 09d562d commit c6a348d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions dockerfiles/Dockerfile-gui-tests
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ RUN apt-get install -y \
wget

# Install rust
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y --default-toolchain nightly --no-modify-path --profile minimal
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
Expand All @@ -70,7 +70,7 @@ RUN mkdir out
# 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 browser-ui-test@0.8.5 --unsafe-perm=true
RUN npm install -g browser-ui-test@0.16.10 --unsafe-perm=true

EXPOSE 3000

Expand Down
3 changes: 1 addition & 2 deletions dockerfiles/run-gui-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cargo run -- build add-essential-files
if [ ! -f .env ]
then
cp .env.sample .env
source .env
. .env
fi

cargo run -- start-web-server &
Expand All @@ -29,5 +29,4 @@ sleep 5
# status="docker run . -v `pwd`:/build/out:ro gui_tests"
docker-compose run gui_tests
status=$?
kill -9 $SERVER_PID
exit $status
2 changes: 1 addition & 1 deletion gui-tests/404.goml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// Checks the content of the 404 page.
goto: |DOC_PATH|/non-existing-crate
go-to: |DOC_PATH| + "/non-existing-crate"
assert-text: ("#crate-title", "The requested crate does not exist")
6 changes: 4 additions & 2 deletions gui-tests/basic.goml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// Checks that the "latest" URL leads us to the last version of the `sysinfo` crate.
goto: |DOC_PATH|/sysinfo
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.
goto: |DOC_PATH|/crate/sysinfo/latest
go-to: |DOC_PATH| + "/crate/sysinfo/0.23.5"
assert-false: "#rustdoc_body_wrapper"
assert-text: ("#crate-title", "sysinfo 0.23.5", CONTAINS)
8 changes: 4 additions & 4 deletions gui-tests/tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ async function main(argv) {
try {
// This is more convenient that setting fields one by one.
let args = [
"--no-screenshot-comparison",
"--no-sandbox",
];
if (typeof process.env.SERVER_URL !== 'undefined') {
Expand Down Expand Up @@ -166,14 +165,15 @@ async function main(argv) {
opts["jobs"] = 1;
console.log("`--no-headless` option is active, disabling concurrency for running tests.");
}

console.log(`Running ${files.length} docs.rs GUI (${opts["jobs"]} concurrently) ...`);
let jobs = opts["jobs"];

if (opts["jobs"] < 1) {
jobs = files.length;
process.setMaxListeners(files.length + 1);
} else if (headless) {
process.setMaxListeners(opts["jobs"] + 1);
}
console.log(`Running ${files.length} docs.rs GUI (${jobs} concurrently) ...`);

const tests_queue = [];
let results = {
Expand All @@ -185,7 +185,7 @@ async function main(argv) {
for (let i = 0; i < files.length; ++i) {
const file_name = files[i];
const testPath = path.join(__dirname, file_name);
const callback = runTest(testPath, options)
const callback = runTest(testPath, {"options": options})
.then(out => {
const [output, nb_failures] = out;
results[nb_failures === 0 ? "successful" : "failed"].push({
Expand Down

0 comments on commit c6a348d

Please sign in to comment.