Merge branch 'develop' of ssh://github.com/element-hq/element-web into t3chguy/monorepo-playwright-common
# Conflicts: # pnpm-lock.yaml
This commit is contained in:
@@ -12,4 +12,13 @@ RUN npm i -g playwright@${PLAYWRIGHT_VERSION}
|
||||
|
||||
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
# We use `docker-init` as PID 1, which means that the container shuts down correctly on SIGTERM.
|
||||
#
|
||||
# (The problem is that PID 1 doesn't get default signal handlers, and
|
||||
# playwright server doesn't register a SIGTERM handler, so if that ends up as
|
||||
# PID 1, then it ignores SIGTERM. Likewise bash doesn't set a SIGTERM handler by default.
|
||||
#
|
||||
# The easiest solution is to use docker-init, which is in fact `tini` (https://github.com/krallin/tini).
|
||||
#
|
||||
# See https://github.com/krallin/tini/issues/8#issuecomment-146135930 for a good explanation of all this.)
|
||||
ENTRYPOINT ["/usr/bin/docker-init", "/docker-entrypoint.sh"]
|
||||
|
||||
@@ -1,4 +1,2 @@
|
||||
#!/bin/bash
|
||||
|
||||
# We use npm here as we used `npm i -g` to install playwright in the Dockerfile
|
||||
npm exec -- playwright run-server --port "$PORT" --host 0.0.0.0
|
||||
exec /usr/bin/playwright run-server --port "$PORT" --host 0.0.0.0
|
||||
|
||||
@@ -24,6 +24,8 @@ type PaginationLinks = {
|
||||
first?: string;
|
||||
};
|
||||
|
||||
const ANSI_COLOUR_REGEX = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
|
||||
|
||||
// We see quite a few test flakes which are caused by the app exploding
|
||||
// so we have some magic strings we check the logs for to better track the flake with its cause
|
||||
const SPECIAL_CASES: Record<string, string> = {
|
||||
@@ -38,18 +40,35 @@ class FlakyReporter implements Reporter {
|
||||
public onTestEnd(test: TestCase): void {
|
||||
// Ignores flakes on Dendrite and Pinecone as they have their own flakes we do not track
|
||||
if (["Dendrite", "Pinecone"].includes(test.parent.project()!.name!)) return;
|
||||
let failures = [`${test.location.file.split("playwright/e2e/")[1]}: ${test.title}`];
|
||||
|
||||
if (test.outcome() === "flaky") {
|
||||
const failures: string[] = [];
|
||||
|
||||
const timedOutRuns = test.results.filter((result) => result.status === "timedOut");
|
||||
const pageLogs = timedOutRuns.flatMap((result) =>
|
||||
result.attachments.filter((attachment) => attachment.name.startsWith("page-")),
|
||||
);
|
||||
|
||||
// If a test failed due to a systemic fault then the test is not flaky, the app is, record it as such.
|
||||
const specialCases = Object.keys(SPECIAL_CASES).filter((log) =>
|
||||
pageLogs.some((attachment) => attachment.name.startsWith("page-") && attachment.body?.includes(log)),
|
||||
);
|
||||
if (specialCases.length > 0) {
|
||||
failures = specialCases.map((specialCase) => SPECIAL_CASES[specialCase]);
|
||||
failures.push(...specialCases.map((specialCase) => SPECIAL_CASES[specialCase]));
|
||||
}
|
||||
|
||||
// Check for fixtures failing to set up
|
||||
const errorMessages = timedOutRuns
|
||||
.map((r) => r.error?.message?.replace(ANSI_COLOUR_REGEX, ""))
|
||||
.filter(Boolean) as string[];
|
||||
for (const error of errorMessages) {
|
||||
if (error.startsWith("Fixture") && error.endsWith("exceeded during setup.")) {
|
||||
failures.push(error);
|
||||
}
|
||||
}
|
||||
|
||||
if (failures.length < 1) {
|
||||
failures.push(`${test.location.file.split("playwright/e2e/")[1]}: ${test.title}`);
|
||||
}
|
||||
|
||||
for (const title of failures) {
|
||||
|
||||
@@ -19,8 +19,15 @@ WS_PORT=3000
|
||||
PW_VERSION=$(pnpm --silent -- playwright --version | awk '{print $2}')
|
||||
IMAGE_NAME="ghcr.io/element-hq/element-web/playwright-server:$PW_VERSION"
|
||||
|
||||
# Pull the image, failing that build the image
|
||||
docker pull "$IMAGE_NAME" 2>/dev/null || build_image "$IMAGE_NAME"
|
||||
# If the image exists in the repository, pull it; otherwise, build it.
|
||||
#
|
||||
# (This explicit test gives the user clearer progress info than just
|
||||
# `docker pull 2>/dev/null || build_image`.)
|
||||
if docker manifest inspect "$IMAGE_NAME" &>/dev/null; then
|
||||
docker pull "$IMAGE_NAME"
|
||||
else
|
||||
build_image "$IMAGE_NAME"
|
||||
fi
|
||||
|
||||
# Start the playwright-server in docker
|
||||
CONTAINER=$(docker run --network=host -v /tmp:/tmp --rm -d -e PORT="$WS_PORT" "$IMAGE_NAME")
|
||||
|
||||
Reference in New Issue
Block a user