mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Removing the new menu flag
Summary: Enabling the `GRIST_NEW_COLUMN_MENU` flag by default and removing it. Test Plan: Existing Reviewers: georgegevoian Reviewed By: georgegevoian Differential Revision: https://phab.getgrist.com/D4098
This commit is contained in:
@@ -461,6 +461,7 @@ describe('CellColor', function() {
|
||||
it('should handle correctly default text color', async function() {
|
||||
// Create new checkbox column
|
||||
await driver.find('.mod-add-column').click();
|
||||
await driver.find('.test-new-columns-menu-add-new').click();
|
||||
await gu.waitForServer();
|
||||
await gu.setType(/Toggle/);
|
||||
|
||||
@@ -497,6 +498,8 @@ describe('CellColor', function() {
|
||||
|
||||
// create a new checkbox column
|
||||
await driver.find('.mod-add-column').click();
|
||||
await driver.find('.test-new-columns-menu-add-new').click();
|
||||
|
||||
await gu.waitForServer();
|
||||
await gu.setType(/Toggle/);
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ describe('ColumnOps.ntest', function() {
|
||||
|
||||
it("should allow adding and deleting columns", async function() {
|
||||
await gu.clickColumnMenuItem('Name', 'Insert column to the right');
|
||||
await $('.test-new-columns-menu-add-new').click();
|
||||
await gu.waitForServer();
|
||||
// Newly created columns labels become editable automatically. The next line checks that the
|
||||
// label is editable and then closes the editor.
|
||||
@@ -78,7 +79,7 @@ describe('ColumnOps.ntest', function() {
|
||||
// Then show it using the add column menu
|
||||
await $('.mod-add-column').scrollIntoView(true);
|
||||
await $(".mod-add-column").click();
|
||||
await gu.actions.selectFloatingOption('Show column Name');
|
||||
await showColumn('Name');
|
||||
await gu.waitForServer();
|
||||
await assert.isPresent(gu.getColumnHeader('Name'), true);
|
||||
});
|
||||
@@ -86,13 +87,14 @@ describe('ColumnOps.ntest', function() {
|
||||
it("[+] button show add column directly if no hidden columns", async function() {
|
||||
await $('.mod-add-column').scrollIntoView(true);
|
||||
await $(".mod-add-column").click();
|
||||
await gu.actions.selectFloatingOption('Show column Pop');
|
||||
await showColumn("Pop");
|
||||
await gu.waitForServer();
|
||||
await assert.isPresent(gu.getColumnHeader("Pop. '000"), true);
|
||||
|
||||
await assert.isPresent(gu.getColumnHeader('B'), false);
|
||||
await $('.mod-add-column').scrollIntoView(true);
|
||||
await $(".mod-add-column").click();
|
||||
await $('.test-new-columns-menu-add-new').click();
|
||||
await gu.waitToPass(() => gu.getColumnHeader('B'));
|
||||
await gu.getOpenEditingLabel(await gu.getColumnHeader('B')).wait().sendKeys($.ENTER);
|
||||
await gu.waitForServer();
|
||||
@@ -273,3 +275,7 @@ describe('ColumnOps.ntest', function() {
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
function showColumn(name) {
|
||||
return $(`.test-new-columns-menu-hidden-column-inlined:contains(${name})`).click();
|
||||
}
|
||||
|
||||
@@ -577,6 +577,7 @@ async function clickAddDescription() {
|
||||
|
||||
async function addColumn() {
|
||||
await driver.find(".mod-add-column").click();
|
||||
await driver.find('.test-new-columns-menu-add-new').click();
|
||||
await gu.waitForServer();
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -129,23 +129,23 @@ describe('MultiColumn', function() {
|
||||
|
||||
it('should show proper behavior label', async () => {
|
||||
await selectColumns('Test1');
|
||||
assert.equal(await columnBehavior(), 'Empty Column');
|
||||
assert.equal(await gu.columnBehavior(), 'Empty Column');
|
||||
await selectColumns('Test1', 'Test3');
|
||||
assert.equal(await columnBehavior(), 'Empty Columns');
|
||||
assert.equal(await gu.columnBehavior(), 'Empty Columns');
|
||||
|
||||
// Change first to be data column.
|
||||
await selectColumns('Test1');
|
||||
await driver.find(".test-field-set-data").click();
|
||||
await gu.waitForServer();
|
||||
await selectColumns('Test1', 'Test3');
|
||||
assert.equal(await columnBehavior(), 'Mixed Behavior');
|
||||
assert.equal(await gu.columnBehavior(), 'Mixed Behavior');
|
||||
|
||||
// Change second to be a data column
|
||||
await selectColumns('Test2');
|
||||
await driver.find(".test-field-set-data").click();
|
||||
await gu.waitForServer();
|
||||
await selectColumns('Test1', 'Test2');
|
||||
assert.equal(await columnBehavior(), 'Data Columns');
|
||||
assert.equal(await gu.columnBehavior(), 'Data Columns');
|
||||
// Now make them all formulas
|
||||
await gu.sendActions([
|
||||
['ModifyColumn', 'Table1', 'Test1', {formula: '1', isFormula: true}],
|
||||
@@ -153,13 +153,13 @@ describe('MultiColumn', function() {
|
||||
['ModifyColumn', 'Table1', 'Test3', {formula: '1', isFormula: true}],
|
||||
]);
|
||||
await selectColumns('Test1', 'Test3');
|
||||
assert.equal(await columnBehavior(), 'Formula Columns');
|
||||
assert.equal(await gu.columnBehavior(), 'Formula Columns');
|
||||
|
||||
// Make one of them data column and test that the mix is recognized.
|
||||
await selectColumns('Test1');
|
||||
await gu.changeBehavior('Convert column to data');
|
||||
await selectColumns('Test1', 'Test3');
|
||||
assert.equal(await columnBehavior(), 'Mixed Behavior');
|
||||
assert.equal(await gu.columnBehavior(), 'Mixed Behavior');
|
||||
});
|
||||
|
||||
it('should reset multiple columns', async () => {
|
||||
@@ -170,14 +170,14 @@ describe('MultiColumn', function() {
|
||||
['ModifyColumn', 'Table1', 'Test3', {formula: '1', isFormula: true}],
|
||||
]);
|
||||
await selectColumns('Test1', 'Test3');
|
||||
assert.equal(await columnBehavior(), 'Formula Columns');
|
||||
assert.equal(await gu.columnBehavior(), 'Formula Columns');
|
||||
await alignment('center');
|
||||
assert.equal(await alignment(), 'center');
|
||||
|
||||
// Reset all of them
|
||||
assert.deepEqual(await gu.availableBehaviorOptions(), ['Convert columns to data', 'Clear and reset']);
|
||||
await gu.changeBehavior('Clear and reset');
|
||||
assert.equal(await columnBehavior(), 'Empty Columns');
|
||||
assert.equal(await gu.columnBehavior(), 'Empty Columns');
|
||||
assert.equal(await alignment(), 'left');
|
||||
|
||||
// Make them all data columns
|
||||
@@ -185,17 +185,17 @@ describe('MultiColumn', function() {
|
||||
await gu.getCell('Test2', 1).click(); await gu.enterCell('a');
|
||||
await gu.getCell('Test3', 1).click(); await gu.enterCell('a');
|
||||
await selectColumns('Test1', 'Test3');
|
||||
assert.equal(await columnBehavior(), 'Data Columns');
|
||||
assert.equal(await gu.columnBehavior(), 'Data Columns');
|
||||
await selectColumns('Test1');
|
||||
assert.equal(await columnBehavior(), 'Data Column');
|
||||
assert.equal(await gu.columnBehavior(), 'Data Column');
|
||||
|
||||
// Reset all of them
|
||||
await selectColumns('Test1', 'Test3');
|
||||
assert.deepEqual(await gu.availableBehaviorOptions(), ['Clear and reset']);
|
||||
await gu.changeBehavior('Clear and reset');
|
||||
assert.equal(await columnBehavior(), 'Empty Columns');
|
||||
assert.equal(await gu.columnBehavior(), 'Empty Columns');
|
||||
await selectColumns('Test1');
|
||||
assert.equal(await columnBehavior(), 'Empty Column');
|
||||
assert.equal(await gu.columnBehavior(), 'Empty Column');
|
||||
assert.equal(await gu.getCell('Test1', 1).getText(), '');
|
||||
assert.equal(await gu.getCell('Test2', 1).getText(), '');
|
||||
assert.equal(await gu.getCell('Test3', 1).getText(), '');
|
||||
@@ -203,12 +203,12 @@ describe('MultiColumn', function() {
|
||||
|
||||
it('should convert to data multiple columns', async () => {
|
||||
await selectColumns('Test1', 'Test3');
|
||||
assert.equal(await columnBehavior(), 'Empty Columns');
|
||||
assert.equal(await gu.columnBehavior(), 'Empty Columns');
|
||||
assert.deepEqual(await gu.availableBehaviorOptions(), ['Convert columns to data', 'Clear and reset']);
|
||||
await gu.changeBehavior('Convert columns to data');
|
||||
assert.equal(await columnBehavior(), 'Data Columns');
|
||||
assert.equal(await gu.columnBehavior(), 'Data Columns');
|
||||
await selectColumns('Test1');
|
||||
assert.equal(await columnBehavior(), 'Data Column');
|
||||
assert.equal(await gu.columnBehavior(), 'Data Column');
|
||||
|
||||
// Now make them all formula columns
|
||||
await gu.sendActions([
|
||||
@@ -217,14 +217,14 @@ describe('MultiColumn', function() {
|
||||
['ModifyColumn', 'Table1', 'Test3', {formula: '3', isFormula: true}],
|
||||
]);
|
||||
await selectColumns('Test1', 'Test3');
|
||||
assert.equal(await columnBehavior(), 'Formula Columns');
|
||||
assert.equal(await gu.columnBehavior(), 'Formula Columns');
|
||||
|
||||
// Convert them to data
|
||||
assert.deepEqual(await gu.availableBehaviorOptions(), ['Convert columns to data', 'Clear and reset']);
|
||||
await gu.changeBehavior('Convert columns to data');
|
||||
assert.equal(await columnBehavior(), 'Data Columns');
|
||||
assert.equal(await gu.columnBehavior(), 'Data Columns');
|
||||
await selectColumns('Test1');
|
||||
assert.equal(await columnBehavior(), 'Data Column');
|
||||
assert.equal(await gu.columnBehavior(), 'Data Column');
|
||||
// Test that data stays.
|
||||
assert.equal(await gu.getCell('Test1', 1).getText(), '1');
|
||||
assert.equal(await gu.getCell('Test2', 1).getText(), '2');
|
||||
@@ -1250,9 +1250,7 @@ async function toggleDerived() {
|
||||
await gu.waitForServer();
|
||||
}
|
||||
|
||||
async function columnBehavior() {
|
||||
return (await driver.find(".test-field-behaviour").getText());
|
||||
}
|
||||
|
||||
|
||||
async function wrapDisabled() {
|
||||
return (await driver.find(".test-tb-wrap-text > div").matches('[class*=disabled]'));
|
||||
|
||||
@@ -20,6 +20,7 @@ describe('ReferenceColumns', function() {
|
||||
it('should render Row ID values as TableId[RowId]', async function() {
|
||||
await driver.find('.test-right-tab-field').click();
|
||||
await driver.find('.mod-add-column').click();
|
||||
await driver.findWait('.test-new-columns-menu-add-new', 100).click();
|
||||
await gu.waitForServer();
|
||||
await gu.setType(/Reference/);
|
||||
await gu.waitForServer();
|
||||
|
||||
@@ -253,6 +253,8 @@ describe('ReferenceList', function() {
|
||||
// Create a new Reference List column.
|
||||
await driver.find('.test-right-tab-field').click();
|
||||
await driver.find('.mod-add-column').click();
|
||||
await driver.findWait('.test-new-columns-menu-add-new', 100).click();
|
||||
|
||||
await gu.waitForServer();
|
||||
await gu.setType(/Reference List/);
|
||||
await gu.waitForServer();
|
||||
|
||||
@@ -133,6 +133,7 @@ describe('TextEditor.ntest', function() {
|
||||
async function addColumnRightOf(index) {
|
||||
// Add a column. We have to hover over the column header first.
|
||||
await gu.openColumnMenu({col: index}, 'Insert column to the right');
|
||||
await driver.find('.test-new-columns-menu-add-new').click();
|
||||
await gu.waitForServer();
|
||||
await gu.sendKeys($.ESCAPE);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ import {CommandName} from 'app/client/components/commandList';
|
||||
import {csvDecodeRow} from 'app/common/csvFormat';
|
||||
import { AccessLevel } from 'app/common/CustomWidget';
|
||||
import { decodeUrl } from 'app/common/gristUrls';
|
||||
import { isAffirmative } from "app/common/gutil";
|
||||
import { FullUser, UserProfile } from 'app/common/LoginSessionAPI';
|
||||
import { resetOrg } from 'app/common/resetOrg';
|
||||
import { UserAction } from 'app/common/DocActions';
|
||||
@@ -689,20 +688,26 @@ export async function enterFormula(formula: string) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that formula editor is shown and its value matches the given regexp.
|
||||
* Check that formula editor is shown and returns its value.
|
||||
* By default returns only text that is visible to the user, pass false to get all text.
|
||||
*/
|
||||
export async function getFormulaText() {
|
||||
export async function getFormulaText(onlyVisible = true): Promise<string> {
|
||||
assert.equal(await driver.findWait('.test-formula-editor', 500).isDisplayed(), true);
|
||||
return await driver.find('.code_editor_container').getText();
|
||||
if (onlyVisible) {
|
||||
return await driver.find('.code_editor_container').getText();
|
||||
} else {
|
||||
return await driver.executeScript(
|
||||
() => (document as any).querySelector(".code_editor_container").innerText
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that formula editor is shown and its value matches the given regexp.
|
||||
*/
|
||||
export async function checkFormulaEditor(value: RegExp|string) {
|
||||
assert.equal(await driver.findWait('.test-formula-editor', 500).isDisplayed(), true);
|
||||
const valueRe = typeof value === 'string' ? exactMatch(value) : value;
|
||||
assert.match(await driver.find('.code_editor_container').getText(), valueRe);
|
||||
assert.match(await getFormulaText(), valueRe);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1291,6 +1296,40 @@ export async function begin(invariant: () => any = () => true) {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* A hook that can be used to clear a state after suite is finished and current test passed.
|
||||
* If under debugging session and NO_CLEANUP env variable is set it will skip this cleanup and allow you
|
||||
* to examine the state of the database or browser.
|
||||
*/
|
||||
export function afterCleanup(test: () => void | Promise<void>) {
|
||||
after(function() {
|
||||
if (process.env.NO_CLEANUP) {
|
||||
function anyTestFailed(suite: Mocha.Suite): boolean {
|
||||
return suite.tests.some(t => t.state === 'failed') || suite.suites.some(anyTestFailed);
|
||||
}
|
||||
|
||||
if (this.currentTest?.parent && anyTestFailed(this.currentTest?.parent)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
return test();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* A hook that can be used to clear state after each test that has passed.
|
||||
* If under debugging session and NO_CLEANUP env variable is set it will skip this cleanup and allow you
|
||||
* to examine the state of the database or browser.
|
||||
*/
|
||||
export function afterEachCleanup(test: () => void | Promise<void>) {
|
||||
afterEach(function() {
|
||||
if (this.currentTest?.state !== 'passed' && !this.currentTest?.pending && process.env.NO_CLEANUP) {
|
||||
return;
|
||||
}
|
||||
return test();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Simulates a transaction on the GristDoc. Use with cautions, as there is no guarantee it will undo correctly
|
||||
* in a case of failure.
|
||||
@@ -1546,6 +1585,7 @@ export function openColumnMenu(col: IColHeader|string, option?: string): WebElem
|
||||
export async function deleteColumn(col: IColHeader|string) {
|
||||
await openColumnMenu(col, 'Delete column');
|
||||
await waitForServer();
|
||||
await wipeToasts();
|
||||
}
|
||||
|
||||
export type ColumnType =
|
||||
@@ -2339,9 +2379,7 @@ export function hexToRgb(hex: string) {
|
||||
export async function addColumn(name: string, type?: string) {
|
||||
await scrollIntoView(await driver.find('.active_section .mod-add-column'));
|
||||
await driver.find('.active_section .mod-add-column').click();
|
||||
if (isAffirmative(process.env.GRIST_NEW_COLUMN_MENU)) {
|
||||
await driver.findWait('.test-new-columns-menu-add-new', 100).click();
|
||||
}
|
||||
await driver.findWait('.test-new-columns-menu-add-new', 100).click();
|
||||
// If we are on a summary table, we could be see a menu helper
|
||||
const menu = (await driver.findAll('.grist-floating-menu'))[0];
|
||||
if (menu) {
|
||||
@@ -2360,7 +2398,11 @@ export async function addColumn(name: string, type?: string) {
|
||||
export async function showColumn(name: string) {
|
||||
await scrollIntoView(await driver.find('.active_section .mod-add-column'));
|
||||
await driver.find('.active_section .mod-add-column').click();
|
||||
await driver.findContent('.grist-floating-menu li', `Show column ${name}`).click();
|
||||
if (await driver.findContent('.test-new-columns-menu-hidden-column-inlined', `${name}`).isPresent()) {
|
||||
await driver.findContent('.test-new-columns-menu-hidden-column-inlined', `${name}`).click();
|
||||
} else {
|
||||
await driver.findContent('.test-new-columns-menu-hidden-column-collapsed', `${name}`).click();
|
||||
}
|
||||
await waitForServer();
|
||||
}
|
||||
|
||||
@@ -2739,6 +2781,40 @@ export async function onNewTab(action: () => Promise<void>) {
|
||||
await driver.switchTo().window(tabs[tabs.length - 2]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a controller for the current tab.
|
||||
*/
|
||||
export async function myTab() {
|
||||
const tabs = await driver.getAllWindowHandles();
|
||||
const myTab = tabs[tabs.length - 1];
|
||||
return {
|
||||
open() {
|
||||
return driver.switchTo().window(myTab);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicate current tab and return a controller for it. Assumes the current tab shows document.
|
||||
*/
|
||||
export async function duplicateTab() {
|
||||
const url = await driver.getCurrentUrl();
|
||||
await driver.executeScript("window.open('about:blank', '_blank')");
|
||||
const tabs = await driver.getAllWindowHandles();
|
||||
const myTab = tabs[tabs.length - 1];
|
||||
await driver.switchTo().window(myTab);
|
||||
await driver.get(url);
|
||||
await waitForDocToLoad();
|
||||
return {
|
||||
close() {
|
||||
return driver.close();
|
||||
},
|
||||
open() {
|
||||
return driver.switchTo().window(myTab);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Scrolls active Grid or Card list view.
|
||||
*/
|
||||
@@ -3042,6 +3118,10 @@ export async function changeBehavior(option: BehaviorActions|RegExp) {
|
||||
await waitForServer();
|
||||
}
|
||||
|
||||
export async function columnBehavior() {
|
||||
return (await driver.find(".test-field-behaviour").getText());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all available options in the behavior menu.
|
||||
*/
|
||||
@@ -3426,15 +3506,15 @@ class Clipboard implements IClipboard {
|
||||
/**
|
||||
* Runs a Grist command in the browser window.
|
||||
*/
|
||||
export async function sendCommand(name: CommandName) {
|
||||
await driver.executeAsyncScript((name: any, done: any) => {
|
||||
const result = (window as any).gristApp.allCommands[name].run();
|
||||
export async function sendCommand(name: CommandName, argument: any = null) {
|
||||
await driver.executeAsyncScript((name: any, argument: any, done: any) => {
|
||||
const result = (window as any).gristApp.allCommands[name].run(argument);
|
||||
if (result?.finally) {
|
||||
result.finally(done);
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
}, name);
|
||||
}, name, argument);
|
||||
await waitForServer();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user