Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/follow-redirects-1.15.6
Browse files Browse the repository at this point in the history
  • Loading branch information
agoldis authored Oct 25, 2024
2 parents ea00625 + b0b2682 commit 11fa240
Show file tree
Hide file tree
Showing 20 changed files with 3,825 additions and 951 deletions.
7 changes: 5 additions & 2 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,17 @@ module.exports = {
// Additional headers for network requests, undefined by default
networkHeaders: {
"User-Agent": "Custom",
"x-ms-blob-type": "BlockBlob"
"x-ms-blob-type": "BlockBlob",
},
e2e: {
batchSize: 3, // orchestration batch size for e2e tests (Currents only, read below)
},
component: {
batchSize: 5, // orchestration batch size for component tests (Currents only, read below)
},
retry: {
hardFailureMaxRetries: 2, // max retries for hard Cypress failures, a hard failure is when Cyrpess crashes and doesn't report back any results (see https://docs.cypress.io/guides/guides/module-api#Handling-errors)
},
};
```

Expand Down Expand Up @@ -162,7 +165,7 @@ The configuration variables will resolve as follows:

## Batched Orchestration

This package uses its own orchestration and reporting protocol that is independent of cypress native implementation. The new [orchestration protocol]([https://currents.dev/readme/integration-with-cypress/cypress-cloud#batched-orchestration](https://currents.dev/readme/integration-with-cypress/cypress-cloud/batched-orchestration)) uses cypress in "offline" mode and allows batching multiple spec files for better efficiency. You can adjust the batching configuration in `currents.config.js` and use different values for e2e and component tests.
This package uses its own orchestration and reporting protocol that is independent of cypress native implementation. The new [orchestration protocol](<[https://currents.dev/readme/integration-with-cypress/cypress-cloud#batched-orchestration](https://currents.dev/readme/integration-with-cypress/cypress-cloud/batched-orchestration)>) uses cypress in "offline" mode and allows batching multiple spec files for better efficiency. You can adjust the batching configuration in `currents.config.js` and use different values for e2e and component tests.

## API

Expand Down
12 changes: 7 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# [1.11.0](https://github.com/currents-dev/cypress-cloud/compare/v1.10.2...v1.11.0) (2024-08-31)

### Features

## [1.10.2](https://github.com/currents-dev/cypress-cloud/compare/v1.10.1...v1.10.2) (2024-03-11)
- add retries for hard failures ([#211](https://github.com/currents-dev/cypress-cloud/issues/211)) ([1629759](https://github.com/currents-dev/cypress-cloud/commit/16297593632a9418a7bdd04369981c6d5016a443))

## [1.10.2](https://github.com/currents-dev/cypress-cloud/compare/v1.10.1...v1.10.2) (2024-03-11)

### Bug Fixes

* fix exports for getCI ([0dddc40](https://github.com/currents-dev/cypress-cloud/commit/0dddc40e24f7b880752814054d034a3784b7c87f))
- fix exports for getCI ([0dddc40](https://github.com/currents-dev/cypress-cloud/commit/0dddc40e24f7b880752814054d034a3784b7c87f))

## [1.10.1](https://github.com/currents-dev/cypress-cloud/compare/v1.10.0...v1.10.1) (2024-03-08)


### Bug Fixes

* fix teamcity ci resolution ([876267b](https://github.com/currents-dev/cypress-cloud/commit/876267b9667276473820badf6e72a8744c298c81))
- fix teamcity ci resolution ([876267b](https://github.com/currents-dev/cypress-cloud/commit/876267b9667276473820badf6e72a8744c298c81))

# [1.10.0](https://github.com/currents-dev/cypress-cloud/compare/v1.9.6...v1.10.0) (2024-01-30)

Expand Down Expand Up @@ -367,4 +369,4 @@
- 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))
- setup github actions ([d439f56](https://github.com/currents-dev/cypress-cloud/commit/d439f5660698177087fcc2e7a61c64ea263816f6))
12 changes: 12 additions & 0 deletions examples/happo/.happo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// .happo.js
const { RemoteBrowserTarget } = require("happo.io");

module.exports = {
apiKey: process.env.HAPPO_API,
apiSecret: process.env.HAPPO_SECRET,
targets: {
chrome: new RemoteBrowserTarget("chrome", {
viewport: "1024x768",
}),
},
};
25 changes: 25 additions & 0 deletions examples/happo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Happo + Currents + Cypress

An example showcasing setting up Happo with Currents.

```sh
export CURRENTS_RECORD_KEY=zzz
export HAPPO_API=yyy
export HAPPO_SECRET=xxx
npx happo-e2e -- npx cypress-cloud run --parallel --record --ci-build-id `date +%s`

[HAPPO] Listening on port 5339
Using config file: 'file:///Users/agoldis/cypress-cloud/examples/happo/currents.config.js'
Discovered 1 spec files
Tags: false; Group: false; Parallel: true; Batch Size: 2
Connecting to cloud orchestration service...

...

🏁 Recorded Run: https://app.currents.dev/run/9e2a97f99ec1ef16
[HAPPO] https://happo.io/a/1182/jobs/1338306
```

Note the use of [cypress-on-fix]() in [`cypress.config.ts`](examples/happo/cypress.config.ts) due to Cypress [bug](https://github.com/cypress-io/cypress/issues/5240)

![currents-2024-08-30-14 04 10@2x](https://github.com/user-attachments/assets/35ed8b0b-3951-406b-a1bd-0b8e9382e355)
9 changes: 9 additions & 0 deletions examples/happo/currents.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
e2e: {
batchSize: 2, // how many specs to send in one batch
},
component: {
batchSize: 5, // how many specs to send in one batch
},
projectId: "Ij0RfK",
};
28 changes: 28 additions & 0 deletions examples/happo/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { defineConfig } from "cypress";
import { cloudPlugin } from "cypress-cloud/plugin";

// @ts-ignore
import patchCypressOn from "cypress-on-fix";
// @ts-ignore
import * as happoTask from "happo-cypress/task";

import installTerminal from "cypress-terminal-report/src/installLogsPrinter";

module.exports = defineConfig({
e2e: {
baseUrl: "https://todomvc.com/examples/backbone/dist",
videoUploadOnPasses: false,
supportFile: "cypress/support/e2e.ts",
specPattern: "cypress/*/**/*.spec.js",
async setupNodeEvents(cyOn, config) {
const on = patchCypressOn(cyOn);

installTerminal(on, {
printLogsToConsole: "always",
});
happoTask.register(on, config);

return await cloudPlugin(on, config);
},
},
});
11 changes: 11 additions & 0 deletions examples/happo/cypress/e2e/happo.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
describe("Home page", function () {
this.beforeAll(() => {
cy.log("I run once before all tests in the block");
});

it("loads properly", function () {
cy.visit("/");
cy.log("log from cypress");
cy.get(".header").happoScreenshot();
});
});
2 changes: 2 additions & 0 deletions examples/happo/cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/// <reference types="cypress" />
import "happo-cypress";
39 changes: 39 additions & 0 deletions examples/happo/cypress/support/component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// ***********************************************************
// This example support/component.ts is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import "./commands";

// Alternatively you can use CommonJS syntax:
// require('./commands')

import { mount } from "cypress/react18";

// Augment the Cypress namespace to include type definitions for
// your custom command.
// Alternatively, can be defined in cypress/support/component.d.ts
// with a <reference path="./component" /> at the top of your spec.
declare global {
namespace Cypress {
interface Chainable {
mount: typeof mount;
}
}
}

Cypress.Commands.add("mount", mount);

// Example use:
// cy.mount(<MyComponent />)
7 changes: 7 additions & 0 deletions examples/happo/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require("cypress-terminal-report/src/installLogsCollector")();
require("cypress-cloud/support");
require("./commands");

beforeEach(() => {
cy.visit("/");
});
18 changes: 18 additions & 0 deletions examples/happo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "happo",
"version": "0.0.0",
"private": true,
"dependencies": {
"cypress": "12.17.4",
"cypress-cloud": "*",
"cypress-on-fix": "^1.0.2",
"cypress-terminal-report": "^7.0.2",
"happo-cypress": "^4.2.0",
"happo-e2e": "^2.6.1",
"happo.io": "^10.1.2"
},
"devDependencies": {
"tsconfig": "*",
"typescript": "^4.7.4"
}
}
34 changes: 34 additions & 0 deletions examples/happo/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Next.js",
"compilerOptions": {
"baseUrl": ".",
"composite": false,
"declaration": true,
"declarationMap": true,
"inlineSources": false,
"moduleResolution": "node",
"noUnusedLocals": false,
"noUnusedParameters": false,
"preserveWatchOutput": true,
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"incremental": true,
"esModuleInterop": true,
"module": "esnext",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve"
},
"ts-node": {
"compilerOptions": {
"module": "CommonJS"
}
},
"exclude": ["node_modules"]
}
5 changes: 4 additions & 1 deletion examples/webapp/currents.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ module.exports = {
? "Ij0RfK"
: "Ij0RfK",
// cloudServiceUrl: "http://localhost:1234",
userAgent: "custom",
// userAgent: "custom",
retry: {
hardFailureMaxRetries: 2,
},
};
Loading

0 comments on commit 11fa240

Please sign in to comment.