(core) Focusing the creator panel on the table wiget for charts and custom views

Summary:
When a chart page/section is added and the creator panel is already open, focus is set to a "table" tab.
When a custom view is added as a page/section, the same thing happens, but there is also a behavioral tooltip shown
for the custom URL.

Test Plan: Updated and added.

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D3857
This commit is contained in:
Jarosław Sadziński
2023-04-14 12:09:50 +02:00
parent cc0e1154d0
commit 40ea6bb2bc
11 changed files with 134 additions and 7 deletions

View File

@@ -4,10 +4,76 @@ import {server, setupTestSuite} from 'test/nbrowser/testUtils';
describe('RightPanel', function() {
this.timeout(20000);
setupTestSuite();
const cleanup = setupTestSuite();
afterEach(() => gu.checkForErrors());
it('should focus on the creator panel when chart/custom section is added', async () => {
const mainSession = await gu.session().teamSite.login();
await mainSession.tempNewDoc(cleanup);
// Close panel and make sure it stays closed.
await gu.toggleSidePanel('right', 'close');
// Add a chart section.
await gu.addNewSection('Chart', 'Table1');
assert.isFalse(await gu.isSidePanelOpen('right'));
await gu.undo();
// Add a chart page.
await gu.addNewPage('Chart', 'Table1');
assert.isFalse(await gu.isSidePanelOpen('right'));
await gu.undo();
// Add a custom section.
await gu.addNewSection('Custom', 'Table1');
assert.isFalse(await gu.isSidePanelOpen('right'));
await gu.undo();
// Add a custom page.
await gu.addNewPage('Custom', 'Table1');
assert.isFalse(await gu.isSidePanelOpen('right'));
await gu.undo();
// Now open the panel on the column tab.
const columnTab = async () => {
await gu.toggleSidePanel('right', 'open');
await driver.find('.test-right-tab-field').click();
};
await columnTab();
// Add a chart section.
await gu.addNewSection('Chart', 'Table1');
assert.isTrue(await gu.isSidePanelOpen('right'));
assert.isTrue(await driver.find('.test-right-widget-title').isDisplayed());
await gu.undo();
await columnTab();
// Add a chart page.
await gu.addNewPage('Chart', 'Table1');
assert.isTrue(await gu.isSidePanelOpen('right'));
assert.isTrue(await driver.find('.test-right-widget-title').isDisplayed());
await gu.undo();
await columnTab();
// Add a custom section.
await gu.addNewSection('Custom', 'Table1');
assert.isTrue(await gu.isSidePanelOpen('right'));
assert.isTrue(await driver.find('.test-right-widget-title').isDisplayed());
await gu.undo();
await columnTab();
// Add a custom page.
await gu.addNewPage('Custom', 'Table1');
assert.isTrue(await gu.isSidePanelOpen('right'));
assert.isTrue(await driver.find('.test-right-widget-title').isDisplayed());
await gu.undo();
});
it('should open/close panel, and reflect the current section', async function() {
// Open a document with multiple views and multiple sections.
await server.simulateLogin("Chimpy", "chimpy@getgrist.com", 'nasa');
@@ -19,7 +85,7 @@ describe('RightPanel', function() {
assert.equal(await driver.find('.test-bc-page').getAttribute('value'), 'City');
// Open side pane, and check it shows the right section.
await gu.toggleSidePanel('right');
await gu.toggleSidePanel('right', 'open');
await driver.find('.test-config-widget').click();
assert.equal(await gu.isSidePanelOpen('right'), true);