Compare commits
4 commits
main
...
experiment
| Author | SHA1 | Date | |
|---|---|---|---|
| 51a8e2bc50 | |||
| 99bb9fcfb2 | |||
| 7a504748ac | |||
| 7d812a7e9a |
5 changed files with 2399 additions and 5 deletions
|
|
@ -1,9 +1,18 @@
|
||||||
|
import { addCucumberPreprocessorPlugin } from "@badeball/cypress-cucumber-preprocessor";
|
||||||
|
import { createEsbuildPlugin } from "@badeball/cypress-cucumber-preprocessor/esbuild";
|
||||||
|
import createBundler from "@bahmutov/cypress-esbuild-preprocessor";
|
||||||
import { defineConfig } from "cypress";
|
import { defineConfig } from "cypress";
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
e2e: {
|
e2e: {
|
||||||
baseUrl: "http://localhost:5173",
|
baseUrl: "http://localhost:5173",
|
||||||
setupNodeEvents(on) {
|
// Experimental — testing whether real Gherkin .feature files work with
|
||||||
|
// this preprocessor version (see experiment/cucumber-cypress). Only one
|
||||||
|
// throwaway feature exists right now (login.feature); the rest of the
|
||||||
|
// suite is still plain .cy.ts, matched by the default `**/*.cy.ts`
|
||||||
|
// pattern alongside `**/*.feature`.
|
||||||
|
specPattern: ["cypress/e2e/**/*.cy.ts", "cypress/e2e/**/*.feature"],
|
||||||
|
async setupNodeEvents(on, config) {
|
||||||
// Disable GPU for headless/sandboxed environments (e.g. CI containers)
|
// Disable GPU for headless/sandboxed environments (e.g. CI containers)
|
||||||
// where no GPU device is available.
|
// where no GPU device is available.
|
||||||
on("before:browser:launch", (browser, launchOptions) => {
|
on("before:browser:launch", (browser, launchOptions) => {
|
||||||
|
|
@ -12,6 +21,16 @@ export default defineConfig({
|
||||||
}
|
}
|
||||||
return launchOptions;
|
return launchOptions;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await addCucumberPreprocessorPlugin(on, config);
|
||||||
|
on(
|
||||||
|
"file:preprocessor",
|
||||||
|
createBundler({
|
||||||
|
plugins: [createEsbuildPlugin(config)],
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
return config;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
12
apps/web/cypress/e2e/login-smoke.feature
Normal file
12
apps/web/cypress/e2e/login-smoke.feature
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
Feature: Login screen (throwaway smoke test)
|
||||||
|
Just checking that Gherkin + Cypress actually work end to end with the
|
||||||
|
currently installed preprocessor version — not meant to stay in the
|
||||||
|
suite long-term.
|
||||||
|
|
||||||
|
Scenario: A visitor can type their credentials into the login screen
|
||||||
|
Given I am not signed in
|
||||||
|
When I visit "/login"
|
||||||
|
And I fill in the "email" field with "alice@example.com"
|
||||||
|
And I fill in the "password" field with "correct-horse-battery-staple"
|
||||||
|
Then the "email" field should have the value "alice@example.com"
|
||||||
|
And the "password" field should have the value "correct-horse-battery-staple"
|
||||||
21
apps/web/cypress/e2e/login-smoke.ts
Normal file
21
apps/web/cypress/e2e/login-smoke.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
import { Given, Then, When } from "@badeball/cypress-cucumber-preprocessor";
|
||||||
|
|
||||||
|
// Throwaway smoke test — see login-smoke.feature. Steps are deliberately
|
||||||
|
// minimal/self-contained here rather than shared, since this whole file is
|
||||||
|
// meant to be deleted once it's proven the preprocessor works.
|
||||||
|
|
||||||
|
Given("I am not signed in", () => {
|
||||||
|
cy.intercept("GET", "**/auth/me", { statusCode: 401 });
|
||||||
|
});
|
||||||
|
|
||||||
|
When("I visit {string}", (path: string) => {
|
||||||
|
cy.visit(path);
|
||||||
|
});
|
||||||
|
|
||||||
|
When("I fill in the {string} field with {string}", (fieldId: string, value: string) => {
|
||||||
|
cy.get(`#${fieldId}`).type(value);
|
||||||
|
});
|
||||||
|
|
||||||
|
Then("the {string} field should have the value {string}", (fieldId: string, value: string) => {
|
||||||
|
cy.get(`#${fieldId}`).should("have.value", value);
|
||||||
|
});
|
||||||
|
|
@ -24,11 +24,14 @@
|
||||||
"zod": "^3.25.76"
|
"zod": "^3.25.76"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@badeball/cypress-cucumber-preprocessor": "22.2.0",
|
||||||
|
"@bahmutov/cypress-esbuild-preprocessor": "2.2.8",
|
||||||
"@types/node": "^22.9.0",
|
"@types/node": "^22.9.0",
|
||||||
"@types/react": "^18.3.12",
|
"@types/react": "^18.3.12",
|
||||||
"@types/react-dom": "^18.3.1",
|
"@types/react-dom": "^18.3.1",
|
||||||
"@vitejs/plugin-react": "^4.3.3",
|
"@vitejs/plugin-react": "^4.3.3",
|
||||||
"cypress": "^13.15.2",
|
"cypress": "13.17.0",
|
||||||
|
"esbuild": "0.21.5",
|
||||||
"sass": "^1.102.0",
|
"sass": "^1.102.0",
|
||||||
"start-server-and-test": "^2.0.8",
|
"start-server-and-test": "^2.0.8",
|
||||||
"typescript": "^5.7.2",
|
"typescript": "^5.7.2",
|
||||||
|
|
|
||||||
2345
pnpm-lock.yaml
2345
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue