Skip to content

Commit

Permalink
fix: reimplement cy13 comatibility tests
Browse files Browse the repository at this point in the history
  • Loading branch information
agoldis committed Sep 19, 2023
1 parent 3c78cc9 commit fc5587a
Show file tree
Hide file tree
Showing 16 changed files with 395 additions and 2,185 deletions.
6 changes: 5 additions & 1 deletion e2e/cypress-13-demo/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# E2E Compatibility Tests

```sh
CURRENTS_RECORD_KEY=<key> CURRENTS_PROJECT_ID=<project> npx jest --watch
CURRENTS_API_BASE_URL=https://api.currents.dev/v1 \
CURRENTS_API_KEY=<api_key> \
CURRENTS_RECORD_KEY=<key> \
CURRENTS_PROJECT_ID=<project> \
npx jest --watch
```
32 changes: 0 additions & 32 deletions e2e/cypress-13-demo/__tests__/run.spec.ts

This file was deleted.

72 changes: 72 additions & 0 deletions e2e/cypress-13-demo/__tests__/run.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import { expect, jest } from "@jest/globals";
import { fetchRun, runCypressCloud } from "../../utils/utils";

import { data } from "../data-references/ccy-1.9.4-cy-12-crapi";
import { all, config, specs } from "../data-references/ccy-1.9.4-cy-12-cycl";
const testSpecs = [
"a.spec.js",
"b.spec.js",
"c.spec.js",
"d.spec.js",
"e.spec.js",
];
let result: any = null;

describe("Cypress 13 compatible output", () => {
jest.setTimeout(60 * 1000 * 5);

beforeAll(async () => {
// import cached from "../data-references/ccy-1.10-cy-13-cycl.json";
// save the result to a file and read from json for faster development
// result = cached;
result = await runCypressCloud();
});

describe("Run Results", () => {
it("should have compatible summary", async () => {
expect(result).toMatchObject({
...all,
runs: expect.any(Array),
config: expect.any(Object),
});
});

it("should have compatible config", async () => {
expect(result.config).toMatchObject({
video: config.video,
version: expect.stringContaining("13."),
});
});

testSpecs.map((spec) => {
it(`${spec}: should be compatible`, async () => {
// @ts-ignore
if (!result?.status === "finished") {
throw new Error("Test did not finish");
}

// @ts-ignore
const actual = result.runs.find(
// @ts-ignore
(run) => run.spec.name === spec
);

// @ts-ignore
expect(actual).toMatchObject(specs[spec]);
});
});
});

describe("API results", () => {
let apiRun: any = null;
beforeAll(async () => {
const runId = result.runUrl.split("/").pop();
apiRun = await fetchRun(runId);
});

it(`should have compatible API results`, async () => {
expect(apiRun.status).toBe("OK");
expect(apiRun.data).toMatchObject(data);
});
});
});

This file was deleted.

Loading

0 comments on commit fc5587a

Please sign in to comment.