fix: scope startup by route
This commit is contained in:
@@ -32,6 +32,17 @@ const {
|
||||
} = require("./lib/selenium-smoke");
|
||||
|
||||
const domWrapAddonPath = path.join(__dirname, "dom-wrap-addon");
|
||||
let bootstrapAdminSession = null;
|
||||
|
||||
async function ensureAdminSession() {
|
||||
if (bootstrapAdminSession) {
|
||||
return bootstrapAdminSession;
|
||||
}
|
||||
|
||||
const username = uniqueName("bootstrap-admin");
|
||||
bootstrapAdminSession = await registerAndLoginApi(username, "Bootstrap Admin");
|
||||
return bootstrapAdminSession;
|
||||
}
|
||||
|
||||
async function openAuthenticatedPlay(driver, sessionCookie) {
|
||||
await seedAuthenticatedBrowser(driver, sessionCookie);
|
||||
@@ -76,8 +87,7 @@ const tests = [
|
||||
{
|
||||
name: "authenticated root document redirects to play",
|
||||
run: async () => {
|
||||
const username = uniqueName("doc-auth");
|
||||
const { sessionCookie } = await registerAndLoginApi(username, "Document Auth");
|
||||
const { sessionCookie } = await ensureAdminSession();
|
||||
const response = await request("/", {
|
||||
cookie: sessionCookie,
|
||||
redirect: "manual"
|
||||
@@ -142,6 +152,21 @@ const tests = [
|
||||
assert.equal(await hasSelector(driver, ".management-list"), false);
|
||||
})
|
||||
},
|
||||
{
|
||||
name: "admin route mounts directly without play UI",
|
||||
run: async () => withDriver({}, async (driver) => {
|
||||
const { sessionCookie } = await ensureAdminSession();
|
||||
|
||||
await seedAuthenticatedBrowser(driver, sessionCookie);
|
||||
await driver.get(absoluteUrl("/admin"));
|
||||
|
||||
await waitForUrl(driver, "/admin");
|
||||
await waitForText(driver, "User Management");
|
||||
assert.equal(await hasSelector(driver, ".management-list"), true);
|
||||
assert.equal(await hasSelector(driver, "#skill-filter-input"), false);
|
||||
assert.equal(await hasSelector(driver, ".log-panel"), false);
|
||||
})
|
||||
},
|
||||
{
|
||||
name: "successful login transitions to play workspace",
|
||||
run: async () => withDriver({}, async (driver) => {
|
||||
|
||||
Reference in New Issue
Block a user