mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-04 00:18:01 +01:00
refactor: avoid splash pages in e2e tests (#810)
This commit is contained in:
parent
47e43dc23c
commit
cc0b9f7291
@ -1,6 +1,7 @@
|
|||||||
/// <reference types="cypress" />
|
/// <reference types="cypress" />
|
||||||
|
|
||||||
import { disableFeatureStrategiesProductionGuard } from '../../../src/component/feature/FeatureStrategy/FeatureStrategyProdGuard/FeatureStrategyProdGuard';
|
import { disableFeatureStrategiesProductionGuard } from '../../../src/component/feature/FeatureStrategy/FeatureStrategyProdGuard/FeatureStrategyProdGuard';
|
||||||
|
import { activeSplashIds } from '../../../src/component/splash/splash';
|
||||||
|
|
||||||
const randomId = String(Math.random()).split('.')[1];
|
const randomId = String(Math.random()).split('.')[1];
|
||||||
const featureToggleName = `unleash-e2e-${randomId}`;
|
const featureToggleName = `unleash-e2e-${randomId}`;
|
||||||
@ -11,6 +12,13 @@ const baseUrl = Cypress.config().baseUrl;
|
|||||||
let strategyId = '';
|
let strategyId = '';
|
||||||
|
|
||||||
describe('feature', () => {
|
describe('feature', () => {
|
||||||
|
before(() => {
|
||||||
|
// Visit all splash pages to mark them as seen.
|
||||||
|
activeSplashIds.forEach(splashId => {
|
||||||
|
cy.visit(`/splash/${splashId}`);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
after(() => {
|
after(() => {
|
||||||
cy.request({
|
cy.request({
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
|
@ -5,14 +5,7 @@ import useSplashApi from 'hooks/api/actions/useSplashApi/useSplashApi';
|
|||||||
import { SplashPageOperators } from 'component/splash/SplashPageOperators/SplashPageOperators';
|
import { SplashPageOperators } from 'component/splash/SplashPageOperators/SplashPageOperators';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { useAuthSplash } from 'hooks/api/getters/useAuth/useAuthSplash';
|
import { useAuthSplash } from 'hooks/api/getters/useAuth/useAuthSplash';
|
||||||
|
import { splashIds, SplashId } from 'component/splash/splash';
|
||||||
// All known splash IDs.
|
|
||||||
export const splashIds = ['environments', 'operators'] as const;
|
|
||||||
|
|
||||||
// Active splash IDs that may be shown to the user.
|
|
||||||
export const activeSplashIds: SplashId[] = ['operators'];
|
|
||||||
|
|
||||||
export type SplashId = typeof splashIds[number];
|
|
||||||
|
|
||||||
export const SplashPage = () => {
|
export const SplashPage = () => {
|
||||||
const splashId = useRequiredPathParam('splashId');
|
const splashId = useRequiredPathParam('splashId');
|
||||||
|
@ -4,10 +4,7 @@ import { matchPath } from 'react-router';
|
|||||||
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
||||||
import { IFlags } from 'interfaces/uiConfig';
|
import { IFlags } from 'interfaces/uiConfig';
|
||||||
import { IAuthSplash } from 'hooks/api/getters/useAuth/useAuthEndpoint';
|
import { IAuthSplash } from 'hooks/api/getters/useAuth/useAuthEndpoint';
|
||||||
import {
|
import { activeSplashIds, SplashId } from 'component/splash/splash';
|
||||||
activeSplashIds,
|
|
||||||
SplashId,
|
|
||||||
} from 'component/splash/SplashPage/SplashPage';
|
|
||||||
|
|
||||||
export const SplashPageRedirect = () => {
|
export const SplashPageRedirect = () => {
|
||||||
const { pathname } = useLocation();
|
const { pathname } = useLocation();
|
||||||
|
7
frontend/src/component/splash/splash.tsx
Normal file
7
frontend/src/component/splash/splash.tsx
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
// All known splash IDs.
|
||||||
|
export const splashIds = ['environments', 'operators'] as const;
|
||||||
|
|
||||||
|
// Active splash IDs that may be shown to the user.
|
||||||
|
export const activeSplashIds: SplashId[] = ['operators'];
|
||||||
|
|
||||||
|
export type SplashId = typeof splashIds[number];
|
Loading…
Reference in New Issue
Block a user