Skip to content
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

TINY-11177: Vastly improve remote testing #145

Draft
wants to merge 29 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
fb898e4
TINY-11177: Add an empty favicon to prevent the browser requesting `f…
TheSpyder Aug 16, 2024
56b5985
TINY-11177: Add keep-alive header to stop weird 502 bad gateway errors
TheSpyder Aug 16, 2024
e3e659f
TINY-11177: Send significantly less reports from the client. Don't wa…
TheSpyder Aug 16, 2024
57a42a4
TINY-11177: Reverted TINY-10708 which was a server-side fix. We neede…
TheSpyder Aug 16, 2024
ad4b260
TINY-11177: Re-implemented skip reports, we have enough of them that …
TheSpyder Aug 16, 2024
9ea95a3
TINY-11177: Updated reporter test for logical changes. Fixed a bug wi…
TheSpyder Aug 16, 2024
070c20a
TINY-11177: Removed @ephox/wrap-promise-polyfill
TheSpyder Aug 16, 2024
bcb63b7
TINY-11177: Rewriting the entire report system to support batch resul…
TheSpyder Sep 13, 2024
980c3b9
TINY-11177: Delete route that accepts a single test result
TheSpyder Sep 15, 2024
e80663d
TINY-11177: Changelog
TheSpyder Sep 15, 2024
625a2ce
TINY-11177: Fixed test
TheSpyder Sep 16, 2024
b0dc184
TINY-11177: Improved test failure reporting
TheSpyder Sep 16, 2024
c4359e8
TINY-11177: The test wasn't broken, my code was. Messages sent close …
TheSpyder Sep 16, 2024
5e55c44
TINY-11177: Only update the HUD once for batch results, instead of on…
TheSpyder Sep 16, 2024
7b0d367
TINY-11177: Setup remote testing
jscasca Sep 16, 2024
93d8408
TINY-11177: Fixed issue where it was not clear test failures must be …
TheSpyder Sep 16, 2024
0cbc33f
TINY-11177: Send start once, not once per page
TheSpyder Sep 16, 2024
0287158
TINY-11177: Fix HUD test count now that we are sending all results
TheSpyder Sep 16, 2024
5cd5c77
TINY-11177: Only record results if there are results
TheSpyder Sep 16, 2024
73b5391
TINY-11177: Add extra warning for duplicate tests
TheSpyder Sep 16, 2024
4094f6d
TINY-11177: Post current results before reloading the browser for eit…
TheSpyder Sep 16, 2024
07f61f8
TINY-11177: Fixed test waiting for done to decide to post results
TheSpyder Sep 16, 2024
f025e1d
alpha 3
TheSpyder Sep 16, 2024
801e908
TINY-11177: Warn for skipped tests as well
TheSpyder Sep 16, 2024
51533cd
TINY-11177: Revert failed attempt to fix sending the final result batch
TheSpyder Sep 16, 2024
40d2402
TINY-11177: Extend HUD limit to the terminal width. Disable the limit…
TheSpyder Sep 17, 2024
7778c70
TINY-11177: Reduce confusion with test reports and error messaging
TheSpyder Sep 17, 2024
eaab339
TINY-11177: Fail webdriver errors properly, don't generate new errors…
TheSpyder Sep 17, 2024
8afd4d5
TINY-11177: Alpha 4
TheSpyder Sep 17, 2024
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
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

## Added
- New server-side APIs to accept a batch of results instead of a single result #TINY-11177

## Changed
- Reverted TINY-10708 which was a server-side fix
- Client no longer waits for log requests to complete between tests, which should speed up remote testing #TINY-11177
- Console HUD no longer updates for individual tests #TINY-11177
- Client now posts test status only in batches every 30 seconds, this is the only time the console HUD will update #TINY-11177

## Removed
- Single result server-side API #TINY-11177
- Server-side monitoring of single test timeouts. This is still monitored client side. #TINY-11177
- The Promise polyfill is no longer allowed on modern NodeJS frameworks so it has been removed. #TINY-11177

## 14.1.4 - 2024-03-27

### Fixed
Expand Down
38 changes: 27 additions & 11 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,35 @@ timestamps {

stage("test") {
exec('yarn test')

bedrockBrowsers(
prepareTests: {
yarnInstall()
exec('yarn build')
},
testDirs: [ 'modules/sample/src/test/ts/**/pass' ],
custom: '--config modules/sample/tsconfig.json --customRoutes modules/sample/routes.json --polyfills Promise Symbol'
)
}
}

// Testing
stage("bedrock testing") {
bedrockRemoteBrowsers(
platforms: [
[ browser: 'chrome', provider: 'aws', buckets: 2 ],
[ browser: 'firefox', provider: 'aws', buckets: 2 ],
[ browser: 'edge', provider: 'lambdatest', buckets: 1 ],
[ browser: 'chrome', provider: 'lambdatest', os: 'macOS Sonoma', buckets: 1 ],
[ browser: 'firefox', provider: 'lambdatest', os: 'macOS Sonoma', buckets: 1 ],
[ browser: 'safari', provider: 'lambdatest', os: 'macOS Sonoma', buckets: 1 ],
],
prepareTests: {
yarnInstall()
sh 'yarn build'
},
testDirs: [ 'modules/sample/src/test/ts/**/pass' ],
custom: '--config modules/sample/tsconfig.json --customRoutes modules/sample/routes.json --polyfills Promise Symbol'
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we remove the polyfills now since we are running on browsers that support Promise and Symbol?

)
}

if (isReleaseBranch()) {
stage("publish") {
// Publish
if (isReleaseBranch()) {
stage("publish") {
tinyPods.node() {
yarnInstall()
sh 'yarn build'
tinyNpm.withNpmPublishCredentials {
// We need to tell git to ignore the changes to .npmrc when publishing
exec('git update-index --assume-unchanged .npmrc')
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"npmClient": "yarn",
"useWorkspaces": true,
"version": "14.1.4",
"version": "15.0.0-alpha.3",
"publish": {
"push": false
}
Expand Down
3 changes: 1 addition & 2 deletions modules/runner/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ephox/bedrock-runner",
"version": "14.1.1",
"version": "15.0.0-alpha.3",
"author": "Tiny Technologies Inc",
"license": "Apache-2.0",
"scripts": {
Expand All @@ -11,7 +11,6 @@
},
"dependencies": {
"@ephox/bedrock-common": "^14.1.1",
"@ephox/wrap-promise-polyfill": "^2.2.0",
"jquery": "^3.4.1",
"querystringify": "^2.1.1"
},
Expand Down
1 change: 0 additions & 1 deletion modules/runner/src/main/ts/api/Main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Failure, Global } from '@ephox/bedrock-common';
import Promise from '@ephox/wrap-promise-polyfill';
import * as Globals from '../core/Globals';
import * as TestLoader from '../core/TestLoader';
import { UrlParams } from '../core/UrlParams';
Expand Down
3 changes: 1 addition & 2 deletions modules/runner/src/main/ts/core/TestLoader.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Promise from '@ephox/wrap-promise-polyfill';
import { ErrorCatcher } from '../errors/ErrorCatcher';

export const load = (scriptUrl: string): Promise<void> =>
Expand Down Expand Up @@ -38,4 +37,4 @@ export const load = (scriptUrl: string): Promise<void> =>

// Add the script to the dom to load it
document.body.appendChild(script);
});
});
3 changes: 1 addition & 2 deletions modules/runner/src/main/ts/core/Utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Suite, Test } from '@ephox/bedrock-common';
import Promise from '@ephox/wrap-promise-polyfill';
import sourceMappedStackTrace from 'sourcemapped-stacktrace';

// eslint-disable-next-line @typescript-eslint/no-empty-function
Expand Down Expand Up @@ -62,4 +61,4 @@ export const setStack = (error: Error, stack: string | undefined): void => {
} catch (err) {
// Do nothing
}
};
};
50 changes: 32 additions & 18 deletions modules/runner/src/main/ts/reporter/Callbacks.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
import { ErrorData, Global } from '@ephox/bedrock-common';
import Promise from '@ephox/wrap-promise-polyfill';

import { HarnessResponse } from '../core/ServerTypes';

export interface TestReport {
file: string;
name: string;
passed: boolean;
time: string;
skipped: string | null;
error: TestErrorData | null
}

export interface TestErrorData {
readonly data: ErrorData;
readonly text: string;
Expand All @@ -11,25 +20,34 @@ export interface Callbacks {
readonly loadHarness: () => Promise<HarnessResponse>
readonly sendKeepAlive: (session: string) => Promise<void>;
readonly sendInit: (session: string) => Promise<void>;
readonly sendTestStart: (session: string, totalTests: number, file: string, name: string) => Promise<void>;
readonly sendTestResult: (session: string, file: string, name: string, passed: boolean, time: string, error: TestErrorData | null, skipped: string | null) => Promise<void>;
readonly sendTestStart: (session: string, number: number, totalTests: number, file: string, name: string) => Promise<void>;
readonly sendTestResults: (session: string, results: TestReport[]) => Promise<void>;
readonly sendDone: (session: string, error?: string) => Promise<void>;
}

declare const $: JQueryStatic;

const sendJson = <T>(url: string, data: any): Promise<T> => {
function generateErrorMessage(xhr: JQuery.jqXHR<any>, onError: (reason?: any) => void, url: string, requestDetails: string, statusText: 'timeout' | 'error' | 'abort' | 'parsererror', e: string) {
if (xhr.readyState === 0) {
onError(`Unable to open connection to ${url}, ${requestDetails}. Status text "${statusText}", error thrown "${e}"`);
} else {
onError(`Response status ${xhr.status} connecting to ${url}, ${requestDetails}. Status text "${statusText}", error thrown "${e}"`);
}
}

const sendJson = <T>(url: string, jsonData: any): Promise<T> => {
return new Promise((onSuccess, onError) => {
const data = JSON.stringify(jsonData);
$.ajax({
method: 'post',
url,
contentType: 'application/json; charset=UTF-8',
dataType: 'json',
success: onSuccess,
error: (xhr, statusText, e) => {
onError(e);
generateErrorMessage(xhr, onError, url, `sending ${data}`, statusText, e);
},
data: JSON.stringify(data),
data,
});
});
};
Expand All @@ -41,7 +59,7 @@ const getJson = <T>(url: string): Promise<T> => {
dataType: 'json',
success: onSuccess,
error: (xhr, statusText, e) => {
onError(e);
generateErrorMessage(xhr, onError, url, 'as a get request', statusText, e);
}
});
}));
Expand All @@ -64,24 +82,20 @@ export const Callbacks = (): Callbacks => {
});
};

const sendTestStart = (session: string, totalTests: number, file: string, name: string): Promise<void> => {
const sendTestStart = (session: string, number: number, totalTests: number, file: string, name: string): Promise<void> => {
return sendJson('/tests/start', {
number,
totalTests,
session,
file,
name,
});
};

const sendTestResult = (session: string, file: string, name: string, passed: boolean, time: string, error: TestErrorData | null, skipped: string | null): Promise<void> => {
return sendJson('/tests/result', {
const sendTestResults = (session: string, results: TestReport[]): Promise<void> => {
return sendJson('/tests/results', {
session,
file,
name,
passed,
skipped,
time,
error,
results,
});
};

Expand All @@ -101,7 +115,7 @@ export const Callbacks = (): Callbacks => {
sendInit,
sendKeepAlive,
sendTestStart,
sendTestResult,
sendTestResults,
sendDone
};
};
};
Loading
Loading