(core) Add TSV and DSV import/export

Summary: Adds support for importing .dsv files (an April Fools 2024 easter egg), and options for exporting .dsv and .tsv files from the Share menu.

Test Plan: Browser and server tests.

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D4210
This commit is contained in:
George Gevoian
2024-03-20 09:58:24 -04:00
parent 48a8af83fc
commit 07fcce548b
15 changed files with 2672 additions and 45 deletions

View File

@@ -1,4 +1,4 @@
import { assert } from 'mocha-webdriver';
import { assert, driver } from 'mocha-webdriver';
import { $, gu, test } from 'test/nbrowser/gristUtil-nbrowser';
const fse = require('fs-extra');
@@ -35,7 +35,10 @@ describe('Export.ntest', function() {
await $('.test-tb-share').click();
// Once the menu opens, get the href of the link.
await $('.grist-floating-menu').wait();
const href = await $('.grist-floating-menu a:contains(CSV)').wait().getAttribute('href');
const submenu = $('.test-tb-share-option:contains(Export as...)');
await driver.withActions(a => a.move({origin: submenu.elem()}));
const href = await $('.grist-floating-menu a:contains(Comma Separated Values)').wait()
.getAttribute('href');
// Download the data at the link and compare to expected.
const resp = await axios.get(href, {responseType: 'text', headers});
assert.equal(resp.headers['content-disposition'],
@@ -50,7 +53,10 @@ describe('Export.ntest', function() {
await $('.test-tb-share').click();
// Once the menu opens, get the href of the link.
await $('.grist-floating-menu').wait();
const href = await $('.grist-floating-menu a:contains(CSV)').wait().getAttribute('href');
const submenu = $('.test-tb-share-option:contains(Export as...)');
await driver.withActions(a => a.move({origin: submenu.elem()}));
const href = await $('.grist-floating-menu a:contains(Comma Separated Values)').wait()
.getAttribute('href');
// Download the data at the link and compare to expected.
const resp = await axios.get(href, {responseType: 'text', headers});
assert.equal(resp.data, dataExpected.sorted);