Skip to content

cypress-debugger example #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

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 .github/workflows/currents.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,11 @@ jobs:
api-token: ${{ secrets.CURRENTS_API_KEY }}
github-run-id: ${{ github.run_id }}
github-run-attempt: ${{ github.run_attempt }}

- name: Save cypress traces
if: always()
uses: actions/upload-artifact@v3
with:
name: cypress-traces
path: |
apps/web/cypress-traces/**/*
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

cypress-traces
dump_har
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

Expand Down
17 changes: 16 additions & 1 deletion cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
import { defineConfig } from "cypress";
import { cloudPlugin } from "cypress-cloud/plugin";
import { initPlugins } from "cypress-plugin-init";

import { debuggerPlugin } from "cypress-debugger";

function initDebugger(
on: Cypress.PluginEvents,
config: Cypress.PluginConfigOptions
) {
return debuggerPlugin(on, config, {
failedTestsOnly: true,
targetDirectory: "cypress-traces",
callback: (path) => {
console.log("🎥 Recorded Cypress traces to: %s", path);
},
});
}
export default defineConfig({
e2e: {
baseUrl: "https://todomvc.com/examples/vanillajs",
specPattern: "cypress/e2e/*.spec.js",
supportFile: "cypress/support/e2e.ts",
setupNodeEvents: (on, config) => {
return cloudPlugin(on, config);
return initPlugins(on, [initDebugger, cloudPlugin], config);
},
},
video: true,
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/completed.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ context("Mark all as completed", function () {
cy.get("@todos").eq(2).should("not.have.class", "completed");
});

it("complete all checkbox should update state when items are completed / cleared", function () {
it("complete all checkbox should update state when items are completed or cleared", function () {
// alias the .toggle-all for reuse later
cy.get(".toggle-all")
.as("toggleAll")
Expand Down
2 changes: 2 additions & 0 deletions cypress/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { debuggerSupport } from "cypress-debugger";
import "./commands";

debuggerSupport();
beforeEach(() => {
cy.visit("/");
});
Loading