make Importer tests a bit more robust maybe

This commit is contained in:
Paul Fitzpatrick 2024-10-10 14:21:04 -04:00
parent 55346a33ed
commit 7153f817d9
No known key found for this signature in database
GPG Key ID: 07F16BF3214888F6
2 changed files with 14 additions and 6 deletions

View File

@ -19,6 +19,8 @@ describe('Importer', function() {
// have tests go faster. Each successful test case should leave the document unchanged. // have tests go faster. Each successful test case should leave the document unchanged.
if (!docUrl || !await gu.testCurrentUrl(docUrl)) { if (!docUrl || !await gu.testCurrentUrl(docUrl)) {
const session = await gu.session().teamSite.login(); const session = await gu.session().teamSite.login();
// We'll be checking colors, so standardize theme.
await gu.setGristTheme({appearance: 'light', syncWithOS: false});
await session.tempDoc(cleanup, 'Hello.grist'); await session.tempDoc(cleanup, 'Hello.grist');
docUrl = await driver.getCurrentUrl(); docUrl = await driver.getCurrentUrl();
} }
@ -450,9 +452,9 @@ describe('Importer', function() {
assert.equal(await driver.findWait('.test-importer-preview', 2000).isPresent(), true); assert.equal(await driver.findWait('.test-importer-preview', 2000).isPresent(), true);
// Check that the merge field select button has a red outline. // Check that the merge field select button has a red outline.
assert.equal( assert.match(
await driver.find('.test-importer-merge-fields-select').getCssValue('border'), await driver.find('.test-importer-merge-fields-select').getCssValue('border'),
'1px solid rgb(208, 2, 27)' /solid rgb\(208, 2, 27\)/
); );
// Select a merge field, and check that the red outline is gone. // Select a merge field, and check that the red outline is gone.
@ -461,9 +463,9 @@ describe('Importer', function() {
'.test-multi-select-menu .test-multi-select-menu-option', '.test-multi-select-menu .test-multi-select-menu-option',
/Name/ /Name/
).click(); ).click();
assert.equal( assert.match(
await driver.find('.test-importer-merge-fields-select').getCssValue('border'), await driver.find('.test-importer-merge-fields-select').getCssValue('border'),
'1px solid rgb(217, 217, 217)' /solid rgb\(217, 217, 217\)/
); );
// Hide dropdown // Hide dropdown
await gu.sendKeys(Key.ESCAPE); await gu.sendKeys(Key.ESCAPE);
@ -584,9 +586,9 @@ describe('Importer', function() {
await driver.findContent('.test-importer-source', /UploadedData2Extended.csv/).click(); await driver.findContent('.test-importer-source', /UploadedData2Extended.csv/).click();
// Check that it failed, and that the merge fields select button is outlined in red. // Check that it failed, and that the merge fields select button is outlined in red.
assert.equal( assert.match(
await driver.find('.test-importer-merge-fields-select').getCssValue('border'), await driver.find('.test-importer-merge-fields-select').getCssValue('border'),
'1px solid rgb(208, 2, 27)' /solid rgb\(208, 2, 27\)/
); );
assert.equal( assert.equal(
await driver.find('.test-importer-source-selected .test-importer-from').getText(), await driver.find('.test-importer-source-selected .test-importer-from').getText(),

View File

@ -36,6 +36,12 @@ export const getPreviewDiffCellValues = stackWrapFunc(async (cols: number[], row
// Helper that waits for the diff preview to finish loading. // Helper that waits for the diff preview to finish loading.
export const waitForDiffPreviewToLoad = stackWrapFunc(async (): Promise<void> => { export const waitForDiffPreviewToLoad = stackWrapFunc(async (): Promise<void> => {
await driver.wait(() => driver.find('.test-importer-preview').isPresent(), 5000); await driver.wait(() => driver.find('.test-importer-preview').isPresent(), 5000);
await gu.waitToPass(async () => {
const preview = (await getPreviewDiffCellValues([0], [1]))[0];
if (preview[0] === undefined && preview[1] === undefined) {
throw new Error('sometimes data is a little slow to show up?');
}
}, 2000);
}); });
// Helper that gets the list of visible column matching rows to the left of the preview. // Helper that gets the list of visible column matching rows to the left of the preview.