Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a1b8fe9
chore: prepare plugin for release
vCaisim Apr 10, 2023
63c06e8
fix: add missing workflow env vars
vCaisim Apr 10, 2023
7210d10
Update deploy.yaml
vitaliimelnychuk Apr 10, 2023
c872b1d
Update deploy.yaml
vitaliimelnychuk Apr 10, 2023
2595389
feat: refactor file template
vitaliimelnychuk Apr 10, 2023
155ca34
fix: remove prefix
vitaliimelnychuk Apr 10, 2023
91286e8
fix: prefiux
vitaliimelnychuk Apr 10, 2023
35a9e2f
fix: checkout to app dir
vitaliimelnychuk Apr 10, 2023
e2268ee
fix: use official aws commands to upload
vitaliimelnychuk Apr 10, 2023
de47c9c
chore: deployment
vitaliimelnychuk Apr 10, 2023
01a0bc9
fix: use aws v2
vitaliimelnychuk Apr 10, 2023
ea86ca6
fix: set region
vitaliimelnychuk Apr 10, 2023
723f8a1
feat: set environment
vitaliimelnychuk Apr 10, 2023
6f7dfbd
feat: remove PR trigger
vitaliimelnychuk Apr 10, 2023
395e5f4
feat: add ci workflow
vitaliimelnychuk Apr 10, 2023
7e25706
refactor: rename from @currents/cypress-debugger to cypress-debugger
vCaisim Apr 11, 2023
9ccb842
versioning
vCaisim Apr 11, 2023
49344e7
docs: update CONTRIBUTE.md
vCaisim Apr 11, 2023
8c229b5
chore: reformat contribute
agoldis Apr 13, 2023
ccc6464
chore: testing release
agoldis Apr 13, 2023
c3b4577
chore: make plugin pacakges public
agoldis Apr 13, 2023
a7e2efb
chore: ..
agoldis Apr 13, 2023
b12de13
chore: ..
agoldis Apr 13, 2023
109e0ca
1.0.2
agoldis Apr 13, 2023
79d984f
chore: revert version changes
agoldis Apr 13, 2023
b24f6a9
chore: add lint & format scripts
vCaisim Apr 13, 2023
a41b3ed
trigger ci
vCaisim Apr 13, 2023
dcf88b7
Feat/release andrew (#35)
agoldis Apr 13, 2023
62f20dc
fix: build
vCaisim Apr 14, 2023
139520c
fix: allow empty har field (#37)
vCaisim Apr 25, 2023
bcb2401
Feat/use tailwind (#38)
vCaisim Apr 25, 2023
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
10 changes: 0 additions & 10 deletions .eslintrc.js

This file was deleted.

28 changes: 28 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches: [main]

jobs:
checks:
if: "!contains(toJSON(github.event.commits.*.message), '[skip ci]')"
runs-on: ubuntu-latest

steps:
- name: Checkout source code
uses: actions/checkout@v3
with:
node-version: '16'

- name: Install dependencies
run: npm ci

- name: Linting
run: npm run lint

- name: Formatting
run: npm run format
37 changes: 37 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Deploy

on:
push:
branches:
- main

jobs:
build:
if: "!contains(toJSON(github.event.commits.*.message), '[skip ci]')"
runs-on: ubuntu-latest
environment: Production

steps:
- name: Checkout source code
uses: actions/checkout@v3
with:
node-version: '16'

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Deploy dashboard to bucket
run: aws s3 sync ./apps/web/dist s3://${{ secrets.S3_BUCKET }}

- name: Invalidate dashboard cloudfront
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} --paths "/*"
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules

**/dist
.esbuild
**/dump
.turbo
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"singleQuote": true
}
106 changes: 93 additions & 13 deletions CONTRIBUTE.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@

## Project Structure

The project is a monorepo created with [turbo](https://turbo.build/repo). It consists of a cypress plugin and a web application.
- `packages/cypress-debugger` - the entry point. It exports `debuggerSupport` and `debuggerPlugin` functions, required for plugin installation and a set of types used in the web application.

The plugin generates a `json` file for each test into the `dump` folder inside the working directory. Each file contains the following fields:
- `packages/support` - [Cypress Events](https://docs.cypress.io/api/cypress-api/catalog-of-events) handlers that are responsible for collecting events:

- `cy` - a list of cypress events. The data is collected from the cypress [`log:added`](https://docs.cypress.io/api/cypress-api/catalog-of-events) event.
- cypress steps
- [rrweb](https://www.npmjs.com/package/rrweb) events
- network requests using the [HAR generator cypress plugin](https://github.com/NeuraLegion/cypress-har-generator)

- `rr` - a list of [rrweb](https://www.npmjs.com/package/rrweb) records, which represents the mutations in the DOM. The entries are linked to `cy` events on cypress `log:added` and `log:changed` events.
- `packages/plugin` - exports a function that attaches [Cypress Plugin Events](https://docs.cypress.io/api/plugins/writing-a-plugin) handlers used inside the `setupNodeEvents` function of the cypress configuration.

- `har` - an [HTTPArchive(HAR)](http://www.softwareishard.com/blog/har-12-spec/) object, recorded by the [HttpArchive Generator](https://github.com/NeuraLegion/cypress-har-generator).
Here are collected the browser logs, and created the files with the collected information. The browser logs are accessed using the [Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/) by connecting to the cypress browser using the remote debugging port. The result files are created in the `dump` folder relative to the cypress config file.

- `meta` - [`RunContextData`](./packages/support/src/cy/runContext.ts) an object with the following fields:

```typescript
{
spec: string; // spec filename
Expand All @@ -28,16 +30,13 @@ The plugin generates a `json` file for each test into the `dump` folder inside t

- `packages/cypress-debugger` - the plugin entry point. It exports the `debuggerSupport` and `debuggerPlugin` functions, required for plugin installation and a set of types used in the web application.

- `packages/support` - exports the function that attaches handlers to [Cypress Events](https://docs.cypress.io/api/cypress-api/catalog-of-events). Here are made the following actions:
- collect cypress events
- collect [rrweb](https://www.npmjs.com/package/rrweb) events and match them with rrweb events
- recording network events (using the [HAR generator cypress plugin](https://github.com/NeuraLegion/cypress-har-generator))
- `packages/support` - exports the function that attaches handlers to [Cypress Events](https://docs.cypress.io/api/cypress-api/catalog-of-events). Here are made the following actions: - collect cypress events - collect [rrweb](https://www.npmjs.com/package/rrweb) events and match them with rrweb events - recording network events (using the [HAR generator cypress plugin](https://github.com/NeuraLegion/cypress-har-generator))

- `packages/plugin` - exports a function that attaches [Cypress Plugin Events](https://docs.cypress.io/api/plugins/writing-a-plugin) handlers used inside the `setupNodeEvents` function of the cypress configuration. Here are collected the browser logs, and created the files with the collected information.
The browser logs are accessed using the [Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/) by connecting to the cypress browser using the remote debugging port.
The result files are created in the `dump` folder relative to the cypress config file.
The browser logs are accessed using the [Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/) by connecting to the cypress browser using the remote debugging port.
The result files are created in the `dump` folder relative to the cypress config file.
- `apps/web` - the web application.
The Web application is a basic UI created with [Vite](https://vitejs.dev/), [React](https://react.dev/) and [Typescript](https://www.typescriptlang.org/). It is a tool that helps to analyze the information from the files generated by the plugin. It also serves as an example for plugin integration.
The Web application is a basic UI created with [Vite](https://vitejs.dev/), [React](https://react.dev/) and [Typescript](https://www.typescriptlang.org/). It is a tool that helps to analyze the information from the files generated by the plugin. It also serves as an example for plugin integration.
- `packages/eslint-config-custom` - shared [eslint](https://eslint.org/) configuration.

- `packages/tsconfig` - shared [tsconfig](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html).
Expand All @@ -57,3 +56,84 @@ Runs a few tests
cd apps/web
npx cypress run --browser chrome
```

## Data Structure

The plugin generates a `json` file for each test into the `dump` folder inside the working directory. Each file contains the following fields:

- `cy` - a list of cypress events. The data is collected from the cypress [`log:added`](https://docs.cypress.io/api/cypress-api/catalog-of-events) event.

- `rr` - a list of [rrweb](https://www.npmjs.com/package/rrweb) records, which represents the mutations in the DOM. The entries are linked to `cy` events on cypress `log:added` and `log:changed` events.

- `har` - an [HTTPArchive(HAR)](http://www.softwareishard.com/blog/har-12-spec/) object, recorded by the [HttpArchive Generator](https://github.com/NeuraLegion/cypress-har-generator).

- `meta` - [`RunContextData`](./packages/support/src/cy/runContext.ts) an object with the following fields:

```typescript
{
spec: string; // spec filename
test: string[]; // test title
retryAttempt: number; // https://docs.cypress.io/guides/guides/test-retries
}
```

- `browserLogs` - the browser logs collected using [chrome-remote-interface](https://www.npmjs.com/package/chrome-remote-interface).

- `pluginMeta` - the data passed down to the optional `meta` field of the `debuggerPlugin` options argument.

## Releasing

The project uses [Changesets](https://github.com/changesets/changesets) to manage releases.

### Beta channel

When you want to do a prerelease, you need to enter prerelease mode. You can do that with the `pre enter <tag>`. The tag that you need to pass is used in versions(e.g. `1.0.0-beta.0`) and for the npm dist tag.

Please check [Changesets Prereleases](https://github.com/changesets/changesets/blob/main/docs/prereleases.md) for reference.

Enter prerelease mode and made the first prerelease

```sh
npx changeset pre enter beta
npx changeset version
git add .
git commit -m "Enter prerelease mode and version packages"
npx changeset publish
git push --follow-tags
```

To add another prerelease, run:

```sh
npx changeset version
git add .
git commit -m "Version packages"
npx changeset publish
git push --follow-tags
```

To exit the prerelease mode and publish to latest:

```sh
npx changeset pre exit
npx changeset version
git add .
git commit -m "Exit prerelease mode and version packages"
npx changeset publish
git push --follow-tags
```

### Latest channel

```sh
npx changeset publish
```

### Localhost

```sh
docker run -it --rm --name verdaccio -p 4873:4873 verdaccio/verdaccio
npm adduser --registry http://localhost:4873
npm login --registry http://localhost:4873
npm_config_registry=http://localhost:4873 npx changeset publish
```
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The plugin captures all the information, saving it in a file that you can later
## Requirements

- Cypress version 10+
- NodeJS [14+](https://docs.cypress.io/guides/getting-started/installing-cypress#:~:text=If%20you're%20using%20npm,Node.js%2014.x)
- NodeJS [^14.17.0](https://docs.cypress.io/guides/getting-started/installing-cypress#:~:text=If%20you're%20using%20npm,Node.js%2014.x)
- Chromium family browsers only

## Setup
Expand All @@ -27,14 +27,14 @@ Add `cypress-debugger` to `cypress.config.{js|ts|mjs}`

```js
// cypress.config.js
const { defineConfig } = require("cypress");
const { debuggerPlugin } = require("cypress-debugger");
const { defineConfig } = require('cypress');
const { debuggerPlugin } = require('cypress-debugger');
module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
debuggerPlugin(on, {
meta: {
key: "value",
key: 'value',
},
// path: abosulte path to the dump file
// data: captured data
Expand All @@ -55,7 +55,7 @@ Add `cypress-debugger` to `cypress/support/e2e.{js|ts}`

```js
// cypress/support/e2e.js
const { debuggerSupport } = require("cypress-debugger");
const { debuggerSupport } = require('cypress-debugger');
debuggerSupport();
```

Expand Down Expand Up @@ -102,14 +102,14 @@ Example:

```js
// cypress.config.js
const { defineConfig } = require("cypress");
const { debuggerPlugin } = require("cypress-debugger");
const { defineConfig } = require('cypress');
const { debuggerPlugin } = require('cypress-debugger');
module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
debuggerPlugin(on, {
meta: {
key: "value",
key: 'value',
},
callback: (path, data) => {
console.log({ path, data });
Expand Down
8 changes: 6 additions & 2 deletions apps/web/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
module.exports = {
root: true,
extends: ["custom"],
extends: ['custom/eslint-react'],
parserOptions: {
root: true,
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
},
};
12 changes: 12 additions & 0 deletions apps/web/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# web

## 1.0.0

### Major Changes

- First release

### Patch Changes

- Updated dependencies
- cypress-debugger@1.0.0
16 changes: 8 additions & 8 deletions apps/web/cypress.config.ts → apps/web/cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { debuggerPlugin } from "@currents/cypress-debugger";
import { defineConfig } from "cypress";
const { defineConfig } = require('cypress');
const { debuggerPlugin } = require('cypress-debugger');

module.exports = defineConfig({
e2e: {
baseUrl: "https://todomvc.com/examples/backbone",
specPattern: "cypress/e2e/*.spec.js",
supportFile: "cypress/support/e2e.ts",
baseUrl: 'https://todomvc.com/examples/backbone',
specPattern: 'cypress/e2e/*.spec.js',
supportFile: 'cypress/support/e2e.ts',
setupNodeEvents(on, config) {
debuggerPlugin(on, {
meta: {
key: "value",
key: 'value',
},
callback: (file, data) => {
// executed after each test
console.log("results", {
console.log('results', {
file,
data,
});
Expand All @@ -23,7 +23,7 @@ module.exports = defineConfig({
return config;
},
},
projectId: "9aOuF6",
projectId: '9aOuF6',
video: true,
videoUploadOnPasses: false,
});
Loading