Skip to content

Commit

Permalink
fix ts errors and added api test property avoided
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelangarano committed Sep 15, 2023
1 parent c6f903a commit 6912895
Show file tree
Hide file tree
Showing 17 changed files with 730 additions and 695 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

50 changes: 25 additions & 25 deletions e2e/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,7 @@ export const avoidablePropertiesCy13: AvoidableProperty[] = [
mustHave: true,
},
{
property:
/config\.resolved\.browsers\.value\[\d+\]\.minSupportedVersion/,
property: /config\.resolved\.browsers\.value\[\d+\]\.minSupportedVersion/,
mustHave: true,
isRegex: true,
},
Expand Down Expand Up @@ -466,6 +465,10 @@ export const avoidableApiPropertiesCy13: AvoidableProperty[] = [
property: "data.meta.platform.osVersion",
mustHave: true,
},
{
property: "platform.browserVersion",
mustHave: true,
},
];

export const avoidedButNeedePropertiesCy13: AvoidableProperty[] = [
Expand Down Expand Up @@ -632,49 +635,47 @@ export function testEachResults(
if (!avoidableData) {
expect(
result.valueA,
`The values are not equal at: ${result.path}. ${
result.note ?? ""
}`
`The values are not equal at: ${result.path}. ${result.note ?? ""}`
).to.equal(result.valueB);
return;
}

if (avoidableData.mustHave) {
expect(
result.valueB,
`The values at ${
result.path
} does not exist and it should. ${result.note ?? ""}`
`The values at ${result.path} does not exist and it should. ${
result.note ?? ""
}`
).not.to.equal("Does not exist");
expect(
result.valueB,
`The values at ${
result.path
} does not exist and it should. ${result.note ?? ""}`
`The values at ${result.path} does not exist and it should. ${
result.note ?? ""
}`
).not.to.equal(undefined);
expect(
result.valueB,
`The values at ${
result.path
} does not exist and it should. ${result.note ?? ""}`
`The values at ${result.path} does not exist and it should. ${
result.note ?? ""
}`
).not.to.equal(null);
expect(
result.valueB,
`The values at ${
result.path
} does not exist and it should. ${result.note ?? ""}`
`The values at ${result.path} does not exist and it should. ${
result.note ?? ""
}`
).not.to.equal("");
expect(
result.valueB,
`The values at ${
result.path
} does not exist and it should. ${result.note ?? ""}`
`The values at ${result.path} does not exist and it should. ${
result.note ?? ""
}`
).not.to.equal("undefined");
expect(
result.valueB,
`The values at ${
result.path
} does not exist and it should. ${result.note ?? ""}`
`The values at ${result.path} does not exist and it should. ${
result.note ?? ""
}`
).not.to.equal("null");
return;
}
Expand All @@ -696,8 +697,7 @@ export function getCurrentsTestsVariables() {
process.env.CURRENTS_API_KEY ||
"YpYIAerb1rWuOFrvf7ciK8Za8koKgrtRfoDPboQUOjScnBv91m4qAXSDb8Rb57m9";
const apiUrl =
process.env.CURRENTS_RUN_BASE_URL ||
"https://api.currents.dev/v1/runs/";
process.env.CURRENTS_RUN_BASE_URL || "https://api.currents.dev/v1/runs/";
return {
projectId,
recordKey,
Expand Down
148 changes: 74 additions & 74 deletions packages/cypress-cloud/lib/api/types/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,130 +2,130 @@ import { Platform, ScreenshotArtifact } from "cypress-cloud/types";
import { SetTestsPayload, Test } from "./test";

export interface Screenshot {
screenshotId: string;
name: string | null;
testId: string;
takenAt: string;
height: number;
width: number;
screenshotURL: string;
screenshotId: string;
name: string | null;
testId: string;
takenAt: string;
height: number;
width: number;
screenshotURL: string;
}

export interface InstanceResultStats {
suites: number;
tests: number;
passes: number;
pending: number;
skipped: number;
failures: number;
wallClockStartedAt: string;
wallClockEndedAt: string;
wallClockDuration: number;
suites: number;
tests: number;
passes: number;
pending: number;
skipped: number;
failures: number;
wallClockStartedAt: string;
wallClockEndedAt: string;
wallClockDuration: number;
}

export interface ReporterStats {
suites: number;
tests: number;
passes: number;
pending: number;
failures: number;
start: string;
end: string;
duration: number;
suites: number;
tests: number;
passes: number;
pending: number;
failures: number;
start: string;
end: string;
duration: number;
}

export interface CypressConfig {
video: boolean;
videoUploadOnPasses: boolean;
[key: string]: any;
video: boolean;
videoUploadOnPasses: boolean;
[key: string]: any;
}

export interface InstanceResult {
stats: InstanceResultStats;
tests: Test[];
error?: string;
reporterStats: ReporterStats;
exception: null | string;
cypressConfig?: PickedCypressConfig | null;
screenshots: Screenshot[];
video: boolean;
videoUrl?: string;
hasCoverage?: boolean;
stats: InstanceResultStats;
tests: Test[];
error?: string;
reporterStats: ReporterStats;
exception: null | string;
cypressConfig?: PickedCypressConfig | null;
screenshots: Screenshot[];
video: boolean;
videoUrl?: string;
hasCoverage?: boolean;
}

export interface AssetUploadInstruction {
uploadUrl: string;
readUrl: string;
uploadUrl: string;
readUrl: string;
}

export interface ScreenshotUploadInstruction extends AssetUploadInstruction {
screenshotId: string;
screenshotId: string;
}

export type SetResultsTestsPayload = Pick<
Test,
"state" | "displayError" | "attempts"
Test,
"state" | "displayError" | "attempts"
> & { clientId: string };

export interface SetInstanceTestsPayload {
config: PickedCypressConfig;
tests: Array<SetTestsPayload>;
hooks: CypressCommandLine.RunResult["hooks"];
config: PickedCypressConfig;
tests: Array<SetTestsPayload>;
hooks: Record<string, any>[];
}

export type PickedCypressConfig = Pick<
CypressConfig,
"video" | "videoUploadOnPasses"
CypressConfig,
"video" | "videoUploadOnPasses"
>;

export type CreateInstancePayload = {
runId: string;
groupId: string;
machineId: string;
platform: Platform;
runId: string;
groupId: string;
machineId: string;
platform: Platform;
};

export type CreateInstanceCyPayload = CreateInstancePayload & {
batchSize: number;
batchSize: number;
};
export type CreateInstanceResponse = {
spec: string | null;
instanceId: string | null;
claimedInstances: number;
totalInstances: number;
spec: string | null;
instanceId: string | null;
claimedInstances: number;
totalInstances: number;
};

export type InstanceResponseSpecDetails = {
spec: string;
instanceId: string;
spec: string;
instanceId: string;
};
export type CreateInstancesResponse = {
specs: Array<InstanceResponseSpecDetails>;
claimedInstances: number;
totalInstances: number;
specs: Array<InstanceResponseSpecDetails>;
claimedInstances: number;
totalInstances: number;
};

export type UpdateInstanceResultsPayload = Pick<
InstanceResult,
"stats" | "exception" | "video" | "hasCoverage"
InstanceResult,
"stats" | "exception" | "video" | "hasCoverage"
> & {
tests: Array<SetResultsTestsPayload> | null;
tests: Array<SetResultsTestsPayload> | null;
} & {
reporterStats: CypressCommandLine.RunResult["reporterStats"] | null;
reporterStats: CypressCommandLine.RunResult["reporterStats"] | null;
} & {
screenshots: ScreenshotArtifact[];
screenshots: ScreenshotArtifact[];
};

export type UpdateInstanceResultsMergedPayload = {
tests: SetInstanceTestsPayload;
results: UpdateInstanceResultsPayload;
tests: SetInstanceTestsPayload;
results: UpdateInstanceResultsPayload;
};

export interface UpdateInstanceResultsResponse {
videoUploadUrl?: string | null;
screenshotUploadUrls: ScreenshotUploadInstruction[];
coverageUploadUrl?: string | null;
cloud?: {
shouldCancel: false | string;
};
videoUploadUrl?: string | null;
screenshotUploadUrls: ScreenshotUploadInstruction[];
coverageUploadUrl?: string | null;
cloud?: {
shouldCancel: false | string;
};
}
62 changes: 32 additions & 30 deletions packages/cypress-cloud/lib/api/types/test.ts
Original file line number Diff line number Diff line change
@@ -1,47 +1,49 @@
import { TestError } from "../../runner/spec.type";

export enum TestState {
Failed = "failed",
Passed = "passed",
Pending = "pending",
Skipped = "skipped",
Failed = "failed",
Passed = "passed",
Pending = "pending",
Skipped = "skipped",
}

export interface TestAttempt {
state: TestState;
error: CypressCommandLine.TestError | null;
wallClockStartedAt: string | null;
wallClockDuration: number | null;
videoTimestamp: number | null;
state: TestState;
error: TestError | null;
wallClockStartedAt: string | null;
wallClockDuration: number | null;
videoTimestamp: number | null;
}

interface TestConfig {
retries:
| {
openMode: number;
runMode: number;
}
| number;
retries:
| {
openMode: number;
runMode: number;
}
| number;
}

export interface TestHook {
clientId: string;
type: "before each";
title: string[];
body: string;
clientId: string;
type: "before each";
title: string[];
body: string;
}

export interface Test {
state: TestState;
testId: string;
displayError: string | null;
title: string[];
config?: null | TestConfig;
hookIds: string[];
body: string;
attempts: TestAttempt[];
hooks: TestHook[] | null;
state: TestState;
testId: string;
displayError: string | null;
title: string[];
config?: null | TestConfig;
hookIds: string[];
body: string;
attempts: TestAttempt[];
hooks: TestHook[] | null;
}

export type SetTestsPayload = Pick<
Test,
"body" | "title" | "config" | "hookIds"
Test,
"body" | "title" | "config" | "hookIds"
> & { clientId: string };
Loading

0 comments on commit 6912895

Please sign in to comment.