diff --git a/nx.json b/nx.json index 641348f7..5b0cb2de 100644 --- a/nx.json +++ b/nx.json @@ -3,7 +3,7 @@ "default": { "runner": "nx-cloud", "options": { - "cacheableOperations": [], + "cacheableOperations": ["build"], "accessToken": "OTI0YWJiN2ItNTI2MC00M2RmLTlmM2EtOWRiODZkYmVjZTAyfHJlYWQtd3JpdGU=" } } diff --git a/projects/movies/user-flows/account-feature.uf.ts b/projects/movies/user-flows/account-feature.uf.ts index 1c25cae5..a01c4db9 100644 --- a/projects/movies/user-flows/account-feature.uf.ts +++ b/projects/movies/user-flows/account-feature.uf.ts @@ -1,12 +1,23 @@ -import {UserFlowContext, UserFlowInteractionsFn, UserFlowOptions, UserFlowProvider,} from '@push-based/user-flow'; +import { + UserFlowContext, + UserFlowInteractionsFn, + UserFlowOptions, + UserFlowProvider, +} from '@push-based/user-flow'; +import { + getLhConfig, + mergeBudgets, +} from '../../movies-user-flows/src/internals/test-sets'; +import { ToolBarUfo } from '../../movies-user-flows/src/ufo/desktop/tool-bar.ufo'; +import { TmdbUfo } from '../../movies-user-flows/src/ufo/desktop/tmdb.ufo'; +import Budget from 'lighthouse/types/lhr/budget'; -import * as angularBudgets from '../testing/budgets/angular.budgets.json'; -import * as generalTimingBudget from '../testing/budgets/general-timing.budgets.json'; -import * as movieListBudgets from '../testing/budgets/movie-list.budgets.json'; - -import {getLhConfig, mergeBudgets,} from '../../movies-user-flows/src/internals/test-sets'; -import {ToolBarUfo} from '../../movies-user-flows/src/ufo/desktop/tool-bar.ufo'; -import {TmdbUfo} from '../../movies-user-flows/src/ufo/desktop/tmdb.ufo'; +// eslint-disable-next-line @typescript-eslint/no-var-requires +const angularBudgets: Budget[] = require('../testing/budgets/angular.budgets.json'); +// eslint-disable-next-line @typescript-eslint/no-var-requires +const generalTimingBudget: Budget[] = require('../testing/budgets/general-timing.budgets.json'); +// eslint-disable-next-line @typescript-eslint/no-var-requires +const movieListBudgets: Budget[] = require('../testing/budgets/movie-list.budgets.json'); const flowOptions: UserFlowOptions = { name: 'Login And Logout User Flow', @@ -15,7 +26,7 @@ const flowOptions: UserFlowOptions = { const interactions: UserFlowInteractionsFn = async ( ctx: UserFlowContext ): Promise => { - const {page, flow, collectOptions} = ctx; + const { page, flow, collectOptions } = ctx; const url = `${collectOptions.url}/list/category/popular`; const toolbar = new ToolBarUfo(ctx); const tmdbPage = new TmdbUfo(ctx); @@ -27,11 +38,7 @@ const interactions: UserFlowInteractionsFn = async ( await flow.navigate(url, { config: getLhConfig( - mergeBudgets([ - angularBudgets, - generalTimingBudget, - movieListBudgets, - ] as any) + mergeBudgets([angularBudgets, generalTimingBudget, movieListBudgets]) ), stepName: '🧭 Initial navigation', }); diff --git a/projects/movies/user-flows/ci-flow.uf.ts b/projects/movies/user-flows/ci-flow.uf.ts index de87d83d..c4c92841 100644 --- a/projects/movies/user-flows/ci-flow.uf.ts +++ b/projects/movies/user-flows/ci-flow.uf.ts @@ -1,11 +1,24 @@ -import {UserFlowContext, UserFlowInteractionsFn, UserFlowOptions, UserFlowProvider,} from '@push-based/user-flow'; +import { + UserFlowContext, + UserFlowInteractionsFn, + UserFlowOptions, + UserFlowProvider, +} from '@push-based/user-flow'; -import {mergeBudgets, MovieDetailPageUFO, MovieListPageUFO, SidebarUFO,} from '../../movies-user-flows/src'; -import {getLhConfig} from '../../movies-user-flows/src/internals/test-sets'; -import * as angularBudgets from '../testing/budgets/angular.budgets.json'; -import * as generalTimingBudget from '../testing/budgets/general-timing.budgets.json'; -import * as movieListBudgets from '../testing/budgets/movie-list.budgets.json'; +import { + mergeBudgets, + MovieDetailPageUFO, + MovieListPageUFO, + SidebarUFO, +} from '../../movies-user-flows/src'; +import { getLhConfig } from '../../movies-user-flows/src/internals/test-sets'; import Budget from 'lighthouse/types/lhr/budget'; +// eslint-disable-next-line @typescript-eslint/no-var-requires +const angularBudgets: Budget[] = require('../testing/budgets/angular.budgets.json'); +// eslint-disable-next-line @typescript-eslint/no-var-requires +const generalTimingBudget: Budget[] = require('../testing/budgets/general-timing.budgets.json'); +// eslint-disable-next-line @typescript-eslint/no-var-requires +const movieListBudgets: Budget[] = require('../testing/budgets/movie-list.budgets.json'); const flowOptions: UserFlowOptions = { name: 'Basic user flow to ensure basic functionality', @@ -14,22 +27,21 @@ const flowOptions: UserFlowOptions = { const interactions: UserFlowInteractionsFn = async ( ctx: UserFlowContext ): Promise => { - const {flow, collectOptions} = ctx; + const { flow, collectOptions } = ctx; const url = `${collectOptions.url}/list/category/popular`; const sidebar = new SidebarUFO(ctx); const movieListPage = new MovieListPageUFO(ctx); const topRatedName = 'topRated'; const movieDetailPage = new MovieDetailPageUFO(ctx); + const cfg = mergeBudgets([ + angularBudgets, + generalTimingBudget, + movieListBudgets, + ]); await flow.navigate(url, { stepName: '🧭 Initial navigation', - config: getLhConfig( - mergeBudgets([ - angularBudgets, - generalTimingBudget, - movieListBudgets, - ] as unknown as Budget[][]) - ), + config: getLhConfig(cfg), }); await flow.snapshot({ stepName: '✔ Initial navigation done', diff --git a/projects/movies/user-flows/navigation.uf.ts b/projects/movies/user-flows/navigation.uf.ts index 8a5277c9..8bb8e3e5 100644 --- a/projects/movies/user-flows/navigation.uf.ts +++ b/projects/movies/user-flows/navigation.uf.ts @@ -1,10 +1,22 @@ -import {UserFlowContext, UserFlowInteractionsFn, UserFlowOptions, UserFlowProvider,} from '@push-based/user-flow'; -import {mergeBudgets} from '../../movies-user-flows/src'; -import {getLhConfig} from '../../movies-user-flows/src/internals/test-sets'; -import * as angularBudgets from '../testing/budgets/angular.budgets.json'; -import * as generalTimingBudget from '../testing/budgets/general-timing.budgets.json'; -import * as movieListBudgets from '../testing/budgets/movie-list.budgets.json'; -import * as movieDetailBudgets from '../testing/budgets/movie-detail.budgets.json'; +import { + UserFlowContext, + UserFlowInteractionsFn, + UserFlowOptions, + UserFlowProvider, +} from '@push-based/user-flow'; +import { mergeBudgets } from '../../movies-user-flows/src'; +import { getLhConfig } from '../../movies-user-flows/src/internals/test-sets'; + +import Budget from 'lighthouse/types/lhr/budget'; + +// eslint-disable-next-line @typescript-eslint/no-var-requires +const angularBudgets: Budget[] = require('../testing/budgets/angular.budgets.json'); +// eslint-disable-next-line @typescript-eslint/no-var-requires +const generalTimingBudget: Budget[] = require('../testing/budgets/general-timing.budgets.json'); +// eslint-disable-next-line @typescript-eslint/no-var-requires +const movieListBudgets: Budget[] = require('../testing/budgets/movie-list.budgets.json'); +// eslint-disable-next-line @typescript-eslint/no-var-requires +const movieDetailBudgets: Budget[] = require('../testing/budgets/movie-detail.budgets.json'); const flowOptions: UserFlowOptions = { name: 'Initial Navigation of the Main Pages', @@ -14,17 +26,17 @@ const listBudgets = mergeBudgets([ angularBudgets, generalTimingBudget, movieListBudgets, -] as any); +]); const detailBudgets = mergeBudgets([ angularBudgets, generalTimingBudget, movieDetailBudgets, -] as any); +]); const interactions: UserFlowInteractionsFn = async ( ctx: UserFlowContext ): Promise => { - const {flow, collectOptions} = ctx; + const { flow, collectOptions } = ctx; const baseUrl = `${collectOptions.url}`; const ListNavigations = [ '/list/category/popular',