mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
reconcile boot and admin pages further (#963)
This adds some remaining parts of the boot page to the admin panel, and then removes the boot page.
This commit is contained in:
@@ -31,7 +31,7 @@ describe('AdminPanel', function() {
|
||||
await server.restart(true);
|
||||
});
|
||||
|
||||
it('should not be shown to non-managers', async function() {
|
||||
it('should show an explanation to non-managers', async function() {
|
||||
session = await gu.session().user('user2').personalSite.login();
|
||||
await session.loadDocMenu('/');
|
||||
|
||||
@@ -42,8 +42,9 @@ describe('AdminPanel', function() {
|
||||
|
||||
// Try loading the URL directly.
|
||||
await driver.get(`${server.getHost()}/admin`);
|
||||
assert.match(await driver.findWait('.test-error-header', 2000).getText(), /Access denied/);
|
||||
assert.equal(await driver.find('.test-admin-panel').isPresent(), false);
|
||||
await waitForAdminPanel();
|
||||
assert.equal(await driver.find('.test-admin-panel').isDisplayed(), true);
|
||||
assert.match(await driver.find('.test-admin-panel').getText(), /Administrator Panel Unavailable/);
|
||||
});
|
||||
|
||||
it('should be shown to managers', async function() {
|
||||
@@ -192,6 +193,23 @@ describe('AdminPanel', function() {
|
||||
// useful there yet.
|
||||
});
|
||||
|
||||
it('should show various self checks', async function() {
|
||||
await driver.get(`${server.getHost()}/admin`);
|
||||
await waitForAdminPanel();
|
||||
await gu.waitToPass(
|
||||
async () => {
|
||||
assert.equal(await driver.find('.test-admin-panel-item-name-probe-reachable').isDisplayed(), true);
|
||||
assert.match(await driver.find('.test-admin-panel-item-value-probe-reachable').getText(), /✅/);
|
||||
},
|
||||
3000,
|
||||
);
|
||||
assert.equal(await driver.find('.test-admin-panel-item-name-probe-system-user').isDisplayed(), true);
|
||||
await gu.waitToPass(
|
||||
async () => assert.match(await driver.find('.test-admin-panel-item-value-probe-system-user').getText(), /✅/),
|
||||
3000,
|
||||
);
|
||||
});
|
||||
|
||||
const upperCheckNow = () => driver.find('.test-admin-panel-updates-upper-check-now');
|
||||
const lowerCheckNow = () => driver.find('.test-admin-panel-updates-lower-check-now');
|
||||
const autoCheckToggle = () => driver.find('.test-admin-panel-updates-auto-check');
|
||||
@@ -313,6 +331,33 @@ describe('AdminPanel', function() {
|
||||
});
|
||||
assert.isNotEmpty(fakeServer.payload.installationId);
|
||||
});
|
||||
|
||||
it('should survive APP_HOME_URL misconfiguration', async function() {
|
||||
process.env.APP_HOME_URL = 'http://misconfigured.invalid';
|
||||
process.env.GRIST_BOOT_KEY = 'zig';
|
||||
await server.restart(true);
|
||||
await driver.get(`${server.getHost()}/admin`);
|
||||
await waitForAdminPanel();
|
||||
});
|
||||
|
||||
it('should honor GRIST_BOOT_KEY fallback', async function() {
|
||||
await gu.removeLogin();
|
||||
await driver.get(`${server.getHost()}/admin`);
|
||||
await waitForAdminPanel();
|
||||
assert.equal(await driver.find('.test-admin-panel').isDisplayed(), true);
|
||||
assert.match(await driver.find('.test-admin-panel').getText(), /Administrator Panel Unavailable/);
|
||||
|
||||
process.env.GRIST_BOOT_KEY = 'zig';
|
||||
await server.restart(true);
|
||||
await driver.get(`${server.getHost()}/admin?boot-key=zig`);
|
||||
await waitForAdminPanel();
|
||||
assert.equal(await driver.find('.test-admin-panel').isDisplayed(), true);
|
||||
assert.notMatch(await driver.find('.test-admin-panel').getText(), /Administrator Panel Unavailable/);
|
||||
await driver.get(`${server.getHost()}/admin?boot-key=zig-wrong`);
|
||||
await waitForAdminPanel();
|
||||
assert.equal(await driver.find('.test-admin-panel').isDisplayed(), true);
|
||||
assert.match(await driver.find('.test-admin-panel').getText(), /Administrator Panel Unavailable/);
|
||||
});
|
||||
});
|
||||
|
||||
async function assertTelemetryLevel(level: TelemetryLevel) {
|
||||
|
||||
@@ -3,6 +3,10 @@ import * as gu from 'test/nbrowser/gristUtils';
|
||||
import {server, setupTestSuite} from 'test/nbrowser/testUtils';
|
||||
import * as testUtils from 'test/server/testUtils';
|
||||
|
||||
/**
|
||||
* The boot page functionality has been merged with the Admin Panel.
|
||||
* Check that it behaves as a boot page did now.
|
||||
*/
|
||||
describe('Boot', function() {
|
||||
this.timeout(30000);
|
||||
setupTestSuite();
|
||||
@@ -12,13 +16,24 @@ describe('Boot', function() {
|
||||
afterEach(() => gu.checkForErrors());
|
||||
|
||||
async function hasPrompt() {
|
||||
assert.include(
|
||||
await driver.findContentWait('p', /diagnostics page/, 2000).getText(),
|
||||
'A diagnostics page can be made available');
|
||||
// There is some glitchiness to when the text appears.
|
||||
await gu.waitToPass(async () => {
|
||||
assert.include(
|
||||
await driver.findContentWait('pre', /GRIST_BOOT_KEY/, 2000).getText(),
|
||||
'GRIST_BOOT_KEY=example-');
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
it('gives prompt about how to enable boot page', async function() {
|
||||
it('tells user about /admin', async function() {
|
||||
await driver.get(`${server.getHost()}/boot`);
|
||||
assert.match(await driver.getPageSource(), /\/admin/);
|
||||
// Switch to a regular place to that gu.checkForErrors won't panic -
|
||||
// it needs a Grist page.
|
||||
await driver.get(`${server.getHost()}`);
|
||||
});
|
||||
|
||||
it('gives prompt about how to enable boot page', async function() {
|
||||
await driver.get(`${server.getHost()}/admin`);
|
||||
await hasPrompt();
|
||||
});
|
||||
|
||||
@@ -35,18 +50,18 @@ describe('Boot', function() {
|
||||
});
|
||||
|
||||
it('gives prompt when key is missing', async function() {
|
||||
await driver.get(`${server.getHost()}/boot`);
|
||||
await driver.get(`${server.getHost()}/admin`);
|
||||
await hasPrompt();
|
||||
});
|
||||
|
||||
it('gives prompt when key is wrong', async function() {
|
||||
await driver.get(`${server.getHost()}/boot/bilbo`);
|
||||
await driver.get(`${server.getHost()}/admin?boot-key=bilbo`);
|
||||
await hasPrompt();
|
||||
});
|
||||
|
||||
it('gives page when key is right', async function() {
|
||||
await driver.get(`${server.getHost()}/boot/lala`);
|
||||
await driver.findContentWait('h2', /Grist is reachable/, 2000);
|
||||
await driver.get(`${server.getHost()}/admin?boot-key=lala`);
|
||||
await driver.findContentWait('div', /Is home page available/, 2000);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user