Fix CI failures (#696)

pull/699/head
George Gevoian 8 months ago committed by GitHub
parent 5bc8118eae
commit 3f509484a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -13,7 +13,7 @@ import * as gu from 'test/nbrowser/gristUtils';
import {setupTestSuite} from 'test/nbrowser/testUtils'; import {setupTestSuite} from 'test/nbrowser/testUtils';
describe('CopyPaste', function() { describe('CopyPaste', function() {
this.timeout(60000); this.timeout(90000);
const cleanup = setupTestSuite(); const cleanup = setupTestSuite();
const clipboard = gu.getLockableClipboard(); const clipboard = gu.getLockableClipboard();
afterEach(() => gu.checkForErrors()); afterEach(() => gu.checkForErrors());
@ -69,8 +69,7 @@ describe('CopyPaste', function() {
await session.tempDoc(cleanup, 'PasteParsing.grist'); await session.tempDoc(cleanup, 'PasteParsing.grist');
await driver.executeScript(createDummyTextArea); await driver.executeScript(createDummyTextArea);
await clipboard.lockAndPerform(async (cb) => { await copyAndCheck(clipboard, [
await copyAndCheck(cb, [
'$1', '1', '$1', '1',
'(2)', '-2', '(2)', '-2',
'3e4', '30000', '3e4', '30000',
@ -84,7 +83,6 @@ describe('CopyPaste', function() {
// Doesn't match the default currency of the document, whereas $ above does // Doesn't match the default currency of the document, whereas $ above does
'€89', '€89 INVALID', '€89', '€89 INVALID',
], true); ], true);
});
// Open the side panel for the numeric column. // Open the side panel for the numeric column.
await gu.toggleSidePanel('right', 'open'); await gu.toggleSidePanel('right', 'open');
@ -144,8 +142,7 @@ describe('CopyPaste', function() {
'€89', '€89.00', '€89', '€89.00',
]); ]);
await clipboard.lockAndPerform(async (cb) => { await copyAndCheck(clipboard, [
await copyAndCheck(cb, [
// Now we're copying from the text column so everything is parsed again. // Now we're copying from the text column so everything is parsed again.
// $ can no longer be parsed now the currency is euros. // $ can no longer be parsed now the currency is euros.
'$1', '$1 INVALID', '$1', '$1 INVALID',
@ -158,7 +155,6 @@ describe('CopyPaste', function() {
'1.234.567', '1.234.567 INVALID', '1.234.567', '1.234.567 INVALID',
'€89', '€89.00', '€89', '€89.00',
], true); ], true);
});
// Change the document locale // Change the document locale
await gu.openDocumentSettings(); await gu.openDocumentSettings();
@ -202,8 +198,7 @@ describe('CopyPaste', function() {
'€89', '89,00 €', '€89', '89,00 €',
]); ]);
await clipboard.lockAndPerform(async (cb) => { await copyAndCheck(clipboard, [
await copyAndCheck(cb, [
'$1', '$1 INVALID', '$1', '$1 INVALID',
'(2)', '-2,00 €', '(2)', '-2,00 €',
'3e4', '30.000,00 €', '3e4', '30.000,00 €',
@ -222,13 +217,11 @@ describe('CopyPaste', function() {
'€89', '89,00 €', '€89', '89,00 €',
], true); ], true);
}); });
});
it('should parse pasted dates', async function() { it('should parse pasted dates', async function() {
await gu.getPageItem("Dates").click(); await gu.getPageItem("Dates").click();
await clipboard.lockAndPerform(async (cb) => { await copyAndCheck(clipboard, [
await copyAndCheck(cb, [
'01-02-03', '01-02-2003', '01-02-03', '01-02-2003',
'01 02 2003', '01-02-2003', '01 02 2003', '01-02-2003',
'1/02/03', '01-02-2003', '1/02/03', '01-02-2003',
@ -238,7 +231,6 @@ describe('CopyPaste', function() {
'20/10/03', '20-10-2003', '20/10/03', '20-10-2003',
'10/20/03', '10/20/03 INVALID', '10/20/03', '10/20/03 INVALID',
]); ]);
});
await gu.getCell({col: 'Parsed', rowNum: 1}).click(); await gu.getCell({col: 'Parsed', rowNum: 1}).click();
assert.equal(await gu.getDateFormat(), "DD-MM-YYYY"); assert.equal(await gu.getDateFormat(), "DD-MM-YYYY");
@ -274,8 +266,7 @@ describe('CopyPaste', function() {
]); ]);
// Copy from the text column again, things get re-parsed // Copy from the text column again, things get re-parsed
await clipboard.lockAndPerform(async (cb) => { await copyAndCheck(clipboard, [
await copyAndCheck(cb, [
'01-02-03', '01-02-2003', '01-02-03', '01-02-2003',
'01 02 2003', '01-02-2003', '01 02 2003', '01-02-2003',
'1/02/03', '01-02-2003', '1/02/03', '01-02-2003',
@ -286,7 +277,6 @@ describe('CopyPaste', function() {
'10/20/03', '10-20-2003', '10/20/03', '10-20-2003',
]); ]);
}); });
});
// Note that these tests which reference other tables // Note that these tests which reference other tables
// assume that the previous tests have run. // assume that the previous tests have run.
@ -298,8 +288,7 @@ describe('CopyPaste', function() {
// Initially the References.Parsed column is displaying Dates.Text // Initially the References.Parsed column is displaying Dates.Text
// No date parsing happens, we just see which strings exist in that column // No date parsing happens, we just see which strings exist in that column
await clipboard.lockAndPerform(async (cb) => { await copyAndCheck(clipboard, [
await copyAndCheck(cb, [
'20/10/03', '20/10/03', '20/10/03', '20/10/03',
'10/20/03', '10/20/03', '10/20/03', '10/20/03',
'1/2/3', '1/2/3', '1/2/3', '1/2/3',
@ -309,7 +298,6 @@ describe('CopyPaste', function() {
'$1', '$1 INVALID', '$1', '$1 INVALID',
'€89', '€89 INVALID', '€89', '€89 INVALID',
], true); ], true);
});
await gu.setRefShowColumn("Parsed"); await gu.setRefShowColumn("Parsed");
@ -328,8 +316,7 @@ describe('CopyPaste', function() {
'€89', '€89 INVALID', '€89', '€89 INVALID',
]); ]);
await clipboard.lockAndPerform(async (cb) => { await copyAndCheck(clipboard, [
await copyAndCheck(cb, [
'20/10/03', '20/10/03', '20/10/03', '20/10/03',
'10/20/03', '10-20-2003', '10/20/03', '10-20-2003',
'1/2/3', '1/2/3', '1/2/3', '1/2/3',
@ -339,7 +326,6 @@ describe('CopyPaste', function() {
'$1', `$1 INVALID`, '$1', `$1 INVALID`,
'€89', '€89 INVALID', '€89', '€89 INVALID',
]); ]);
});
await gu.setRefShowColumn("Row ID"); await gu.setRefShowColumn("Row ID");
@ -355,8 +341,7 @@ describe('CopyPaste', function() {
'€89', '€89 INVALID', '€89', '€89 INVALID',
]); ]);
await clipboard.lockAndPerform(async (cb) => { await copyAndCheck(clipboard, [
await copyAndCheck(cb, [
'20/10/03', '20/10/03 INVALID', '20/10/03', '20/10/03 INVALID',
'10/20/03', '10/20/03 INVALID', '10/20/03', '10/20/03 INVALID',
'1/2/3', '1/2/3 INVALID', '1/2/3', '1/2/3 INVALID',
@ -366,7 +351,6 @@ describe('CopyPaste', function() {
'$1', '$1 INVALID', '$1', '$1 INVALID',
'€89', '€89 INVALID', '€89', '€89 INVALID',
]); ]);
});
await gu.setRefTable("Numbers"); await gu.setRefTable("Numbers");
@ -374,8 +358,7 @@ describe('CopyPaste', function() {
async function checkRefsToNumbers() { async function checkRefsToNumbers() {
await gu.setRefShowColumn("Row ID"); await gu.setRefShowColumn("Row ID");
await clipboard.lockAndPerform(async (cb) => { await copyAndCheck(clipboard, [
await copyAndCheck(cb, [
'20/10/03', '20/10/03 INVALID', '20/10/03', '20/10/03 INVALID',
'10/20/03', '10/20/03 INVALID', '10/20/03', '10/20/03 INVALID',
'1/2/3', '1/2/3 INVALID', '1/2/3', '1/2/3 INVALID',
@ -385,12 +368,10 @@ describe('CopyPaste', function() {
'$1', '$1 INVALID', '$1', '$1 INVALID',
'€89', '€89 INVALID', '€89', '€89 INVALID',
], true); ], true);
});
await gu.setRefShowColumn("Text"); await gu.setRefShowColumn("Text");
await clipboard.lockAndPerform(async (cb) => { await copyAndCheck(clipboard, [
await copyAndCheck(cb, [
'20/10/03', '20/10/03 INVALID', '20/10/03', '20/10/03 INVALID',
'10/20/03', '10/20/03 INVALID', '10/20/03', '10/20/03 INVALID',
'1/2/3', '1/2/3 INVALID', '1/2/3', '1/2/3 INVALID',
@ -401,7 +382,6 @@ describe('CopyPaste', function() {
'$1', '$1', '$1', '$1',
'€89', '€89', '€89', '€89',
]); ]);
});
await gu.setRefShowColumn("Parsed"); await gu.setRefShowColumn("Parsed");
@ -417,8 +397,7 @@ describe('CopyPaste', function() {
'€89', '89,00 €', '€89', '89,00 €',
]); ]);
await clipboard.lockAndPerform(async (cb) => { await copyAndCheck(clipboard, [
await copyAndCheck(cb, [
'20/10/03', '20/10/03 INVALID', '20/10/03', '20/10/03 INVALID',
'10/20/03', '10/20/03 INVALID', '10/20/03', '10/20/03 INVALID',
'1/2/3', '1/2/3 INVALID', '1/2/3', '1/2/3 INVALID',
@ -428,7 +407,6 @@ describe('CopyPaste', function() {
'$1', '$1', // invalid in Numbers.parsed, but a valid reference '$1', '$1', // invalid in Numbers.parsed, but a valid reference
'€89', '89,00 €', '€89', '89,00 €',
]); ]);
});
} }
await checkRefsToNumbers(); await checkRefsToNumbers();
@ -461,9 +439,7 @@ describe('CopyPaste', function() {
// Now test that pasting the same values into a Reference List column // Now test that pasting the same values into a Reference List column
// produces the same result (reflists containing a single reference) // produces the same result (reflists containing a single reference)
await gu.setType(/Reference List/); await gu.setType(/Reference List/, {apply: true});
await gu.applyTypeTransform();
await gu.waitForServer();
// Clear the Parsed column. Make sure we don't edit the column header. // Clear the Parsed column. Make sure we don't edit the column header.
await gu.getCell({col: "Parsed", rowNum: 1}).click(); await gu.getCell({col: "Parsed", rowNum: 1}).click();
@ -478,8 +454,7 @@ describe('CopyPaste', function() {
async function checkMultiRefs() { async function checkMultiRefs() {
await gu.setRefShowColumn("Row ID"); await gu.setRefShowColumn("Row ID");
await clipboard.lockAndPerform(async (cb) => { await copyAndCheck(clipboard, [
await copyAndCheck(cb, [
'"(2)",$1', '"(2)",$1 INVALID', '"(2)",$1', '"(2)",$1 INVALID',
'$1,(2),22', '$1,(2),22 INVALID', '$1,(2),22', '$1,(2),22 INVALID',
'["$1",-2]', '["$1",-2] INVALID', '["$1",-2]', '["$1",-2] INVALID',
@ -489,12 +464,10 @@ describe('CopyPaste', function() {
'7,0', '7,0 INVALID', // 0 is not a valid row ID '7,0', '7,0 INVALID', // 0 is not a valid row ID
'', '', '', '',
]); ]);
});
await gu.setRefShowColumn("Text"); await gu.setRefShowColumn("Text");
await clipboard.lockAndPerform(async (cb) => { await copyAndCheck(clipboard, [
await copyAndCheck(cb, [
'"(2)",$1', '(2)\n$1', // only verbatim text '"(2)",$1', '(2)\n$1', // only verbatim text
'$1,(2),22', '$1,(2),22 INVALID', // 22 is invalid so whole thing fails '$1,(2),22', '$1,(2),22 INVALID', // 22 is invalid so whole thing fails
'["$1",-2]', '["$1",-2] INVALID', // -2 is invalid because this is text, not parsed '["$1",-2]', '["$1",-2] INVALID', // -2 is invalid because this is text, not parsed
@ -504,12 +477,10 @@ describe('CopyPaste', function() {
'7,0', '7,0 INVALID', '7,0', '7,0 INVALID',
'', '', '', '',
]); ]);
});
await gu.setRefShowColumn("Parsed"); await gu.setRefShowColumn("Parsed");
await clipboard.lockAndPerform(async (cb) => { await copyAndCheck(clipboard, [
await copyAndCheck(cb, [
'"(2)",$1', '-2,00 €\n$1', '"(2)",$1', '-2,00 €\n$1',
'$1,(2),22', '$1,(2),22 INVALID', '$1,(2),22', '$1,(2),22 INVALID',
'["$1",-2]', '$1\n-2,00 €', '["$1",-2]', '$1\n-2,00 €',
@ -519,7 +490,6 @@ describe('CopyPaste', function() {
'7,0', '7,0 INVALID', '7,0', '7,0 INVALID',
'', '', '', '',
], true); ], true);
});
} }
await gu.getPageItem("Multi-References").click(); await gu.getPageItem("Multi-References").click();
@ -539,8 +509,7 @@ describe('CopyPaste', function() {
await gu.getPageItem("ChoiceLists").click(); await gu.getPageItem("ChoiceLists").click();
await gu.waitForServer(); await gu.waitForServer();
await clipboard.lockAndPerform(async (cb) => { await copyAndCheck(clipboard, [
await copyAndCheck(cb, [
'', '', '', '',
'a', 'a', 'a', 'a',
@ -563,14 +532,12 @@ describe('CopyPaste', function() {
'[]', '', '[]', '',
], true); ], true);
}); });
});
it('should parse pasted datetimes', async function() { it('should parse pasted datetimes', async function() {
await gu.getPageItem("DateTimes").click(); await gu.getPageItem("DateTimes").click();
await gu.waitForServer(); await gu.waitForServer();
await clipboard.lockAndPerform(async (cb) => { await copyAndCheck(clipboard, [
await copyAndCheck(cb, [
'2021-11-12 22:57:17+03:00', '12-11-2021 21:57 SAST', // note the 1-hour difference '2021-11-12 22:57:17+03:00', '12-11-2021 21:57 SAST', // note the 1-hour difference
'2021-11-12 22:57:17+02:00', '12-11-2021 22:57 SAST', '2021-11-12 22:57:17+02:00', '12-11-2021 22:57 SAST',
'12-11-2021 22:57:17 SAST', '12-11-2021 22:57 SAST', '12-11-2021 22:57:17 SAST', '12-11-2021 22:57 SAST',
@ -584,7 +551,6 @@ describe('CopyPaste', function() {
]); ]);
}); });
}); });
});
// mapper for getVisibleGridCells to get both text and whether the cell is invalid (pink). // mapper for getVisibleGridCells to get both text and whether the cell is invalid (pink).
@ -620,7 +586,12 @@ async function copy(cb: gu.IClipboard, fromCol: 'Text' | 'Parsed') {
await paste(cb); await paste(cb);
} }
async function copyAndCheck(cb: gu.IClipboard, expected: string[], extraChecks: boolean = false) { async function copyAndCheck(
clipboard: gu.ILockableClipboard,
expected: string[],
extraChecks: boolean = false
) {
await clipboard.lockAndPerform(async (cb) => {
// Copy Text cells into the Parsed column // Copy Text cells into the Parsed column
await copy(cb, 'Text'); await copy(cb, 'Text');
await checkGridCells(expected); await checkGridCells(expected);
@ -638,11 +609,16 @@ async function copyAndCheck(cb: gu.IClipboard, expected: string[], extraChecks:
arrayRepeat(8, ''), arrayRepeat(8, ''),
); );
// Paste the text cells to the dummy textarea and copy. // Paste the text cells to the dummy textarea.
await driver.find('#dummyText').click(); await driver.find('#dummyText').click();
await gu.waitAppFocus(false); await gu.waitAppFocus(false);
await cb.paste(); await cb.paste();
}
});
if (extraChecks) {
await gu.sendKeys(await gu.selectAllKey()); await gu.sendKeys(await gu.selectAllKey());
await clipboard.lockAndPerform(async (cb) => {
await cb.copy(); await cb.copy();
await gu.sendKeys(Key.BACK_SPACE); await gu.sendKeys(Key.BACK_SPACE);
@ -650,10 +626,13 @@ async function copyAndCheck(cb: gu.IClipboard, expected: string[], extraChecks:
await gu.getCell({col: 'Text', rowNum: 1}).click(); await gu.getCell({col: 'Text', rowNum: 1}).click();
await gu.waitAppFocus(); await gu.waitAppFocus();
await paste(cb); await paste(cb);
});
await checkGridCells(expected); await checkGridCells(expected);
// Check that copying from the Parsed column back into itself doesn't change anything. // Check that copying from the Parsed column back into itself doesn't change anything.
await clipboard.lockAndPerform(async (cb) => {
await copy(cb, 'Parsed'); await copy(cb, 'Parsed');
});
await checkGridCells(expected); await checkGridCells(expected);
} }
} }

@ -8,7 +8,7 @@ import * as gu from 'test/nbrowser/gristUtils';
import {setupTestSuite} from 'test/nbrowser/testUtils'; import {setupTestSuite} from 'test/nbrowser/testUtils';
describe('CopyPasteColumnOptions', function() { describe('CopyPasteColumnOptions', function() {
this.timeout(10000); this.timeout(20000);
const cleanup = setupTestSuite(); const cleanup = setupTestSuite();
const clipboard = gu.getLockableClipboard(); const clipboard = gu.getLockableClipboard();
afterEach(() => gu.checkForErrors()); afterEach(() => gu.checkForErrors());

@ -4,7 +4,7 @@ import * as gu from 'test/nbrowser/gristUtils';
import {server, setupTestSuite} from 'test/nbrowser/testUtils'; import {server, setupTestSuite} from 'test/nbrowser/testUtils';
describe('SelectByRefList', function() { describe('SelectByRefList', function() {
this.timeout(80000); this.timeout(90000);
setupTestSuite(); setupTestSuite();
addToRepl('gu2', gu); addToRepl('gu2', gu);
gu.bigScreen(); gu.bigScreen();

@ -117,7 +117,7 @@ describe('UploadLimits', function() {
const largeFilePath2 = await generateFile(".jpg", maxAttachment - 1000); const largeFilePath2 = await generateFile(".jpg", maxAttachment - 1000);
await gu.fileDialogUpload([largeFilePath1, largeFilePath2].join(","), await gu.fileDialogUpload([largeFilePath1, largeFilePath2].join(","),
() => gu.getCell(0, 1).find('.test-attachment-icon').click()); () => gu.getCell(0, 1).find('.test-attachment-icon').click());
await gu.getCell(0, 1).findWait('.test-attachment-widget > [class*=test-pw-]', 1000); await gu.getCell(0, 1).findWait('.test-attachment-widget > [class*=test-pw-]', 2000);
// We don't expect any errors here. // We don't expect any errors here.
assert.lengthOf(await driver.findAll('.test-notifier-toast-wrapper'), 0); assert.lengthOf(await driver.findAll('.test-notifier-toast-wrapper'), 0);

@ -3305,8 +3305,9 @@ class LockableClipboard implements ILockableClipboard {
lockfilePath: path.join(path.resolve(getAppRoot(), 'test'), '.clipboard.lock'), lockfilePath: path.join(path.resolve(getAppRoot(), 'test'), '.clipboard.lock'),
retries: { retries: {
/* The clipboard generally isn't locked for long, so retry frequently. */ /* The clipboard generally isn't locked for long, so retry frequently. */
maxTimeout: 1000, minTimeout: 200,
retries: 20, maxTimeout: 200,
retries: 100,
}, },
}); });
try { try {

Loading…
Cancel
Save