Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Liuliu/change tests for migrated corona virus db #882

Merged
merged 14 commits into from
Oct 11, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe(`${pageName} renders expected components on different devices`, () => {
),
];

const skip = true;
const skip = false;
const devices = [macbook15ForAppLayout(pageName, tests, false, loggedIn)];
runTestsForDevices({ currentPage, devices, skip, loggedIn });
});
9 changes: 2 additions & 7 deletions cypress/e2e/dolthub/privatePaths/render/deploy/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
testDeployHosted,
testDeploySelfHosted,
} from "@utils/sharedTests/deployTab";
import { testOldFormatPopup } from "@utils/sharedTests/repoHeaderNav";

const pageName = "Deploy page for database";
const currentOwner = "automated_testing";
Expand All @@ -13,13 +12,9 @@ const currentPage = `repositories/${currentOwner}/${currentRepo}/deploy`;
const loggedIn = true;

describe(`${pageName} expected components on different devices`, () => {
const tests = [
testOldFormatPopup,
...testDeployHosted,
...testDeploySelfHosted,
];
const tests = [...testDeployHosted, ...testDeploySelfHosted];

const devices = [macbook15ForAppLayout(pageName, tests, false, loggedIn)];
const skip = true;
const skip = false;
runTestsForDevices({ currentPage, devices, skip, loggedIn });
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,18 @@ import { testLoggedInSignInTo } from "@sharedTests/signInTo";
import { macbook15ForAppLayout } from "@utils/devices";
import { newExpectation, newShouldArgs } from "@utils/helpers";
import { runTestsForDevices } from "@utils/index";
import { testOldFormatPopup } from "@utils/sharedTests/repoHeaderNav";

const isProd = Cypress.config().baseUrl === "https://www.dolthub.com";
const pageName = "Closed issue page";
const currentOwner = "automated_testing";
const currentRepo = "corona-virus";
const currentIssueId = isProd ? "9" : "8";
const currentIssueId = "4";
const currentPage = `repositories/${currentOwner}/${currentRepo}/issues/${currentIssueId}`;

describe(`${pageName} renders expected components on different devices`, () => {
const notExist = newShouldArgs("not.exist");
const beVisible = newShouldArgs("be.visible");

const tests = [
testOldFormatPopup,
newExpectation(
"should not find 404 page",
"[data-cy=issue-404-page]",
Expand Down Expand Up @@ -50,6 +47,6 @@ describe(`${pageName} renders expected components on different devices`, () => {

const devices = [macbook15ForAppLayout(pageName, tests, false, loggedIn)];

const skip = true;
const skip = false;
runTestsForDevices({ currentPage, devices, skip, loggedIn });
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,18 @@ import { testLoggedInSignInTo } from "@sharedTests/signInTo";
import { macbook15ForAppLayout } from "@utils/devices";
import { newExpectation, newShouldArgs } from "@utils/helpers";
import { runTestsForDevices } from "@utils/index";
import { testOldFormatPopup } from "@utils/sharedTests/repoHeaderNav";

const isProd = Cypress.config().baseUrl === "https://www.dolthub.com";
const pageName = "Open issue page";
const currentOwner = "automated_testing";
const currentRepo = "corona-virus";
const currentIssueId = isProd ? "6" : "7";
const currentIssueId = "2";
const currentPage = `repositories/${currentOwner}/${currentRepo}/issues/${currentIssueId}`;

describe(`${pageName} renders expected components on different devices`, () => {
const notExist = newShouldArgs("not.exist");
const beVisible = newShouldArgs("be.visible");

const tests = [
testOldFormatPopup,
newExpectation(
"should not find 404 page",
"[data-cy=issue-404-page]",
Expand Down Expand Up @@ -48,6 +45,6 @@ describe(`${pageName} renders expected components on different devices`, () => {
];
const loggedIn = true;
const devices = [macbook15ForAppLayout(pageName, tests, false, loggedIn)];
const skip = true;
const skip = false;
runTestsForDevices({ currentPage, devices, skip, loggedIn });
});
16 changes: 7 additions & 9 deletions cypress/e2e/dolthub/privatePaths/render/issues/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { macbook15ForAppLayout } from "@utils/devices";
import { newExpectation, newShouldArgs } from "@utils/helpers";
import { runTestsForDevices } from "@utils/index";
import { testOldFormatPopup } from "@utils/sharedTests/repoHeaderNav";

const pageName = "Issues page";
const currentOwner = "automated_testing";
Expand All @@ -14,7 +13,6 @@ describe(`${pageName} renders expected components on different devices`, () => {
const notExist = newShouldArgs("not.exist");

const tests = [
testOldFormatPopup,
newExpectation(
"should not find empty issue message",
"[data-cy=issue-no-issues]",
Expand All @@ -31,24 +29,24 @@ describe(`${pageName} renders expected components on different devices`, () => {
newShouldArgs("be.visible.and.have.length.of.at.least", 2),
),
newExpectation(
"should find issue with ID 8 with 5 columns",
"[data-cy=issue-row-8] > td",
"should find issue with ID 4 with 5 columns",
"[data-cy=issue-row-4] > td",
newShouldArgs("be.visible.and.have.length", 5),
),
newExpectation(
"should find issue with ID 8 with two links",
"[data-cy=issue-row-8] > td a",
"should find issue with ID 4 with two links",
"[data-cy=issue-row-4] > td a",
newShouldArgs("be.visible.and.have.length", 2),
),
newExpectation(
"should find issue with ID 8 with issue state label",
"[data-cy=issue-row-8] [data-cy=issue-state-label]",
"should find issue with ID 4 with issue state label",
"[data-cy=issue-row-4] [data-cy=issue-state-label]",
beVisible,
),
// ...testNewIssueButton(loggedIn), // TODO: add data-cy to button
];

const devices = [macbook15ForAppLayout(pageName, tests, false, loggedIn)];
const skip = true;
const skip = false;
runTestsForDevices({ currentPage, devices, skip, loggedIn });
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
import { macbook15ForAppLayout } from "@utils/devices";
import { newExpectation } from "@utils/helpers";
import { runTestsForDevices } from "@utils/index";
import { testOldFormatPopup } from "@utils/sharedTests/repoHeaderNav";

const pageName = "Webhooks page with webhook";
const currentOwner = "automated_testing";
Expand All @@ -16,7 +15,6 @@ const loggedIn = true;

describe(`${pageName} renders expected components on different devices`, () => {
const tests = [
testOldFormatPopup,
shouldFindAndContain("active-tab-webhooks-settings", "Webhooks"),
shouldBeVisible("repo-page-for-webhooks"),
shouldFindAndContain("webhooks-header", "Webhooks"),
Expand All @@ -29,6 +27,6 @@ describe(`${pageName} renders expected components on different devices`, () => {
];

const devices = [macbook15ForAppLayout(pageName, tests, false, loggedIn)];
const skip = true;
const skip = false;
runTestsForDevices({ currentPage, devices, skip, loggedIn });
});
16 changes: 7 additions & 9 deletions cypress/e2e/dolthub/privatePaths/render/webhooks/webhook.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
beVisible,
haveLength,
shouldBeVisible,
shouldFindAndContain,
} from "@sharedTests/sharedFunctionsAndVariables";
Expand All @@ -9,28 +8,27 @@ import {
newClickFlow,
newExpectation,
newExpectationWithClickFlow,
newShouldArgs,
scrollToPosition,
} from "@utils/helpers";
import { runTestsForDevices } from "@utils/index";
import { testOldFormatPopup } from "@utils/sharedTests/repoHeaderNav";

const pageName = "Webhook page";
const currentOwner = "automated_testing";
const currentRepo = "corona-virus";
const isProd = Cypress.config().baseUrl === "https://www.dolthub.com";
const currentWebhook = isProd
? "dc6682d3-f0df-4549-87a4-46874ac95ff2"
: "d4c4580c-1805-4e73-9e26-ae847789c0ed";
? "5ebe3b54-3528-4e2e-bce4-03bb90a3a27e"
: "8f3fc106-ec72-44ba-8d5d-c7d9c0f2fdbd";
const currentPage = `repositories/${currentOwner}/${currentRepo}/webhooks/${currentWebhook}`;
const loggedIn = true;

describe(`${pageName} renders expected components on different devices`, () => {
const attemptId = isProd
? "2a962909-6f88-41af-b613-12266e1f7b3a"
: "68fc0528-c258-4c55-a79a-1709b79759ec";
? "99b71670-c248-4248-9493-6659ab1292e3"
: "7186a042-c39c-41d2-9798-2b917e4b75d4";

const tests = [
testOldFormatPopup,
shouldFindAndContain("active-tab-webhooks-settings", "Webhooks"),
shouldBeVisible("repo-page-for-webhooks"),
shouldFindAndContain("webhook-header", "Webhooks"),
Expand All @@ -42,7 +40,7 @@ describe(`${pageName} renders expected components on different devices`, () => {
newExpectation(
"should have delivery attempt table with one row",
"[data-cy=delivery-attempt-table] tbody tr",
haveLength(1),
newShouldArgs("be.visible.and.have.length.of.at.least", 1),
),
newExpectationWithClickFlow(
"should have view button for attempt",
Expand All @@ -58,6 +56,6 @@ describe(`${pageName} renders expected components on different devices`, () => {
];

const devices = [macbook15ForAppLayout(pageName, tests, false, loggedIn)];
const skip = true;
const skip = false;
runTestsForDevices({ currentPage, devices, skip, loggedIn });
});
45 changes: 27 additions & 18 deletions cypress/e2e/dolthub/publicPaths/api/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const selectQuery = "SELECT * FROM `places` ORDER BY place_id ASC LIMIT 5;";
const badQuery = "heatdome";

describe("API returns 404 for invalid endpoints", () => {
xit("gets 404 responses from non-existent endpoints", () => {
it("gets 404 responses from non-existent endpoints", () => {
cy.request({
url: `/api/`,
failOnStatusCode: false,
Expand All @@ -32,10 +32,10 @@ describe("API returns 404 for invalid endpoints", () => {

describe(`API returns query results for '${defaultQuery}' from ${defaultBranch} without branch or query specified`, () => {
const earl = `/api/${apiVersion}/${repoOwner}/${repoName}`;
xit("gets a success response from the API", () => {
it("gets a success response from the API", () => {
cy.request({ url: earl }).its("status").should("equal", 200);
});
xit("contains the correct query metadata in the response body", () => {
it("contains the correct query metadata in the response body", () => {
cy.request({ url: earl })
.its("body.sql_query")
.should("equal", `${defaultQuery}`);
Expand All @@ -55,7 +55,7 @@ describe(`API returns query results for '${defaultQuery}' from ${defaultBranch}
.its("body.query_execution_message")
.should("equal", "");
});
xit("contains the correct query result schema in the response body", () => {
it("contains the correct query result schema in the response body", () => {
cy.request({ url: earl })
.its("body.schema")
.should("deep.equal", [
Expand All @@ -65,7 +65,7 @@ describe(`API returns query results for '${defaultQuery}' from ${defaultBranch}
},
]);
});
xit("contains the correct query result rows in the response body", () => {
it("contains the correct query result rows in the response body", () => {
cy.request({ url: earl })
.its("body.rows")
.should("deep.equal", [
Expand Down Expand Up @@ -101,10 +101,10 @@ describe(`API returns query results for '${defaultQuery}' from ${defaultBranch}

describe(`API returns query results for '${defaultQuery}' from branch ${otherBranch} without query specified`, () => {
const earl = `/api/${apiVersion}/${repoOwner}/${repoName}/${otherBranch}`;
xit("gets a success response from the API", () => {
it("gets a success response from the API", () => {
cy.request({ url: earl }).its("status").should("equal", 200);
});
xit("contains the correct query metadata in the response body", () => {
it("contains the correct query metadata in the response body", () => {
cy.request({ url: earl })
.its("body.sql_query")
.should("equal", `${defaultQuery}`);
Expand All @@ -124,7 +124,7 @@ describe(`API returns query results for '${defaultQuery}' from branch ${otherBra
.its("body.query_execution_message")
.should("equal", "");
});
xit("contains the correct query result schema in the response body", () => {
it("contains the correct query result schema in the response body", () => {
cy.request({ url: earl })
.its("body.schema")
.should("deep.equal", [
Expand All @@ -134,12 +134,15 @@ describe(`API returns query results for '${defaultQuery}' from branch ${otherBra
},
]);
});
xit("contains the correct query result rows in the response body", () => {
it("contains the correct query result rows in the response body", () => {
cy.request({ url: earl })
.its("body.rows")
.should("deep.equal", [
{ Tables_in_dolt: "case_details" },
{ Tables_in_dolt: "cases" },
{ Tables_in_dolt: "cases_by_age_range" },
{ Tables_in_dolt: "cases_by_age_sex" },
{ Tables_in_dolt: "cases_by_sex" },
{ Tables_in_dolt: "characteristics_age" },
{ Tables_in_dolt: "characteristics_case_severity" },
{ Tables_in_dolt: "characteristics_comorbid_condition" },
Expand All @@ -152,6 +155,12 @@ describe(`API returns query results for '${defaultQuery}' from branch ${otherBra
{ Tables_in_dolt: "current_cases" },
{ Tables_in_dolt: "current_deaths" },
{ Tables_in_dolt: "current_recovered" },
{ Tables_in_dolt: "deaths_by_age_range" },
{ Tables_in_dolt: "deaths_by_age_sex" },
{ Tables_in_dolt: "deaths_by_sex" },
{ Tables_in_dolt: "mortality_rate_by_age_range" },
{ Tables_in_dolt: "mortality_rate_by_age_sex" },
{ Tables_in_dolt: "mortality_rate_by_sex" },
{ Tables_in_dolt: "mortality_rates" },
{ Tables_in_dolt: "places" },
{ Tables_in_dolt: "time_series" },
Expand All @@ -163,10 +172,10 @@ describe(`API returns query results for '${selectQuery}' from ${defaultBranch} w
const earl = `/api/${apiVersion}/${repoOwner}/${repoName}?q=${encodeURI(
selectQuery,
)}`;
xit("gets a success response from the API", () => {
it("gets a success response from the API", () => {
cy.request({ url: earl }).its("status").should("equal", 200);
});
xit("contains the correct query metadata in the response body", () => {
it("contains the correct query metadata in the response body", () => {
cy.request({ url: earl })
.its("body.sql_query")
.should("equal", `${selectQuery}`);
Expand All @@ -186,7 +195,7 @@ describe(`API returns query results for '${selectQuery}' from ${defaultBranch} w
.its("body.query_execution_message")
.should("equal", "");
});
xit("contains the correct query result schema in the response body", () => {
it("contains the correct query result schema in the response body", () => {
cy.request({ url: earl })
.its("body.schema")
.should("deep.equal", [
Expand All @@ -196,11 +205,11 @@ describe(`API returns query results for '${selectQuery}' from ${defaultBranch} w
},
{
columnName: "province_state",
columnType: "varchar(1023)",
columnType: "longtext COLLATE utf8mb4_0900_ai_ci",
},
{
columnName: "country_region",
columnType: "varchar(1023)",
columnType: "longtext COLLATE utf8mb4_0900_ai_ci",
},
{
columnName: "latitude",
Expand All @@ -212,7 +221,7 @@ describe(`API returns query results for '${selectQuery}' from ${defaultBranch} w
},
]);
});
xit("contains the correct query result rows in the response body", () => {
it("contains the correct query result rows in the response body", () => {
cy.request({ url: earl })
.its("body.rows")
.should("deep.equal", [
Expand All @@ -235,7 +244,7 @@ describe(`API returns query results for '${selectQuery}' from ${defaultBranch} w
province_state: "Henan",
country_region: "China",
latitude: "33.882",
longitude: "113.61399999999999",
longitude: "113.614",
},
{
place_id: "4",
Expand All @@ -259,10 +268,10 @@ describe(`API returns query error for invalid query '${badQuery}'`, () => {
const earl = `/api/${apiVersion}/${repoOwner}/${repoName}?q=${encodeURI(
badQuery,
)}`;
xit("gets a success response from the API", () => {
it("gets a success response from the API", () => {
cy.request({ url: earl }).its("status").should("equal", 200);
});
xit("contains the correct query metadata in the response body", () => {
it("contains the correct query metadata in the response body", () => {
cy.request({ url: earl })
.its("body.sql_query")
.should("equal", `${badQuery}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe(`${pageName} renders expected components on different devices`, () => {
const devices = [
macbook15ForAppLayout(pageName, changeBranch(changeBranchParams)),
];
const skip = true;
const skip = false;
runTestsForDevices({
currentPage: `${currentPage}${currentBranch}`,
devices,
Expand Down
Loading
Loading