Étape 2 de l'expérimentation — un seul scénario minimal (remplir email/password sur l'écran de connexion) pour vérifier que addCucumberPreprocessorPlugin@22.2.0 + l'esbuild plugin fonctionnent de bout en bout, pas juste au chargement. Steps volontairement autonomes dans login-smoke.steps.ts (pas de fichier partagé) — tout ce fichier est prévu pour être supprimé une fois validé. cypress.config.ts : specPattern couvre maintenant *.cy.ts ET *.feature en parallèle (le reste de la suite reste en .cy.ts classique pour l'instant). Testé en local jusqu'au mur GPU/Electron habituel de cet environnement (chargement de la config + bundling esbuild passent, pas d'ERR_REQUIRE_ESM) — la vraie exécution du scénario reste à vérifier via la CI.
36 lines
1.4 KiB
TypeScript
36 lines
1.4 KiB
TypeScript
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";
|
|
|
|
export default defineConfig({
|
|
e2e: {
|
|
baseUrl: "http://localhost:5173",
|
|
// 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)
|
|
// where no GPU device is available.
|
|
on("before:browser:launch", (browser, launchOptions) => {
|
|
if (browser.family === "chromium") {
|
|
launchOptions.args.push("--disable-gpu", "--no-sandbox");
|
|
}
|
|
return launchOptions;
|
|
});
|
|
|
|
await addCucumberPreprocessorPlugin(on, config);
|
|
on(
|
|
"file:preprocessor",
|
|
createBundler({
|
|
plugins: [createEsbuildPlugin(config)],
|
|
}),
|
|
);
|
|
|
|
return config;
|
|
},
|
|
},
|
|
});
|