keycloak-scim/js/apps/admin-ui/cypress.config.js
Erik Jan de Wit d2e8092c7f
move keycloak select to ui-shared and fix typeahead (#30209)
* move keycloak select to ui-shared and fix typeahead

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>

* Fix the account console test

Signed-off-by: Hynek Mlnarik <hmlnarik@redhat.com>

* Fix cypress tests

Signed-off-by: Hynek Mlnarik <hmlnarik@redhat.com>

* fix for when value is an array

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>

* fix for when value is an array

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>

* add support for array selecting single value

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>

* fixed saying open once clicked outside and value

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>

* small issue when pressing enter

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>

---------

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
Signed-off-by: Hynek Mlnarik <hmlnarik@redhat.com>
Co-authored-by: Hynek Mlnarik <hmlnarik@redhat.com>
2024-06-07 16:05:03 +00:00

66 lines
1.8 KiB
JavaScript

import { defineConfig } from "cypress";
import cypressSplit from "cypress-split";
import fs from "node:fs";
import { isAsyncFunction } from "node:util/types";
const isCI = process.env.CI === "true";
export default defineConfig({
video: isCI,
projectId: "j4yhox",
chromeWebSecurity: false,
viewportWidth: 1920,
viewportHeight: 1200,
defaultCommandTimeout: 30000,
numTestsKeptInMemory: 30,
experimentalMemoryManagement: true,
retries: {
runMode: 3,
},
e2e: {
baseUrl: "http://localhost:8080",
slowTestThreshold: 30000,
specPattern: "cypress/e2e/**/*.{js,jsx,ts,tsx}",
setupNodeEvents(on, config) {
// after:spec collides with cypressSplit function below and is overridden there
function afterSpecRemoveSuccessfulVideos(spec, results) {
if (results?.video) {
// Do we have failures for any retry attempts?
const failures = results.tests.some((test) =>
test.attempts.some((attempt) => attempt.state === "failed"),
);
if (!failures) {
// delete the video if the spec passed and no tests retried
fs.rmSync(results.video, { force: true });
}
}
}
function chainedOn(event, callback) {
if (event === "after:spec") {
if (isAsyncFunction(callback)) {
on(event, async (spec, results) => {
afterSpecRemoveSuccessfulVideos(spec, results);
await callback(spec, results);
});
} else {
on(event, (spec, results) => {
afterSpecRemoveSuccessfulVideos(spec, results);
callback(spec, results);
});
}
} else {
on(event, callback);
}
}
cypressSplit(chainedOn, config);
return config;
},
},
});