Updated the URL used to obtain the SPA session and hid the Manage Time icon for SALES_REP users

This commit is contained in:
2026-10-31 03:27:04 -03:00
parent d689807a50
commit 0d0a7cfe14
14 changed files with 80 additions and 31 deletions

View File

@@ -26,7 +26,7 @@ for (const family of ["chrome", "firefox"]) {
assert.equal(h.tabs[0].active, false);
assert.equal(h.tabs[0].windowId, 3);
assert.equal(h.tabs[0].cookieStoreId, family === "firefox" ? "test-store" : undefined);
assert.equal(h.tabs[0].url, "https://spa.oracle.com/");
assert.equal(h.tabs[0].url, "https://spa.oracle.com/oalcrm/web/api/g2m-consumer-application/ui/index.html?ojr=whitespace");
assert.deepEqual(h.removedTabs, [91]);
assert.equal(result.debugRequests[0].httpStatus, status);
assert.match(result.debugRequests[0].metadata.retryReason, /SPA session recovery/);

View File

@@ -109,7 +109,7 @@ async function run() {
assert.equal(createdTabs[0].active, false);
assert.equal(
createdTabs[0].url,
"https://spa.oracle.com/"
"https://spa.oracle.com/oalcrm/web/api/g2m-consumer-application/ui/index.html?ojr=whitespace"
);
assert.deepEqual(removedTabs, [27]);
assert.equal(response.debugRequests.length, 2);

View File

@@ -86,7 +86,7 @@ for (const family of ["chrome", "firefox"]) {
assert.deepEqual(first, second);
assert.equal(attempts, 3);
assert.deepEqual(app.tabs, [{
url: "https://spa.oracle.com/",
url: "https://spa.oracle.com/oalcrm/web/api/g2m-consumer-application/ui/index.html?ojr=whitespace",
active: false, windowId: 3, ...(family === "firefox" ? { cookieStoreId: "test-store" } : {})
}]);
assert.deepEqual(app.removedTabs, [91]);

View File

@@ -591,3 +591,19 @@ for (const family of ["chrome", "firefox"]) test(`${family}: resource response i
assert.equal(calls[1].options.headers.Authorization, "Session");
await restarted.dispatch({ ...message, emailAddress: "other@example.invalid" }); assert.equal(calls.length, 3);
});
test("restricted profile cannot display or open Manage Time even if session is ready", () => {
const source = fs.readFileSync("src/features/manage-time/view.js", "utf8");
const factory = vm.runInNewContext(source + "\ncreateManageTime");
const element = () => ({ setAttribute() {}, append() {}, addEventListener() {} });
const app = factory({ allowsManageTime: () => false, environment: { document: {
createElement: element, createElementNS: element,
getElementById() { assert.fail("restricted profile must not open a modal"); }
} }, requestWeek() { assert.fail("restricted profile must not request weeks"); } });
const button = app.createButton();
app.setReady(true);
assert.equal(button.hidden, true);
assert.equal(button.disabled, true);
app.open();
});

View File

@@ -24,7 +24,7 @@ for (const family of ["chrome", "firefox"]) {
calls++;
if (calls === 1) return html();
if (calls === 2) { navigation(app); return html(); }
assert.deepEqual(app.updatedTabs, [{ id: 91, details: { url: "https://spa.oracle.com/", active: false } }]);
assert.deepEqual(app.updatedTabs, [{ id: 91, details: { url: "https://spa.oracle.com/oalcrm/web/api/g2m-consumer-application/ui/index.html?ojr=whitespace", active: false } }]);
return response(type === currentUser ? identity : tokens);
} });
const result = await app.dispatch({ type });
@@ -78,7 +78,7 @@ test("a successful SPA navigation clears an earlier failure before it can be res
if (++calls === 1) return html();
if (calls === 2) {
navigation(app);
navigation(app, { url: "https://spa.oracle.com/", statusCode: 200 });
navigation(app, { url: "https://spa.oracle.com/oalcrm/web/api/g2m-consumer-application/ui/index.html?ojr=whitespace", statusCode: 200 });
assert.equal(app.updatedTabs.length, 0);
}
return response(identity);

View File

@@ -72,7 +72,7 @@ function harness({ validAfter = 0 } = {}) {
await flush();
}
function navigation(overrides = {}) {
headers.emit({ tabId: 91, type: "main_frame", statusCode: 200, url: "https://spa.oracle.com/", ...overrides });
headers.emit({ tabId: 91, type: "main_frame", statusCode: 200, url: "https://spa.oracle.com/oalcrm/web/api/g2m-consumer-application/ui/index.html?ojr=whitespace", ...overrides });
}
function cookie() {
cookies.emit({ removed: false, cookie: { name: "synthetic-session", value: "never-log-this-cookie", domain: "spa.oracle.com",
@@ -119,7 +119,7 @@ test("callback 401 restarts only the owned SPA home; another HTTP 200 error page
h.navigation({ statusCode: 401, url: "https://spa.oracle.com/cloudgate/v1/oauth2/callback?code=never-replay" });
await h.advance(1000);
assert.equal(h.updates.length, 1);
assert.equal(h.updates[0].details.url, "https://spa.oracle.com/");
assert.equal(h.updates[0].details.url, "https://spa.oracle.com/oalcrm/web/api/g2m-consumer-application/ui/index.html?ojr=whitespace");
assert.equal(h.updates[0].details.active, false);
h.navigation();
await h.advance(10000);