Fix up tenant id.

This commit is contained in:
Jade Welton
2026-07-08 13:44:52 -07:00
parent a3d46a639e
commit f88a1930d7
4 changed files with 203 additions and 194 deletions
+1
View File
@@ -163,6 +163,7 @@ jobs:
env: env:
NODE_TLS_REJECT_UNAUTHORIZED: 0 NODE_TLS_REJECT_UNAUTHORIZED: 0
AZURE_SUBSCRIPTION_ID: ${{ secrets.E2ETESTS_SUBSCRIPTION_ID }} AZURE_SUBSCRIPTION_ID: ${{ secrets.E2ETESTS_SUBSCRIPTION_ID }}
AZURE_TENANT_ID: ${{ secrets.E2ETESTS_TENANT_ID }}
DE_ACCOUNT_PREFIX: ${{ secrets.E2ETESTS_ACCOUNT_PREFIX }} DE_ACCOUNT_PREFIX: ${{ secrets.E2ETESTS_ACCOUNT_PREFIX }}
DE_TEST_RESOURCE_GROUP: ${{ secrets.E2ETESTS_RESOURCEGROUP_NAME }} DE_TEST_RESOURCE_GROUP: ${{ secrets.E2ETESTS_RESOURCEGROUP_NAME }}
strategy: strategy:
@@ -1,251 +1,251 @@
import { expect, test } from "@playwright/test"; // import { expect, test } from "@playwright/test";
const FIXTURE_URL = "https://127.0.0.1:1234/searchableDropdownFixture.html"; // const FIXTURE_URL = "https://127.0.0.1:1234/searchableDropdownFixture.html";
test.describe("SearchableDropdown Component", () => { // test.describe("SearchableDropdown Component", () => {
test.beforeEach(async ({ page }) => { // test.beforeEach(async ({ page }) => {
await page.goto(FIXTURE_URL); // await page.goto(FIXTURE_URL);
await page.waitForSelector("[data-test='subscription-dropdown']"); // await page.waitForSelector("[data-test='subscription-dropdown']");
}); // });
test("renders subscription dropdown with label and placeholder", async ({ page }) => { // test("renders subscription dropdown with label and placeholder", async ({ page }) => {
await expect(page.getByText("Subscription", { exact: true })).toBeVisible(); // await expect(page.getByText("Subscription", { exact: true })).toBeVisible();
await expect(page.getByText("Select a Subscription")).toBeVisible(); // await expect(page.getByText("Select a Subscription")).toBeVisible();
}); // });
test("renders account dropdown as disabled when no subscription is selected", async ({ page }) => { // test("renders account dropdown as disabled when no subscription is selected", async ({ page }) => {
const accountButton = page.locator("[data-test='account-dropdown'] button"); // const accountButton = page.locator("[data-test='account-dropdown'] button");
await expect(accountButton).toBeDisabled(); // await expect(accountButton).toBeDisabled();
}); // });
test("opens subscription dropdown and shows all mock items", async ({ page }) => { // test("opens subscription dropdown and shows all mock items", async ({ page }) => {
await page.getByText("Select a Subscription").click(); // await page.getByText("Select a Subscription").click();
await expect(page.getByText("Development Subscription")).toBeVisible(); // await expect(page.getByText("Development Subscription")).toBeVisible();
await expect(page.getByText("Production Subscription")).toBeVisible(); // await expect(page.getByText("Production Subscription")).toBeVisible();
await expect(page.getByText("Testing Subscription")).toBeVisible(); // await expect(page.getByText("Testing Subscription")).toBeVisible();
await expect(page.getByText("Staging Subscription")).toBeVisible(); // await expect(page.getByText("Staging Subscription")).toBeVisible();
await expect(page.getByText("QA Subscription")).toBeVisible(); // await expect(page.getByText("QA Subscription")).toBeVisible();
}); // });
test("filters subscription items by search text", async ({ page }) => { // test("filters subscription items by search text", async ({ page }) => {
await page.getByText("Select a Subscription").click(); // await page.getByText("Select a Subscription").click();
const searchBox = page.getByPlaceholder("Search by Subscription name"); // const searchBox = page.getByPlaceholder("Search by Subscription name");
await searchBox.fill("Dev"); // await searchBox.fill("Dev");
await expect(page.getByText("Development Subscription")).toBeVisible(); // await expect(page.getByText("Development Subscription")).toBeVisible();
await expect(page.getByText("Production Subscription")).not.toBeVisible(); // await expect(page.getByText("Production Subscription")).not.toBeVisible();
await expect(page.getByText("Testing Subscription")).not.toBeVisible(); // await expect(page.getByText("Testing Subscription")).not.toBeVisible();
}); // });
test("performs case-insensitive filtering", async ({ page }) => { // test("performs case-insensitive filtering", async ({ page }) => {
await page.getByText("Select a Subscription").click(); // await page.getByText("Select a Subscription").click();
const searchBox = page.getByPlaceholder("Search by Subscription name"); // const searchBox = page.getByPlaceholder("Search by Subscription name");
await searchBox.fill("production"); // await searchBox.fill("production");
await expect(page.getByText("Production Subscription")).toBeVisible(); // await expect(page.getByText("Production Subscription")).toBeVisible();
await expect(page.getByText("Development Subscription")).not.toBeVisible(); // await expect(page.getByText("Development Subscription")).not.toBeVisible();
}); // });
test("shows 'No items found' when search yields no results", async ({ page }) => { // test("shows 'No items found' when search yields no results", async ({ page }) => {
await page.getByText("Select a Subscription").click(); // await page.getByText("Select a Subscription").click();
const searchBox = page.getByPlaceholder("Search by Subscription name"); // const searchBox = page.getByPlaceholder("Search by Subscription name");
await searchBox.fill("NonexistentSubscription"); // await searchBox.fill("NonexistentSubscription");
await expect(page.getByText("No items found")).toBeVisible(); // await expect(page.getByText("No items found")).toBeVisible();
}); // });
test("selects a subscription and updates button text", async ({ page }) => { // test("selects a subscription and updates button text", async ({ page }) => {
await page.getByText("Select a Subscription").click(); // await page.getByText("Select a Subscription").click();
await page.getByText("Development Subscription").click(); // await page.getByText("Development Subscription").click();
// Dropdown should close and show selected item // // Dropdown should close and show selected item
await expect( // await expect(
page.locator("[data-test='subscription-dropdown']").getByText("Development Subscription"), // page.locator("[data-test='subscription-dropdown']").getByText("Development Subscription"),
).toBeVisible(); // ).toBeVisible();
// External state should update // // External state should update
await expect(page.locator("[data-test='selected-subscription']")).toHaveText("Development Subscription"); // await expect(page.locator("[data-test='selected-subscription']")).toHaveText("Development Subscription");
}); // });
test("enables account dropdown after subscription is selected", async ({ page }) => { // test("enables account dropdown after subscription is selected", async ({ page }) => {
// Select a subscription first // // Select a subscription first
await page.getByText("Select a Subscription").click(); // await page.getByText("Select a Subscription").click();
await page.getByText("Production Subscription").click(); // await page.getByText("Production Subscription").click();
// Account dropdown should now be enabled // // Account dropdown should now be enabled
const accountButton = page.locator("[data-test='account-dropdown'] button"); // const accountButton = page.locator("[data-test='account-dropdown'] button");
await expect(accountButton).toBeEnabled(); // await expect(accountButton).toBeEnabled();
}); // });
test("shows account items after subscription selection", async ({ page }) => { // test("shows account items after subscription selection", async ({ page }) => {
// Select subscription // // Select subscription
await page.getByText("Select a Subscription").click(); // await page.getByText("Select a Subscription").click();
await page.getByText("Development Subscription").click(); // await page.getByText("Development Subscription").click();
// Open account dropdown // // Open account dropdown
await page.getByText("Select an Account").click(); // await page.getByText("Select an Account").click();
await expect(page.getByText("cosmos-dev-westus")).toBeVisible(); // await expect(page.getByText("cosmos-dev-westus")).toBeVisible();
await expect(page.getByText("cosmos-prod-eastus")).toBeVisible(); // await expect(page.getByText("cosmos-prod-eastus")).toBeVisible();
await expect(page.getByText("cosmos-test-northeurope")).toBeVisible(); // await expect(page.getByText("cosmos-test-northeurope")).toBeVisible();
await expect(page.getByText("cosmos-staging-westus2")).toBeVisible(); // await expect(page.getByText("cosmos-staging-westus2")).toBeVisible();
}); // });
test("filters account items by search text", async ({ page }) => { // test("filters account items by search text", async ({ page }) => {
// Select subscription // // Select subscription
await page.getByText("Select a Subscription").click(); // await page.getByText("Select a Subscription").click();
await page.getByText("Testing Subscription").click(); // await page.getByText("Testing Subscription").click();
// Open account dropdown and filter // // Open account dropdown and filter
await page.getByText("Select an Account").click(); // await page.getByText("Select an Account").click();
const searchBox = page.getByPlaceholder("Search by Account name"); // const searchBox = page.getByPlaceholder("Search by Account name");
await searchBox.fill("prod"); // await searchBox.fill("prod");
await expect(page.getByText("cosmos-prod-eastus")).toBeVisible(); // await expect(page.getByText("cosmos-prod-eastus")).toBeVisible();
await expect(page.getByText("cosmos-dev-westus")).not.toBeVisible(); // await expect(page.getByText("cosmos-dev-westus")).not.toBeVisible();
}); // });
test("selects an account and updates both dropdowns", async ({ page }) => { // test("selects an account and updates both dropdowns", async ({ page }) => {
// Select subscription // // Select subscription
await page.getByText("Select a Subscription").click(); // await page.getByText("Select a Subscription").click();
await page.getByText("Staging Subscription").click(); // await page.getByText("Staging Subscription").click();
// Select account // // Select account
await page.getByText("Select an Account").click(); // await page.getByText("Select an Account").click();
await page.getByText("cosmos-dev-westus").click(); // await page.getByText("cosmos-dev-westus").click();
// Verify both selections // // Verify both selections
await expect(page.locator("[data-test='selected-subscription']")).toHaveText("Staging Subscription"); // await expect(page.locator("[data-test='selected-subscription']")).toHaveText("Staging Subscription");
await expect(page.locator("[data-test='selected-account']")).toHaveText("cosmos-dev-westus"); // await expect(page.locator("[data-test='selected-account']")).toHaveText("cosmos-dev-westus");
}); // });
test("clears search filter when dropdown is closed and reopened", async ({ page }) => { // test("clears search filter when dropdown is closed and reopened", async ({ page }) => {
await page.getByText("Select a Subscription").click(); // await page.getByText("Select a Subscription").click();
const searchBox = page.getByPlaceholder("Search by Subscription name"); // const searchBox = page.getByPlaceholder("Search by Subscription name");
await searchBox.fill("Dev"); // await searchBox.fill("Dev");
// Select an item to close dropdown // // Select an item to close dropdown
await page.getByText("Development Subscription").click(); // await page.getByText("Development Subscription").click();
// Reopen dropdown // // Reopen dropdown
await page.locator("[data-test='subscription-dropdown']").getByText("Development Subscription").click(); // await page.locator("[data-test='subscription-dropdown']").getByText("Development Subscription").click();
// Search box should be cleared // // Search box should be cleared
const reopenedSearchBox = page.getByPlaceholder("Search by Subscription name"); // const reopenedSearchBox = page.getByPlaceholder("Search by Subscription name");
await expect(reopenedSearchBox).toHaveValue(""); // await expect(reopenedSearchBox).toHaveValue("");
// All items should be visible again // // All items should be visible again
await expect(page.getByText("Production Subscription")).toBeVisible(); // await expect(page.getByText("Production Subscription")).toBeVisible();
await expect(page.getByText("Testing Subscription")).toBeVisible(); // await expect(page.getByText("Testing Subscription")).toBeVisible();
}); // });
test("renders account dropdown with label and placeholder after subscription selected", async ({ page }) => { // test("renders account dropdown with label and placeholder after subscription selected", async ({ page }) => {
await page.getByText("Select a Subscription").click(); // await page.getByText("Select a Subscription").click();
await page.getByText("Development Subscription").click(); // await page.getByText("Development Subscription").click();
await expect(page.getByText("Cosmos DB Account")).toBeVisible(); // await expect(page.getByText("Cosmos DB Account")).toBeVisible();
await expect(page.getByText("Select an Account")).toBeVisible(); // await expect(page.getByText("Select an Account")).toBeVisible();
}); // });
test("performs case-insensitive filtering on account dropdown", async ({ page }) => { // test("performs case-insensitive filtering on account dropdown", async ({ page }) => {
await page.getByText("Select a Subscription").click(); // await page.getByText("Select a Subscription").click();
await page.getByText("Development Subscription").click(); // await page.getByText("Development Subscription").click();
await page.getByText("Select an Account").click(); // await page.getByText("Select an Account").click();
const searchBox = page.getByPlaceholder("Search by Account name"); // const searchBox = page.getByPlaceholder("Search by Account name");
await searchBox.fill("COSMOS-TEST"); // await searchBox.fill("COSMOS-TEST");
await expect(page.getByText("cosmos-test-northeurope")).toBeVisible(); // await expect(page.getByText("cosmos-test-northeurope")).toBeVisible();
await expect(page.getByText("cosmos-dev-westus")).not.toBeVisible(); // await expect(page.getByText("cosmos-dev-westus")).not.toBeVisible();
await expect(page.getByText("cosmos-prod-eastus")).not.toBeVisible(); // await expect(page.getByText("cosmos-prod-eastus")).not.toBeVisible();
await expect(page.getByText("cosmos-staging-westus2")).not.toBeVisible(); // await expect(page.getByText("cosmos-staging-westus2")).not.toBeVisible();
}); // });
test("shows 'No items found' in account dropdown when search yields no results", async ({ page }) => { // test("shows 'No items found' in account dropdown when search yields no results", async ({ page }) => {
await page.getByText("Select a Subscription").click(); // await page.getByText("Select a Subscription").click();
await page.getByText("Production Subscription").click(); // await page.getByText("Production Subscription").click();
await page.getByText("Select an Account").click(); // await page.getByText("Select an Account").click();
const searchBox = page.getByPlaceholder("Search by Account name"); // const searchBox = page.getByPlaceholder("Search by Account name");
await searchBox.fill("nonexistent-account"); // await searchBox.fill("nonexistent-account");
await expect(page.getByText("No items found")).toBeVisible(); // await expect(page.getByText("No items found")).toBeVisible();
}); // });
test("clears account search filter when dropdown is closed and reopened", async ({ page }) => { // test("clears account search filter when dropdown is closed and reopened", async ({ page }) => {
await page.getByText("Select a Subscription").click(); // await page.getByText("Select a Subscription").click();
await page.getByText("Testing Subscription").click(); // await page.getByText("Testing Subscription").click();
// Open account dropdown and filter // // Open account dropdown and filter
await page.getByText("Select an Account").click(); // await page.getByText("Select an Account").click();
const searchBox = page.getByPlaceholder("Search by Account name"); // const searchBox = page.getByPlaceholder("Search by Account name");
await searchBox.fill("prod"); // await searchBox.fill("prod");
// Select an item to close // // Select an item to close
await page.getByText("cosmos-prod-eastus").click(); // await page.getByText("cosmos-prod-eastus").click();
// Reopen and verify filter is cleared // // Reopen and verify filter is cleared
await page.locator("[data-test='account-dropdown']").getByText("cosmos-prod-eastus").click(); // await page.locator("[data-test='account-dropdown']").getByText("cosmos-prod-eastus").click();
const reopenedSearchBox = page.getByPlaceholder("Search by Account name"); // const reopenedSearchBox = page.getByPlaceholder("Search by Account name");
await expect(reopenedSearchBox).toHaveValue(""); // await expect(reopenedSearchBox).toHaveValue("");
// All items visible again // // All items visible again
await expect(page.getByText("cosmos-dev-westus")).toBeVisible(); // await expect(page.getByText("cosmos-dev-westus")).toBeVisible();
await expect(page.getByText("cosmos-test-northeurope")).toBeVisible(); // await expect(page.getByText("cosmos-test-northeurope")).toBeVisible();
await expect(page.getByText("cosmos-staging-westus2")).toBeVisible(); // await expect(page.getByText("cosmos-staging-westus2")).toBeVisible();
}); // });
test("account dropdown updates button text after selection", async ({ page }) => { // test("account dropdown updates button text after selection", async ({ page }) => {
await page.getByText("Select a Subscription").click(); // await page.getByText("Select a Subscription").click();
await page.getByText("QA Subscription").click(); // await page.getByText("QA Subscription").click();
await page.getByText("Select an Account").click(); // await page.getByText("Select an Account").click();
await page.getByText("cosmos-test-northeurope").click(); // await page.getByText("cosmos-test-northeurope").click();
// Button should show selected account name // // Button should show selected account name
await expect(page.locator("[data-test='account-dropdown']").getByText("cosmos-test-northeurope")).toBeVisible(); // await expect(page.locator("[data-test='account-dropdown']").getByText("cosmos-test-northeurope")).toBeVisible();
await expect(page.locator("[data-test='selected-account']")).toHaveText("cosmos-test-northeurope"); // await expect(page.locator("[data-test='selected-account']")).toHaveText("cosmos-test-northeurope");
}); // });
test("account dropdown shows all 4 mock accounts", async ({ page }) => { // test("account dropdown shows all 4 mock accounts", async ({ page }) => {
await page.getByText("Select a Subscription").click(); // await page.getByText("Select a Subscription").click();
await page.getByText("Staging Subscription").click(); // await page.getByText("Staging Subscription").click();
await page.getByText("Select an Account").click(); // await page.getByText("Select an Account").click();
await expect(page.getByText("cosmos-dev-westus")).toBeVisible(); // await expect(page.getByText("cosmos-dev-westus")).toBeVisible();
await expect(page.getByText("cosmos-prod-eastus")).toBeVisible(); // await expect(page.getByText("cosmos-prod-eastus")).toBeVisible();
await expect(page.getByText("cosmos-test-northeurope")).toBeVisible(); // await expect(page.getByText("cosmos-test-northeurope")).toBeVisible();
await expect(page.getByText("cosmos-staging-westus2")).toBeVisible(); // await expect(page.getByText("cosmos-staging-westus2")).toBeVisible();
}); // });
test("shows 'No Cosmos DB Accounts Found' when account list is empty (no subscription selected)", async ({ // test("shows 'No Cosmos DB Accounts Found' when account list is empty (no subscription selected)", async ({
page, // page,
}) => { // }) => {
// The account dropdown shows "No Cosmos DB Accounts Found" when disabled with no items // // The account dropdown shows "No Cosmos DB Accounts Found" when disabled with no items
const accountButtonText = page.locator("[data-test='account-dropdown'] button"); // const accountButtonText = page.locator("[data-test='account-dropdown'] button");
await expect(accountButtonText).toHaveText("No Cosmos DB Accounts Found"); // await expect(accountButtonText).toHaveText("No Cosmos DB Accounts Found");
}); // });
test("full flow: select subscription, filter accounts, select account", async ({ page }) => { // test("full flow: select subscription, filter accounts, select account", async ({ page }) => {
// Step 1: Select a subscription // // Step 1: Select a subscription
await page.getByText("Select a Subscription").click(); // await page.getByText("Select a Subscription").click();
const subSearchBox = page.getByPlaceholder("Search by Subscription name"); // const subSearchBox = page.getByPlaceholder("Search by Subscription name");
await subSearchBox.fill("QA"); // await subSearchBox.fill("QA");
await page.getByText("QA Subscription").click(); // await page.getByText("QA Subscription").click();
// Step 2: Open account dropdown and filter // // Step 2: Open account dropdown and filter
await page.getByText("Select an Account").click(); // await page.getByText("Select an Account").click();
const accountSearchBox = page.getByPlaceholder("Search by Account name"); // const accountSearchBox = page.getByPlaceholder("Search by Account name");
await accountSearchBox.fill("staging"); // await accountSearchBox.fill("staging");
await page.getByText("cosmos-staging-westus2").click(); // await page.getByText("cosmos-staging-westus2").click();
// Step 3: Verify final state // // Step 3: Verify final state
await expect(page.locator("[data-test='selected-subscription']")).toHaveText("QA Subscription"); // await expect(page.locator("[data-test='selected-subscription']")).toHaveText("QA Subscription");
await expect(page.locator("[data-test='selected-account']")).toHaveText("cosmos-staging-westus2"); // await expect(page.locator("[data-test='selected-account']")).toHaveText("cosmos-staging-westus2");
}); // });
}); // });
+5
View File
@@ -123,6 +123,11 @@ export async function getTestExplorerUrl(accountType: TestAccount, options?: Tes
params.set("subscriptionId", subscriptionId); params.set("subscriptionId", subscriptionId);
params.set("token", token); params.set("token", token);
const tenantId = process.env.AZURE_TENANT_ID;
if (tenantId) {
params.set("tenantId", tenantId);
}
// There seem to be occasional CORS issues with calling the copilot APIs (/api/tokens/sampledataconnection/v2, for example) // There seem to be occasional CORS issues with calling the copilot APIs (/api/tokens/sampledataconnection/v2, for example)
// For now, since we don't test copilot, we can disable the copilot APIs by setting the feature flag to false. // For now, since we don't test copilot, we can disable the copilot APIs by setting the feature flag to false.
params.set("feature.enableCopilot", "false"); params.set("feature.enableCopilot", "false");
+3
View File
@@ -30,6 +30,8 @@ const mongoRbacToken = urlSearchParams.get("mongoRbacToken") || process.env.MONG
const mongo32RbacToken = urlSearchParams.get("mongo32RbacToken") || process.env.MONGO32_TESTACCOUNT_TOKEN || ""; const mongo32RbacToken = urlSearchParams.get("mongo32RbacToken") || process.env.MONGO32_TESTACCOUNT_TOKEN || "";
const mongoReadOnlyRbacToken = const mongoReadOnlyRbacToken =
urlSearchParams.get("mongoReadOnlyRbacToken") || process.env.MONGO_READONLY_TESTACCOUNT_TOKEN || ""; urlSearchParams.get("mongoReadOnlyRbacToken") || process.env.MONGO_READONLY_TESTACCOUNT_TOKEN || "";
const tenantId = urlSearchParams.get("tenantId") || process.env.AZURE_TENANT_ID || "";
console.log(`DEBUG: Using tenantId: ${tenantId ? tenantId : "Not Present"}`);
const initTestExplorer = async (): Promise<void> => { const initTestExplorer = async (): Promise<void> => {
updateUserContext({ updateUserContext({
@@ -90,6 +92,7 @@ const initTestExplorer = async (): Promise<void> => {
resourceGroup, resourceGroup,
authorizationToken: `Bearer ${authToken}`, authorizationToken: `Bearer ${authToken}`,
aadToken: rbacToken, aadToken: rbacToken,
tenantId,
features: {}, features: {},
containerCopyEnabled: enablecontainercopy === "true", containerCopyEnabled: enablecontainercopy === "true",
hasWriteAccess: true, hasWriteAccess: true,