Fix flaky test and add screenshots
This commit is contained in:
parent
0ba23d4b62
commit
0715cc6be3
20 changed files with 41 additions and 31 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -42,7 +42,7 @@ jobs:
|
||||||
|
|
||||||
macos:
|
macos:
|
||||||
needs: lint
|
needs: lint
|
||||||
runs-on: macos-11
|
runs-on: macos-latest
|
||||||
if: github.ref == 'refs/heads/development' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
|
if: github.ref == 'refs/heads/development' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
|
|
||||||
|
|
|
@ -550,8 +550,8 @@ function handleCommonWindowEvents(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const DEFAULT_WIDTH = 800;
|
const DEFAULT_WIDTH = enableCI ? 1024 : 800;
|
||||||
const DEFAULT_HEIGHT = 610;
|
const DEFAULT_HEIGHT = enableCI ? 1024 : 610;
|
||||||
// LARGEST_LEFT_PANE_WIDTH = 380
|
// LARGEST_LEFT_PANE_WIDTH = 380
|
||||||
// TIMELINE_WIDTH = 300
|
// TIMELINE_WIDTH = 300
|
||||||
// TIMELINE_MARGIN = 16 + 16
|
// TIMELINE_MARGIN = 16 + 16
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
"test": "yarn test-node && yarn test-electron",
|
"test": "yarn test-node && yarn test-electron",
|
||||||
"test-electron": "node ts/scripts/test-electron.js",
|
"test-electron": "node ts/scripts/test-electron.js",
|
||||||
"test-release": "node ts/scripts/test-release.js",
|
"test-release": "node ts/scripts/test-release.js",
|
||||||
"test-node": "electron-mocha --file test/setup-test-node.js --recursive test/modules ts/test-node ts/test-both",
|
"test-node": "electron-mocha --timeout 10000 --file test/setup-test-node.js --recursive test/modules ts/test-node ts/test-both",
|
||||||
"test-mock": "mocha ts/test-mock/**/*_test.js",
|
"test-mock": "mocha ts/test-mock/**/*_test.js",
|
||||||
"test-node-coverage": "nyc --reporter=lcov --reporter=text mocha --recursive test/modules ts/test-node ts/test-both",
|
"test-node-coverage": "nyc --reporter=lcov --reporter=text mocha --recursive test/modules ts/test-node ts/test-both",
|
||||||
"eslint": "eslint --cache .",
|
"eslint": "eslint --cache .",
|
||||||
|
|
|
@ -68,6 +68,8 @@
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
window.Signal.conversationControllerStart();
|
window.Signal.conversationControllerStart();
|
||||||
|
|
||||||
|
mocha.setup({ timeout: 10000 });
|
||||||
|
|
||||||
window.testUtilities.prepareTests();
|
window.testUtilities.prepareTests();
|
||||||
delete window.testUtilities.prepareTests;
|
delete window.testUtilities.prepareTests;
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ const DELAY = 50; // milliseconds
|
||||||
|
|
||||||
await Promise.all([sendQueue(), measure()]);
|
await Promise.all([sendQueue(), measure()]);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
await bootstrap.saveLogs();
|
await bootstrap.saveLogs(app);
|
||||||
throw error;
|
throw error;
|
||||||
} finally {
|
} finally {
|
||||||
await app?.close();
|
await app?.close();
|
||||||
|
|
|
@ -182,7 +182,7 @@ const LAST_MESSAGE = 'start sending messages now';
|
||||||
|
|
||||||
console.log('stats info=%j', { delta: stats(deltaList, [99, 99.8]) });
|
console.log('stats info=%j', { delta: stats(deltaList, [99, 99.8]) });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
await bootstrap.saveLogs();
|
await bootstrap.saveLogs(app);
|
||||||
throw error;
|
throw error;
|
||||||
} finally {
|
} finally {
|
||||||
await app?.close();
|
await app?.close();
|
||||||
|
|
|
@ -132,7 +132,7 @@ const LAST_MESSAGE = 'start sending messages now';
|
||||||
|
|
||||||
console.log('stats info=%j', { delta: stats(deltaList, [99, 99.8]) });
|
console.log('stats info=%j', { delta: stats(deltaList, [99, 99.8]) });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
await bootstrap.saveLogs();
|
await bootstrap.saveLogs(app);
|
||||||
throw error;
|
throw error;
|
||||||
} finally {
|
} finally {
|
||||||
await app?.close();
|
await app?.close();
|
||||||
|
|
|
@ -60,7 +60,7 @@ const CONTACT_COUNT = 1000;
|
||||||
const duration = Date.now() - start;
|
const duration = Date.now() - start;
|
||||||
console.log(`Took: ${(duration / 1000).toFixed(2)} seconds`);
|
console.log(`Took: ${(duration / 1000).toFixed(2)} seconds`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
await bootstrap.saveLogs();
|
await bootstrap.saveLogs(app);
|
||||||
throw error;
|
throw error;
|
||||||
} finally {
|
} finally {
|
||||||
await app?.close();
|
await app?.close();
|
||||||
|
|
|
@ -256,7 +256,7 @@ export class Bootstrap {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async saveLogs(): Promise<void> {
|
public async saveLogs(app?: App): Promise<void> {
|
||||||
const { ARTIFACTS_DIR } = process.env;
|
const { ARTIFACTS_DIR } = process.env;
|
||||||
if (!ARTIFACTS_DIR) {
|
if (!ARTIFACTS_DIR) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
|
@ -272,7 +272,13 @@ export class Bootstrap {
|
||||||
console.error(`Saving logs to ${outDir}`);
|
console.error(`Saving logs to ${outDir}`);
|
||||||
|
|
||||||
const { logsDir } = this;
|
const { logsDir } = this;
|
||||||
await fs.rename(logsDir, path.join(outDir));
|
await fs.rename(logsDir, outDir);
|
||||||
|
|
||||||
|
if (app) {
|
||||||
|
const window = await app.getWindow();
|
||||||
|
const screenshot = await window.screenshot();
|
||||||
|
await fs.writeFile(path.join(outDir, 'screenshot.png'), screenshot);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -62,7 +62,7 @@ describe('gv2', function needsName() {
|
||||||
|
|
||||||
afterEach(async function after() {
|
afterEach(async function after() {
|
||||||
if (this.currentTest?.state !== 'passed') {
|
if (this.currentTest?.state !== 'passed') {
|
||||||
await bootstrap.saveLogs();
|
await bootstrap.saveLogs(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
await app.close();
|
await app.close();
|
||||||
|
@ -172,28 +172,33 @@ describe('gv2', function needsName() {
|
||||||
|
|
||||||
const window = await app.getWindow();
|
const window = await app.getWindow();
|
||||||
|
|
||||||
debug('Sending another invite');
|
debug('Waiting for the PNI invite');
|
||||||
|
await window
|
||||||
|
.locator(`text=${first.profileName} invited you to the group.`)
|
||||||
|
.waitFor();
|
||||||
|
|
||||||
// Invite ACI from another contact
|
debug('Inviting ACI from another contact');
|
||||||
group = await second.inviteToGroup(group, desktop, {
|
group = await second.inviteToGroup(group, desktop, {
|
||||||
uuidKind: UUIDKind.ACI,
|
uuidKind: UUIDKind.ACI,
|
||||||
});
|
});
|
||||||
|
|
||||||
const conversationStack = window.locator('.conversation-stack');
|
const conversationStack = window.locator('.conversation-stack');
|
||||||
|
|
||||||
|
debug('Waiting for the ACI invite');
|
||||||
|
await window
|
||||||
|
.locator(`text=${second.profileName} invited you to the group.`)
|
||||||
|
.waitFor();
|
||||||
|
|
||||||
debug('Accepting');
|
debug('Accepting');
|
||||||
await conversationStack
|
await conversationStack
|
||||||
.locator('.module-message-request-actions button >> "Accept"')
|
.locator('.module-message-request-actions button >> "Accept"')
|
||||||
.click();
|
.click();
|
||||||
|
|
||||||
debug('Verifying notifications');
|
debug('Checking final notification');
|
||||||
await window
|
|
||||||
.locator(`"${first.profileName} invited you to the group."`)
|
|
||||||
.waitFor();
|
|
||||||
await window.locator('"You were invited to the group."').waitFor();
|
|
||||||
await window
|
await window
|
||||||
.locator(
|
.locator(
|
||||||
`"You accepted an invitation to the group from ${second.profileName}."`
|
'text=You accepted an invitation to the group from ' +
|
||||||
|
`${second.profileName}.`
|
||||||
)
|
)
|
||||||
.waitFor();
|
.waitFor();
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ describe('PNP change number', function needsName() {
|
||||||
|
|
||||||
afterEach(async function after() {
|
afterEach(async function after() {
|
||||||
if (this.currentTest?.state !== 'passed') {
|
if (this.currentTest?.state !== 'passed') {
|
||||||
await bootstrap.saveLogs();
|
await bootstrap.saveLogs(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
await app.close();
|
await app.close();
|
||||||
|
|
|
@ -92,7 +92,7 @@ describe('PNI Signature', function needsName() {
|
||||||
|
|
||||||
afterEach(async function after() {
|
afterEach(async function after() {
|
||||||
if (this.currentTest?.state !== 'passed') {
|
if (this.currentTest?.state !== 'passed') {
|
||||||
await bootstrap.saveLogs();
|
await bootstrap.saveLogs(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
await app.close();
|
await app.close();
|
||||||
|
|
|
@ -84,7 +84,7 @@ describe('gv2', function needsName() {
|
||||||
|
|
||||||
afterEach(async function after() {
|
afterEach(async function after() {
|
||||||
if (this.currentTest?.state !== 'passed') {
|
if (this.currentTest?.state !== 'passed') {
|
||||||
await bootstrap.saveLogs();
|
await bootstrap.saveLogs(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
await app.close();
|
await app.close();
|
||||||
|
|
|
@ -23,7 +23,7 @@ describe('storage service', function needsName() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.currentTest?.state !== 'passed') {
|
if (this.currentTest?.state !== 'passed') {
|
||||||
await bootstrap.saveLogs();
|
await bootstrap.saveLogs(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
await app.close();
|
await app.close();
|
||||||
|
|
|
@ -26,7 +26,7 @@ describe('storage service', function needsName() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.currentTest?.state !== 'passed') {
|
if (this.currentTest?.state !== 'passed') {
|
||||||
await bootstrap.saveLogs();
|
await bootstrap.saveLogs(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
await app.close();
|
await app.close();
|
||||||
|
|
|
@ -28,7 +28,7 @@ describe('storage service', function needsName() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.currentTest?.state !== 'passed') {
|
if (this.currentTest?.state !== 'passed') {
|
||||||
await bootstrap.saveLogs();
|
await bootstrap.saveLogs(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
await app.close();
|
await app.close();
|
||||||
|
|
|
@ -23,7 +23,7 @@ describe('storage service', function needsName() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.currentTest?.state !== 'passed') {
|
if (this.currentTest?.state !== 'passed') {
|
||||||
await bootstrap.saveLogs();
|
await bootstrap.saveLogs(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
await app.close();
|
await app.close();
|
||||||
|
|
|
@ -27,7 +27,7 @@ describe('storage service', function needsName() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.currentTest?.state !== 'passed') {
|
if (this.currentTest?.state !== 'passed') {
|
||||||
await bootstrap.saveLogs();
|
await bootstrap.saveLogs(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
await app.close();
|
await app.close();
|
||||||
|
|
|
@ -100,7 +100,7 @@ describe('storage service', function needsName() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.currentTest?.state !== 'passed') {
|
if (this.currentTest?.state !== 'passed') {
|
||||||
await bootstrap.saveLogs();
|
await bootstrap.saveLogs(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
await app.close();
|
await app.close();
|
||||||
|
|
|
@ -14,9 +14,6 @@ import {
|
||||||
|
|
||||||
describe('license comments', () => {
|
describe('license comments', () => {
|
||||||
it('includes a license comment at the top of every relevant file', async function test() {
|
it('includes a license comment at the top of every relevant file', async function test() {
|
||||||
// This usually executes quickly but can be slow in some cases, such as Windows CI.
|
|
||||||
this.timeout(10000);
|
|
||||||
|
|
||||||
await forEachRelevantFile(async file => {
|
await forEachRelevantFile(async file => {
|
||||||
let firstLine: string;
|
let firstLine: string;
|
||||||
let secondLine: string;
|
let secondLine: string;
|
||||||
|
|
Loading…
Reference in a new issue