mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
7a57a8c6ee
This adds some remaining parts of the boot page to the admin panel, and then removes the boot page.
65 lines
1.9 KiB
TypeScript
65 lines
1.9 KiB
TypeScript
import {assert, driver} from 'mocha-webdriver';
|
|
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();
|
|
|
|
let oldEnv: testUtils.EnvironmentSnapshot;
|
|
|
|
afterEach(() => gu.checkForErrors());
|
|
|
|
async function hasPrompt() {
|
|
assert.include(
|
|
await driver.findContentWait('pre', /GRIST_BOOT_KEY/, 2000).getText(),
|
|
'GRIST_BOOT_KEY=secret');
|
|
}
|
|
|
|
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();
|
|
});
|
|
|
|
describe('with a GRIST_BOOT_KEY', function() {
|
|
before(async function() {
|
|
oldEnv = new testUtils.EnvironmentSnapshot();
|
|
process.env.GRIST_BOOT_KEY = 'lala';
|
|
await server.restart();
|
|
});
|
|
|
|
after(async function() {
|
|
oldEnv.restore();
|
|
await server.restart();
|
|
});
|
|
|
|
it('gives prompt when key is missing', async function() {
|
|
await driver.get(`${server.getHost()}/admin`);
|
|
await hasPrompt();
|
|
});
|
|
|
|
it('gives prompt when key is wrong', async function() {
|
|
await driver.get(`${server.getHost()}/admin?boot=bilbo`);
|
|
await hasPrompt();
|
|
});
|
|
|
|
it('gives page when key is right', async function() {
|
|
await driver.get(`${server.getHost()}/admin?boot=lala`);
|
|
await driver.findContentWait('div', /Is home page available/, 2000);
|
|
});
|
|
});
|
|
});
|