From 30353c26f319c71643347cc48c05194090527e3e Mon Sep 17 00:00:00 2001 From: Zachary Foster Date: Tue, 20 Oct 2020 11:49:22 -0400 Subject: [PATCH 1/4] Adds e2e tables test (#276) * Adds tables test * Include .env var * Adds asElement on again * Add further loading states * Format * Hope to not lose focus * Adds ID to shared key and modifies value of input directly * Fix tables test * Format * Try uploading screenshots * indent * Fixes connection string * Try wildcard upload path --- .github/workflows/ci.yml | 5 ++ src/Explorer/Panes/AddCollectionPane.html | 2 +- test/cassandra/container.spec.ts | 4 +- test/mongo/container.spec.ts | 4 +- test/sql/container.spec.ts | 4 +- test/tables/container.spec.ts | 71 +++++++++++++++++++++++ test/utils/shared.ts | 2 +- 7 files changed, 87 insertions(+), 5 deletions(-) create mode 100644 test/tables/container.spec.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 78a043e29..53a39150a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -150,6 +150,11 @@ jobs: PORTAL_RUNNER_CONNECTION_STRING: ${{ secrets.CONNECTION_STRING_SQL }} MONGO_CONNECTION_STRING: ${{ secrets.CONNECTION_STRING_MONGO }} CASSANDRA_CONNECTION_STRING: ${{ secrets.CONNECTION_STRING_CASSANDRA }} + TABLES_CONNECTION_STRING: ${{ secrets.CONNECTION_STRING_TABLE }} + - uses: actions/upload-artifact@v2 + with: + name: screenshots + path: failed-* nuget: name: Publish Nuget if: github.ref == 'refs/heads/master' || contains(github.ref, 'hotfix/') || contains(github.ref, 'release/') diff --git a/src/Explorer/Panes/AddCollectionPane.html b/src/Explorer/Panes/AddCollectionPane.html index 94d704046..c41e06440 100644 --- a/src/Explorer/Panes/AddCollectionPane.html +++ b/src/Explorer/Panes/AddCollectionPane.html @@ -390,7 +390,7 @@ range of values and is likely to have evenly distributed access patterns.

- { // click delete await frame.click('input[data-test="deleteDatabase"]'); await frame.waitForSelector('div[class="splashScreen"] > div[class="title"]', { visible: true }); + await frame.waitFor(LOADING_STATE_DELAY); + await frame.waitForSelector('div[class="splashScreen"] > div[class="title"]', { visible: true }); await expect(page).not.toMatchElement(`div[data-test="${keyspaceId}"]`); } catch (error) { // eslint-disable-next-line @typescript-eslint/no-explicit-any const testName = (expect as any).getState().currentTestName; - await page.screenshot({ path: `Test Failed ${testName}.png` }); + await page.screenshot({ path: `failed-${testName}.jpg` }); throw error; } }); diff --git a/test/mongo/container.spec.ts b/test/mongo/container.spec.ts index 54febbcf1..12d77e2d7 100644 --- a/test/mongo/container.spec.ts +++ b/test/mongo/container.spec.ts @@ -101,11 +101,13 @@ describe("Collection Add and Delete Mongo spec", () => { // click delete await frame.click('input[data-test="deleteDatabase"]'); await frame.waitForSelector('div[class="splashScreen"] > div[class="title"]', { visible: true }); + await frame.waitFor(LOADING_STATE_DELAY); + await frame.waitForSelector('div[class="splashScreen"] > div[class="title"]', { visible: true }); await expect(page).not.toMatchElement(`div[data-test="${dbId}"]`); } catch (error) { // eslint-disable-next-line @typescript-eslint/no-explicit-any const testName = (expect as any).getState().currentTestName; - await page.screenshot({ path: `Test Failed ${testName}.png` }); + await page.screenshot({ path: `failed-${testName}.jpg` }); throw error; } }); diff --git a/test/sql/container.spec.ts b/test/sql/container.spec.ts index 6b801c817..7d5342ca6 100644 --- a/test/sql/container.spec.ts +++ b/test/sql/container.spec.ts @@ -100,11 +100,13 @@ describe("Collection Add and Delete SQL spec", () => { // click delete await frame.click('input[data-test="deleteDatabase"]'); await frame.waitForSelector('div[class="splashScreen"] > div[class="title"]', { visible: true }); + await frame.waitFor(LOADING_STATE_DELAY); + await frame.waitForSelector('div[class="splashScreen"] > div[class="title"]', { visible: true }); await expect(page).not.toMatchElement(`div[data-test="${dbId}"]`); } catch (error) { // eslint-disable-next-line @typescript-eslint/no-explicit-any const testName = (expect as any).getState().currentTestName; - await page.screenshot({ path: `Test Failed ${testName}.jpg` }); + await page.screenshot({ path: `failed-${testName}.jpg` }); throw error; } }); diff --git a/test/tables/container.spec.ts b/test/tables/container.spec.ts new file mode 100644 index 000000000..eb9de8e96 --- /dev/null +++ b/test/tables/container.spec.ts @@ -0,0 +1,71 @@ +import "expect-puppeteer"; +import { generateUniqueName, login } from "../utils/shared"; + +jest.setTimeout(300000); +const LOADING_STATE_DELAY = 2500; +const RENDER_DELAY = 1000; + +describe("Collection Add and Delete Tables spec", () => { + it("creates a collection", async () => { + try { + const tableId = generateUniqueName("TestTable"); + const frame = await login(process.env.TABLES_CONNECTION_STRING); + + // create new collection + await frame.waitFor('button[data-test="New Table"]', { visible: true }); + await frame.waitForSelector('div[class="splashScreen"] > div[class="title"]', { visible: true }); + await frame.click('button[data-test="New Table"]'); + + // type database id + await frame.waitFor('input[data-test="addCollection-newDatabaseId"]'); + const dbInput = await frame.$('input[data-test="addCollection-newDatabaseId"]'); + await dbInput.press("Backspace"); + await dbInput.type(tableId); + + // click submit + await frame.waitFor("#submitBtnAddCollection"); + await frame.click("#submitBtnAddCollection"); + + // validate created + // open database menu + await frame.waitForSelector('div[class="splashScreen"] > div[class="title"]', { visible: true }); + + await frame.waitFor(`div[data-test="TablesDB"]`), { visible: true }; + await frame.waitFor(LOADING_STATE_DELAY); + await frame.waitFor(`div[data-test="TablesDB"]`), { visible: true }; + await frame.waitFor(LOADING_STATE_DELAY); + const button = await frame.$(`div[data-test="TablesDB"]`); + await button.focus(); + await button.asElement().click(); + await frame.waitFor(`div[data-test="${tableId}"]`, { visible: true }); + + // delete container + + // click context menu for container + await frame.waitFor(`div[data-test="${tableId}"] > div > button`, { visible: true }); + await frame.click(`div[data-test="${tableId}"] > div > button`); + + // click delete container + await frame.waitFor(RENDER_DELAY); + await frame.waitFor('span[class="treeComponentMenuItemLabel deleteCollectionMenuItemLabel"]'); + await frame.click('span[class="treeComponentMenuItemLabel deleteCollectionMenuItemLabel"]'); + + // confirm delete container + await frame.waitFor('input[data-test="confirmCollectionId"]', { visible: true }); + await frame.type('input[data-test="confirmCollectionId"]', tableId); + + // click delete + await frame.waitFor('input[data-test="deleteCollection"]', { visible: true }); + await frame.click('input[data-test="deleteCollection"]'); + await frame.waitFor(LOADING_STATE_DELAY); + await frame.waitForSelector('div[class="splashScreen"] > div[class="title"]', { visible: true }); + + await expect(page).not.toMatchElement(`div[data-test="${tableId}"]`); + } catch (error) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const testName = (expect as any).getState().currentTestName; + await page.screenshot({ path: `failed-${testName}.jpg` }); + throw error; + } + }); +}); diff --git a/test/utils/shared.ts b/test/utils/shared.ts index 458899700..3960a936d 100644 --- a/test/utils/shared.ts +++ b/test/utils/shared.ts @@ -3,7 +3,7 @@ import { Frame } from "puppeteer"; export async function login(connectionString: string): Promise { const prodUrl = "https://localhost:1234/hostedExplorer.html"; - page.goto(prodUrl); + page.goto(prodUrl, { waitUntil: "networkidle2" }); // log in with connection string const handle = await page.waitForSelector("iframe"); From 7ffa18a190b60f1c961a83d7781aca9045a38126 Mon Sep 17 00:00:00 2001 From: Zachary Foster Date: Tue, 20 Oct 2020 13:02:50 -0400 Subject: [PATCH 2/4] Revert "Adds e2e tables test (#276)" (#292) This reverts commit 30353c26f319c71643347cc48c05194090527e3e. --- .github/workflows/ci.yml | 5 -- src/Explorer/Panes/AddCollectionPane.html | 2 +- test/cassandra/container.spec.ts | 4 +- test/mongo/container.spec.ts | 4 +- test/sql/container.spec.ts | 4 +- test/tables/container.spec.ts | 71 ----------------------- test/utils/shared.ts | 2 +- 7 files changed, 5 insertions(+), 87 deletions(-) delete mode 100644 test/tables/container.spec.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 53a39150a..78a043e29 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -150,11 +150,6 @@ jobs: PORTAL_RUNNER_CONNECTION_STRING: ${{ secrets.CONNECTION_STRING_SQL }} MONGO_CONNECTION_STRING: ${{ secrets.CONNECTION_STRING_MONGO }} CASSANDRA_CONNECTION_STRING: ${{ secrets.CONNECTION_STRING_CASSANDRA }} - TABLES_CONNECTION_STRING: ${{ secrets.CONNECTION_STRING_TABLE }} - - uses: actions/upload-artifact@v2 - with: - name: screenshots - path: failed-* nuget: name: Publish Nuget if: github.ref == 'refs/heads/master' || contains(github.ref, 'hotfix/') || contains(github.ref, 'release/') diff --git a/src/Explorer/Panes/AddCollectionPane.html b/src/Explorer/Panes/AddCollectionPane.html index c41e06440..94d704046 100644 --- a/src/Explorer/Panes/AddCollectionPane.html +++ b/src/Explorer/Panes/AddCollectionPane.html @@ -390,7 +390,7 @@ range of values and is likely to have evenly distributed access patterns.

- { // click delete await frame.click('input[data-test="deleteDatabase"]'); await frame.waitForSelector('div[class="splashScreen"] > div[class="title"]', { visible: true }); - await frame.waitFor(LOADING_STATE_DELAY); - await frame.waitForSelector('div[class="splashScreen"] > div[class="title"]', { visible: true }); await expect(page).not.toMatchElement(`div[data-test="${keyspaceId}"]`); } catch (error) { // eslint-disable-next-line @typescript-eslint/no-explicit-any const testName = (expect as any).getState().currentTestName; - await page.screenshot({ path: `failed-${testName}.jpg` }); + await page.screenshot({ path: `Test Failed ${testName}.png` }); throw error; } }); diff --git a/test/mongo/container.spec.ts b/test/mongo/container.spec.ts index 12d77e2d7..54febbcf1 100644 --- a/test/mongo/container.spec.ts +++ b/test/mongo/container.spec.ts @@ -101,13 +101,11 @@ describe("Collection Add and Delete Mongo spec", () => { // click delete await frame.click('input[data-test="deleteDatabase"]'); await frame.waitForSelector('div[class="splashScreen"] > div[class="title"]', { visible: true }); - await frame.waitFor(LOADING_STATE_DELAY); - await frame.waitForSelector('div[class="splashScreen"] > div[class="title"]', { visible: true }); await expect(page).not.toMatchElement(`div[data-test="${dbId}"]`); } catch (error) { // eslint-disable-next-line @typescript-eslint/no-explicit-any const testName = (expect as any).getState().currentTestName; - await page.screenshot({ path: `failed-${testName}.jpg` }); + await page.screenshot({ path: `Test Failed ${testName}.png` }); throw error; } }); diff --git a/test/sql/container.spec.ts b/test/sql/container.spec.ts index 7d5342ca6..6b801c817 100644 --- a/test/sql/container.spec.ts +++ b/test/sql/container.spec.ts @@ -100,13 +100,11 @@ describe("Collection Add and Delete SQL spec", () => { // click delete await frame.click('input[data-test="deleteDatabase"]'); await frame.waitForSelector('div[class="splashScreen"] > div[class="title"]', { visible: true }); - await frame.waitFor(LOADING_STATE_DELAY); - await frame.waitForSelector('div[class="splashScreen"] > div[class="title"]', { visible: true }); await expect(page).not.toMatchElement(`div[data-test="${dbId}"]`); } catch (error) { // eslint-disable-next-line @typescript-eslint/no-explicit-any const testName = (expect as any).getState().currentTestName; - await page.screenshot({ path: `failed-${testName}.jpg` }); + await page.screenshot({ path: `Test Failed ${testName}.jpg` }); throw error; } }); diff --git a/test/tables/container.spec.ts b/test/tables/container.spec.ts deleted file mode 100644 index eb9de8e96..000000000 --- a/test/tables/container.spec.ts +++ /dev/null @@ -1,71 +0,0 @@ -import "expect-puppeteer"; -import { generateUniqueName, login } from "../utils/shared"; - -jest.setTimeout(300000); -const LOADING_STATE_DELAY = 2500; -const RENDER_DELAY = 1000; - -describe("Collection Add and Delete Tables spec", () => { - it("creates a collection", async () => { - try { - const tableId = generateUniqueName("TestTable"); - const frame = await login(process.env.TABLES_CONNECTION_STRING); - - // create new collection - await frame.waitFor('button[data-test="New Table"]', { visible: true }); - await frame.waitForSelector('div[class="splashScreen"] > div[class="title"]', { visible: true }); - await frame.click('button[data-test="New Table"]'); - - // type database id - await frame.waitFor('input[data-test="addCollection-newDatabaseId"]'); - const dbInput = await frame.$('input[data-test="addCollection-newDatabaseId"]'); - await dbInput.press("Backspace"); - await dbInput.type(tableId); - - // click submit - await frame.waitFor("#submitBtnAddCollection"); - await frame.click("#submitBtnAddCollection"); - - // validate created - // open database menu - await frame.waitForSelector('div[class="splashScreen"] > div[class="title"]', { visible: true }); - - await frame.waitFor(`div[data-test="TablesDB"]`), { visible: true }; - await frame.waitFor(LOADING_STATE_DELAY); - await frame.waitFor(`div[data-test="TablesDB"]`), { visible: true }; - await frame.waitFor(LOADING_STATE_DELAY); - const button = await frame.$(`div[data-test="TablesDB"]`); - await button.focus(); - await button.asElement().click(); - await frame.waitFor(`div[data-test="${tableId}"]`, { visible: true }); - - // delete container - - // click context menu for container - await frame.waitFor(`div[data-test="${tableId}"] > div > button`, { visible: true }); - await frame.click(`div[data-test="${tableId}"] > div > button`); - - // click delete container - await frame.waitFor(RENDER_DELAY); - await frame.waitFor('span[class="treeComponentMenuItemLabel deleteCollectionMenuItemLabel"]'); - await frame.click('span[class="treeComponentMenuItemLabel deleteCollectionMenuItemLabel"]'); - - // confirm delete container - await frame.waitFor('input[data-test="confirmCollectionId"]', { visible: true }); - await frame.type('input[data-test="confirmCollectionId"]', tableId); - - // click delete - await frame.waitFor('input[data-test="deleteCollection"]', { visible: true }); - await frame.click('input[data-test="deleteCollection"]'); - await frame.waitFor(LOADING_STATE_DELAY); - await frame.waitForSelector('div[class="splashScreen"] > div[class="title"]', { visible: true }); - - await expect(page).not.toMatchElement(`div[data-test="${tableId}"]`); - } catch (error) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const testName = (expect as any).getState().currentTestName; - await page.screenshot({ path: `failed-${testName}.jpg` }); - throw error; - } - }); -}); diff --git a/test/utils/shared.ts b/test/utils/shared.ts index 3960a936d..458899700 100644 --- a/test/utils/shared.ts +++ b/test/utils/shared.ts @@ -3,7 +3,7 @@ import { Frame } from "puppeteer"; export async function login(connectionString: string): Promise { const prodUrl = "https://localhost:1234/hostedExplorer.html"; - page.goto(prodUrl, { waitUntil: "networkidle2" }); + page.goto(prodUrl); // log in with connection string const handle = await page.waitForSelector("iframe"); From 09a95fded4c07fef3edfadf7b7f57d41cf920a0d Mon Sep 17 00:00:00 2001 From: Chris-MS-896 <64865559+Chris-MS-896@users.noreply.github.com> Date: Tue, 20 Oct 2020 17:42:39 -0500 Subject: [PATCH 3/4] =?UTF-8?q?[ID:=20833708][Screen=20Reader=20-=20Cosmos?= =?UTF-8?q?DB=20=E2=80=93=20New=20KeySpace]=20Visual=20label(K=E2=80=A6=20?= =?UTF-8?q?(#287)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * '[ID: 833708][Screen Reader - CosmosDB – New KeySpace] Visual label(Keyspace id) and aria-label(Database id) is not same for Keyspace id edit field.' * 'update on aria-label' --- .../Controls/ThroughputInput/ThroughputInputComponent.html | 2 +- .../ThroughputInput/ThroughputInputComponentAutoscaleV3.html | 2 +- src/Explorer/Panes/AddDatabasePane.html | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Explorer/Controls/ThroughputInput/ThroughputInputComponent.html b/src/Explorer/Controls/ThroughputInput/ThroughputInputComponent.html index 794820680..acd666829 100644 --- a/src/Explorer/Controls/ThroughputInput/ThroughputInputComponent.html +++ b/src/Explorer/Controls/ThroughputInput/ThroughputInputComponent.html @@ -45,7 +45,7 @@ + size="40" class="collid" data-bind="textInput: databaseId, hasFocus: firstFieldHasFocus, attr: { 'aria-label': databaseIdLabel, 'placeholder': databaseIdPlaceHolder }" + autofocus> From e09730d782eaf4aa8325a044d206f3dcd534a2ae Mon Sep 17 00:00:00 2001 From: Steve Faulkner Date: Tue, 20 Oct 2020 22:58:36 -0500 Subject: [PATCH 4/4] Fixed Collections for Mongo can have 20gb (#293) --- src/Explorer/Panes/AddCollectionPane.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Explorer/Panes/AddCollectionPane.html b/src/Explorer/Panes/AddCollectionPane.html index 94d704046..d861f6e1d 100644 --- a/src/Explorer/Panes/AddCollectionPane.html +++ b/src/Explorer/Panes/AddCollectionPane.html @@ -276,7 +276,7 @@
- +