Skip to content

Commit

Permalink
feat: prepar for release
Browse files Browse the repository at this point in the history
  • Loading branch information
agoldis committed Feb 18, 2023
1 parent 2fb6b24 commit 3ee6757
Show file tree
Hide file tree
Showing 63 changed files with 28,277 additions and 7,101 deletions.
9 changes: 6 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
}
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[xml]": {
"editor.defaultFormatter": "DotJoshJohnson.xml"
}
}
71 changes: 26 additions & 45 deletions packages/cypress-cloud/CHANGELOG.md → CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,29 @@


## [1.3.2](https://github.com/currents-dev/cypress-cloud/compare/v1.3.1...v1.3.2) (2022-12-29)


### Bug Fixes

* restore capturing stdout ([8c98609](https://github.com/currents-dev/cypress-cloud/commit/8c9860962a083023ac71ac01294d20c551de809c))
- restore capturing stdout ([8c98609](https://github.com/currents-dev/cypress-cloud/commit/8c9860962a083023ac71ac01294d20c551de809c))

## [1.3.1](https://github.com/currents-dev/cypress-cloud/compare/v1.3.0...v1.3.1) (2022-12-29)

# [1.3.0](https://github.com/currents-dev/cypress-cloud/compare/v1.2.6...v1.3.0) (2022-12-29)


### Bug Fixes

* remove CYPRESS_RECORD_KEY from env vars ([3fbcb51](https://github.com/currents-dev/cypress-cloud/commit/3fbcb51749a6809aacfbd06da6b39eaee1c5aaa6))
* use run params everywhere ([133d135](https://github.com/currents-dev/cypress-cloud/commit/133d1355818ec4cd81e06347eb8bd4067fd834f7))

- remove CYPRESS_RECORD_KEY from env vars ([3fbcb51](https://github.com/currents-dev/cypress-cloud/commit/3fbcb51749a6809aacfbd06da6b39eaee1c5aaa6))
- use run params everywhere ([133d135](https://github.com/currents-dev/cypress-cloud/commit/133d1355818ec4cd81e06347eb8bd4067fd834f7))

### Features

* add more info about script params ([#57](https://github.com/currents-dev/cypress-cloud/issues/57)) ([929f3c9](https://github.com/currents-dev/cypress-cloud/commit/929f3c90f3cb14807f0eb584c3dec0198bfb8381))
- add more info about script params ([#57](https://github.com/currents-dev/cypress-cloud/issues/57)) ([929f3c9](https://github.com/currents-dev/cypress-cloud/commit/929f3c90f3cb14807f0eb584c3dec0198bfb8381))

## [1.2.6](https://github.com/currents-dev/cypress-cloud/compare/v1.2.5...v1.2.6) (2022-12-18)

## [1.2.5](https://github.com/currents-dev/cypress-cloud/compare/v1.2.4...v1.2.5) (2022-12-16)


### Bug Fixes

* remove "colors" dep ([4113bf8](https://github.com/currents-dev/cypress-cloud/commit/4113bf8c7d6bd6a6940a032995ba6033477dec62))
- remove "colors" dep ([4113bf8](https://github.com/currents-dev/cypress-cloud/commit/4113bf8c7d6bd6a6940a032995ba6033477dec62))

## [1.2.4](https://github.com/currents-dev/cypress-cloud/compare/v1.2.2...v1.2.4) (2022-12-16)

Expand All @@ -39,69 +33,56 @@

# [1.2.0](https://github.com/currents-dev/cypress-cloud/compare/v1.1.2...v1.2.0) (2022-12-16)


### Bug Fixes

* hadle errors and warnings ([d7c7c04](https://github.com/currents-dev/cypress-cloud/commit/d7c7c0420a563fcf182ab10a9f6f9518d8f56619)), closes [#4](https://github.com/currents-dev/cypress-cloud/issues/4)

- hadle errors and warnings ([d7c7c04](https://github.com/currents-dev/cypress-cloud/commit/d7c7c0420a563fcf182ab10a9f6f9518d8f56619)), closes [#4](https://github.com/currents-dev/cypress-cloud/issues/4)

### Features

* handle cypress crashes ([68b933e](https://github.com/currents-dev/cypress-cloud/commit/68b933e4228cab753f1b0bcaba2b7cf06f1561da))
- handle cypress crashes ([68b933e](https://github.com/currents-dev/cypress-cloud/commit/68b933e4228cab753f1b0bcaba2b7cf06f1561da))

## [1.1.2](https://github.com/currents-dev/cypress-cloud/compare/v1.1.1...v1.1.2) (2022-12-15)

## [1.1.1](https://github.com/currents-dev/cypress-cloud/compare/v1.1.0...v1.1.1) (2022-12-15)

# [1.1.0](https://github.com/currents-dev/cypress-cloud/compare/1.0.7...v1.1.0) (2022-12-15)


### Bug Fixes

* add CURRENTS_API_BASE_URL env var ([9635424](https://github.com/currents-dev/cypress-cloud/commit/9635424b54dcea00c4fd0485060b7ec3581b8fc5))
* capture uploads stdout ([6489278](https://github.com/currents-dev/cypress-cloud/commit/648927803a6a8f43e2d6aff18fcd69c57f7be4f5))
* cypress start commands ([f79e9fd](https://github.com/currents-dev/cypress-cloud/commit/f79e9fd859f9bb8c802dbc17cd132ff5d9941eb8))
* get projectRoot from resolved cypress config ([7ada7c3](https://github.com/currents-dev/cypress-cloud/commit/7ada7c37d95ea04b185a99cc89581b87dfa7ecfa))

- add CURRENTS_API_BASE_URL env var ([9635424](https://github.com/currents-dev/cypress-cloud/commit/9635424b54dcea00c4fd0485060b7ec3581b8fc5))
- capture uploads stdout ([6489278](https://github.com/currents-dev/cypress-cloud/commit/648927803a6a8f43e2d6aff18fcd69c57f7be4f5))
- cypress start commands ([f79e9fd](https://github.com/currents-dev/cypress-cloud/commit/f79e9fd859f9bb8c802dbc17cd132ff5d9941eb8))
- get projectRoot from resolved cypress config ([7ada7c3](https://github.com/currents-dev/cypress-cloud/commit/7ada7c37d95ea04b185a99cc89581b87dfa7ecfa))

### Features

* add CURRENTS_API_BASE_URL to be able to change base URL ([b6b7980](https://github.com/currents-dev/cypress-cloud/commit/b6b798068c9d4afb33979dde091ce90a992b05b2))
* add initial capture to uploaded results ([b064cfc](https://github.com/currents-dev/cypress-cloud/commit/b064cfc3fd8b46e9a46bb567c5f5439cf78a2964)), closes [#37](https://github.com/currents-dev/cypress-cloud/issues/37) [#23](https://github.com/currents-dev/cypress-cloud/issues/23)
* debug and logging ([34570be](https://github.com/currents-dev/cypress-cloud/commit/34570beac3d82cdf55b4a96631b6ac9810a1eb26))


- add CURRENTS_API_BASE_URL to be able to change base URL ([b6b7980](https://github.com/currents-dev/cypress-cloud/commit/b6b798068c9d4afb33979dde091ce90a992b05b2))
- add initial capture to uploaded results ([b064cfc](https://github.com/currents-dev/cypress-cloud/commit/b064cfc3fd8b46e9a46bb567c5f5439cf78a2964)), closes [#37](https://github.com/currents-dev/cypress-cloud/issues/37) [#23](https://github.com/currents-dev/cypress-cloud/issues/23)
- debug and logging ([34570be](https://github.com/currents-dev/cypress-cloud/commit/34570beac3d82cdf55b4a96631b6ac9810a1eb26))

## [1.0.7](https://github.com/currents-dev/cypress-cloud/compare/1.0.6...1.0.7) (2022-12-14)


### Features

* return cypress run results & exit with the expected code ([7460781](https://github.com/currents-dev/cypress-cloud/commit/7460781299f75334829a6359a42d77e425379940))


- return cypress run results & exit with the expected code ([7460781](https://github.com/currents-dev/cypress-cloud/commit/7460781299f75334829a6359a42d77e425379940))

## [1.0.6](https://github.com/currents-dev/cypress-cloud/compare/1.0.5...1.0.6) (2022-12-14)



## [1.0.5](https://github.com/currents-dev/cypress-cloud/compare/a9711bde1fbb2cd37dbc8979593159d183bfa866...1.0.5) (2022-12-14)


### Bug Fixes

* currens hostname ([b7a211a](https://github.com/currents-dev/cypress-cloud/commit/b7a211a0fbf2368d328c44e89964ca3b064cd414))
* fix cli e2e vs component tests ([27e519f](https://github.com/currents-dev/cypress-cloud/commit/27e519f8859c348155365dabcd43d3f96510297c))
* set the correct precedence when using axios config ([7d2da9a](https://github.com/currents-dev/cypress-cloud/commit/7d2da9aea83c53ac29658bc442f03fc9f99d19cd))
* turborepo env variables ([9c4abc6](https://github.com/currents-dev/cypress-cloud/commit/9c4abc6f510a7947428f71ab68d5fa04c08794ca))

- currens hostname ([b7a211a](https://github.com/currents-dev/cypress-cloud/commit/b7a211a0fbf2368d328c44e89964ca3b064cd414))
- fix cli e2e vs component tests ([27e519f](https://github.com/currents-dev/cypress-cloud/commit/27e519f8859c348155365dabcd43d3f96510297c))
- set the correct precedence when using axios config ([7d2da9a](https://github.com/currents-dev/cypress-cloud/commit/7d2da9aea83c53ac29658bc442f03fc9f99d19cd))
- turborepo env variables ([9c4abc6](https://github.com/currents-dev/cypress-cloud/commit/9c4abc6f510a7947428f71ab68d5fa04c08794ca))

### Features

* add CI provider info ([403be98](https://github.com/currents-dev/cypress-cloud/commit/403be9807a09fd1aad806ba51bd989a8992f7705))
* capture projectId from config or from env variable ([f0910ed](https://github.com/currents-dev/cypress-cloud/commit/f0910ed9210929a484cca35aa810bab0b172aa7d))
* guess browser ([ad11a40](https://github.com/currents-dev/cypress-cloud/commit/ad11a407becef77f815d8991e29699cae2f6f87f))
* implement generic http client with retries ([a9711bd](https://github.com/currents-dev/cypress-cloud/commit/a9711bde1fbb2cd37dbc8979593159d183bfa866))
* improve setup steps ([9bf16fe](https://github.com/currents-dev/cypress-cloud/commit/9bf16fe5f3773db4aa2f169515303ea6d0973da6))
* separate stdout per spec file ([a9d01c3](https://github.com/currents-dev/cypress-cloud/commit/a9d01c349cbfe140a568a452b0e7163e6d27f2db))
* setup github actions ([d439f56](https://github.com/currents-dev/cypress-cloud/commit/d439f5660698177087fcc2e7a61c64ea263816f6))
- add CI provider info ([403be98](https://github.com/currents-dev/cypress-cloud/commit/403be9807a09fd1aad806ba51bd989a8992f7705))
- capture projectId from config or from env variable ([f0910ed](https://github.com/currents-dev/cypress-cloud/commit/f0910ed9210929a484cca35aa810bab0b172aa7d))
- guess browser ([ad11a40](https://github.com/currents-dev/cypress-cloud/commit/ad11a407becef77f815d8991e29699cae2f6f87f))
- implement generic http client with retries ([a9711bd](https://github.com/currents-dev/cypress-cloud/commit/a9711bde1fbb2cd37dbc8979593159d183bfa866))
- improve setup steps ([9bf16fe](https://github.com/currents-dev/cypress-cloud/commit/9bf16fe5f3773db4aa2f169515303ea6d0973da6))
- separate stdout per spec file ([a9d01c3](https://github.com/currents-dev/cypress-cloud/commit/a9d01c349cbfe140a568a452b0e7163e6d27f2db))
- setup github actions ([d439f56](https://github.com/currents-dev/cypress-cloud/commit/d439f5660698177087fcc2e7a61c64ea263816f6))
135 changes: 83 additions & 52 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,89 +1,120 @@
### Cypress Cloud 2.0
# Cypress Cloud (@currents/cypress)

This is an experimental package that integrates cypress with Currents (and sorry cypress). It implements the orchestration protocol and results reporting, mimicking the internal cypress implementation. It runs cypress in "local" mode, explicitly providing the specific spec file to run each time.
Integrate Cypress with alternative cloud services like Currents or Sorry Cypress.

The flow is:
---

- Get resolved cypress configuration
- Run cypress as a child process with non-existing spec file
- Dump the resolved config to a temp file (using the cypress plugin)
- Collect resolved configuration from a temp file
- Discover spec files that need to run using the config file
- Create a new run in dashboard, start running spec files, invoking cypress from scratch for each spec file
- Upload results
**[Currents.dev](https://currents.dev/?utm_source=cy2)** - is a hosted cloud service used to run millions of Cypress tests without breaking the bank. This is an enhanced version of Sorry Cypress with better security, performance, analytics, integrations and support.

## Setup
**[Sorry Cypress](https://sorry-cypress.dev/?utm_source=cy2)** - is an open-source, free alternative to Cypress Cloud that unlocks unlimited parallelization, test recordings, and integration with GitHub, Slack and more.

See an example setup in `examples/nextjs` directory:
---

- note the "plugin" in `examples/nextjs/cypress.config.ts`
- projectId is defined in `currents.config.js`
[Changelog](./CHANGELOG.md) | [License](./LICENSE)

To run an example, make sure that currents is running locally and then:
## Setup

```
cd packages/cypress-cloud
nvm use # OR nvm install
yarn watch
Install the package

```sh
npm install @currents/cypress
```

... then in another terminal
Create a new configuration file: `currents.config.js` in the project’s root and set the `projectId` and the record key obtained from [Currents](https://app.currents.dev) or your self-hosted instance of Sorry Cypress:

```js
module.exports = {
projectId: "Ij0RfK",
recordKey: "xxx",
};
```
cd examples/nextjs
cp .env.example .env
export CURRENTS_RECORD_KEY=YOUR_CURRENTS_RECORD_KEY

Add `@currents/cypress/plugin` plugin to `cypress.config.{js|ts|mjs}`

```js
// cypress.config.js
const { defineConfig } = require("cypress");
const { cloudPlugin } = require("@currents/cypress/plugin");
module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
cloudPlugin(on, config);
},
},
});
```

Once you created new `.env` file please fill in all env variales from example file by using currents dashboard.
## Usage

Use the command bellow to run currents runner:
Obtain the record key from https://app.currents.dev (or use any value for Sorry Cypress)

```
yarn cypress
```sh
npx cypress-cloud --parallel --record --key <your_key> --ci-build-id hello-cypress-cloud
```

## Testing
See all the available options `npx cypress-cloud --help`

```
yarn test
```
## Example

Please note, we use `esbuild` for building and `swc` for testing. In addition, jest has built-in module aliases, but eslint does not. Beware of importing aliases in non-testing code.
See an example in [examples/webapp](./example/webapp) directory

## What's inside?
## Configuration

This turborepo uses [Yarn](https://yarnpkg.com/) as a package manager. It includes the following packages/apps:
```js
// currents.config.js
module.exports = {
projectId: "Ij0RfK",
recordKey: "the record key from currents.dev",
};
```

### Examples and Packages
Override the default configuration values via environment variables:

- `nextjs`: an example [Next.js](https://nextjs.org/) app with Currents Cypress Cloud setup
- `eslint-config-custom`: `eslint` configurations (includes `eslint-config-next` and `eslint-config-prettier`)
- `CURRENTS_API_BASE_URL` - sorry-cypress users - set the URL of your director service
- `CURRENTS_PROJECT_ID` - set the `projectId`
- `CURRENTS_RECORD_KEY` - cloud service record key

Each package/example is 100% [TypeScript](https://www.typescriptlang.org/).
## API

### Utilities
### `run`

This turborepo has some additional tools already setup for you:
Run Cypress tests programmatically

- [TypeScript](https://www.typescriptlang.org/) for static type checking
- [ESLint](https://eslint.org/) for code linting
- [Prettier](https://prettier.io) for code formatting
```ts
run(params: CurrentsRunParameters): Promise<CypressCommandLine.CypressRunResult | CypressCommandLine.CypressFailedRunResult>
```

### Build
- `params` - [CurrentsRunParameters](./packages/cypress-cloud/types.ts#L123) list of params compatible with Cypress [Module API](https://docs.cypress.io/guides/guides/module-api)

To build all apps and packages, run the following command:
- returns results as a [CypressRunResult](https://github.com/cypress-io/cypress/blob/19e091d0bc2d1f4e6a6e62d2f81ea6a2f60d531a/cli/types/cypress-npm-api.d.ts#L277)

```
cd cypress-cloud
yarn run build
Example:

```ts
import { run } from "@currents/cypress";

const results = await run({
reporter: "junit",
browser: "chrome",
config: {
baseUrl: "http://localhost:8080",
video: true,
},
});
```

### Develop
## Troubleshooting

To develop all apps and packages, run the following command:
Enable the debug mode and run the command

```sh
DEBUG=currents:* npx cypress-cloud run ...
```
cd cypress-cloud
yarn run dev

## Testing

```sh
yarn test
```

> Please note, we use `esbuild` for building and `swc` for testing. In addition, jest has built-in module aliases, but eslint does not. Beware of importing aliases in non-testing code.
62 changes: 0 additions & 62 deletions examples/nextjs/README.md

This file was deleted.

12 changes: 0 additions & 12 deletions examples/nextjs/currents.config.js

This file was deleted.

5 changes: 0 additions & 5 deletions examples/nextjs/cypress/e2e/1000.spec.js

This file was deleted.

Loading

0 comments on commit 3ee6757

Please sign in to comment.