Runner Tweaks (#62)

Co-authored-by: Steve Faulkner <stfaul@microsoft.com>
This commit is contained in:
Steve Faulkner 2020-06-25 18:59:44 -05:00 committed by GitHub
parent 3bf42b23dd
commit e5fc6f2022
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 55 additions and 44 deletions

View File

@ -1,7 +1,7 @@
name: Runners name: Runners
on: on:
schedule: schedule:
- cron: "*/15 * * * *" - cron: "*/10 * * * *"
jobs: jobs:
sqlcreatecollection: sqlcreatecollection:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -1,52 +1,57 @@
import "expect-puppeteer"; import "expect-puppeteer";
import { trackEvent } from "./utils"; import { trackEvent, trackException } from "./utils";
jest.setTimeout(300000); jest.setTimeout(300000);
describe("Collection CRUD", () => { describe("Collection CRUD", () => {
it("should complete collection crud", async () => { it("should complete collection crud", async () => {
// Login to Azure Portal try {
await page.goto("https://portal.azure.com"); // Login to Azure Portal
await page.waitFor("input[name=loginfmt]"); await page.goto("https://portal.azure.com");
await page.type("input[name=loginfmt]", process.env.PORTAL_RUNNER_USERNAME); await page.waitFor("input[name=loginfmt]");
await page.click("input[type=submit]"); await page.type("input[name=loginfmt]", process.env.PORTAL_RUNNER_USERNAME);
await page.waitFor(3000); await page.click("input[type=submit]");
await page.waitFor("input[name=loginfmt]"); await page.waitFor(3000);
await page.type("input[name=passwd]", process.env.PORTAL_RUNNER_PASSWORD); await page.waitFor("input[name=loginfmt]");
await page.click("input[type=submit]"); await page.type("input[name=passwd]", process.env.PORTAL_RUNNER_PASSWORD);
await page.waitFor(3000); await page.click("input[type=submit]");
await page.waitForNavigation(); await page.waitFor(3000);
await page.goto( await page.waitForNavigation();
`https://ms.portal.azure.com/#@microsoft.onmicrosoft.com/resource/subscriptions/${process.env.PORTAL_RUNNER_SUBSCRIPTION}/resourceGroups/${process.env.PORTAL_RUNNER_RESOURCE_GROUP}/providers/Microsoft.DocumentDb/databaseAccounts/${process.env.PORTAL_RUNNER_DATABASE_ACCOUNT}/dataExplorer` await page.goto(
); `https://ms.portal.azure.com/#@microsoft.onmicrosoft.com/resource/subscriptions/${process.env.PORTAL_RUNNER_SUBSCRIPTION}/resourceGroups/${process.env.PORTAL_RUNNER_RESOURCE_GROUP}/providers/Microsoft.DocumentDb/databaseAccounts/${process.env.PORTAL_RUNNER_DATABASE_ACCOUNT}/dataExplorer`
// Wait for page to settle );
await page.waitFor(10000); // Wait for page to settle
// Find Data Explorer iFrame await page.waitFor(10000);
const frames = page.frames(); // Find Data Explorer iFrame
const dataExplorer = frames.find(frame => frame.url().includes("cosmos.azure.com")); const frames = page.frames();
// Click "New Container" const dataExplorer = frames.find(frame => frame.url().includes("cosmos.azure.com"));
const newContainerButton = await dataExplorer.$('button[data-test="New Container"]'); // Click "New Container"
await newContainerButton.click(); const newContainerButton = await dataExplorer.$('button[data-test="New Container"]');
// Wait for side pane to appear await newContainerButton.click();
await dataExplorer.waitFor(".contextual-pane-in"); // Wait for side pane to appear
// Fill out New Container form await dataExplorer.waitFor(".contextual-pane-in");
const databaseIdInput = await dataExplorer.$("#databaseId"); // Fill out New Container form
await databaseIdInput.type("foo"); const databaseIdInput = await dataExplorer.$("#databaseId");
const collectionIdInput = await dataExplorer.$("#containerId"); await databaseIdInput.type("foo");
await collectionIdInput.type("foo"); const collectionIdInput = await dataExplorer.$("#containerId");
const partitionKeyInput = await dataExplorer.$('input[data-test="addCollection-partitionKeyValue"]'); await collectionIdInput.type("foo");
await partitionKeyInput.type("/partitionKey"); const partitionKeyInput = await dataExplorer.$('input[data-test="addCollection-partitionKeyValue"]');
trackEvent({ name: "ProductionRunnerSuccess" }); await partitionKeyInput.type("/partitionKey");
trackEvent({ name: "ProductionRunnerSuccess" });
// TODO: Submit form and assert results // TODO: Submit form and assert results
// cy.wrap($body) // cy.wrap($body)
// .find("#submitBtnAddCollection") // .find("#submitBtnAddCollection")
// .click(); // .click();
// cy.wait(10000); // cy.wait(10000);
// cy.wrap($body) // cy.wrap($body)
// .find('div[data-test="resourceTreeId"]') // .find('div[data-test="resourceTreeId"]')
// .should("exist") // .should("exist")
// .find('div[class="treeComponent dataResourceTree"]') // .find('div[class="treeComponent dataResourceTree"]')
// .should("contain", dbId); // .should("contain", dbId);
} catch (error) {
trackException(error);
throw error;
}
}); });
}); });

View File

@ -13,3 +13,9 @@ module.exports.trackEvent = (...args) => {
client.trackEvent(...args); client.trackEvent(...args);
} }
}; };
module.exports.trackException = exception => {
if (client) {
client.trackException({ exception });
}
};