Skip to content

Commit

Permalink
refactor: wip 11
Browse files Browse the repository at this point in the history
  • Loading branch information
BioPhoton committed Aug 2, 2023
1 parent 54f20b0 commit 4c8241f
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 39 deletions.
2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"default": {
"runner": "nx-cloud",
"options": {
"cacheableOperations": [],
"cacheableOperations": ["build"],
"accessToken": "OTI0YWJiN2ItNTI2MC00M2RmLTlmM2EtOWRiODZkYmVjZTAyfHJlYWQtd3JpdGU="
}
}
Expand Down
35 changes: 21 additions & 14 deletions projects/movies/user-flows/account-feature.uf.ts
Original file line number Diff line number Diff line change
@@ -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',
Expand All @@ -15,7 +26,7 @@ const flowOptions: UserFlowOptions = {
const interactions: UserFlowInteractionsFn = async (
ctx: UserFlowContext
): Promise<any> => {
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);
Expand All @@ -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',
});
Expand Down
40 changes: 26 additions & 14 deletions projects/movies/user-flows/ci-flow.uf.ts
Original file line number Diff line number Diff line change
@@ -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',
Expand All @@ -14,22 +27,21 @@ const flowOptions: UserFlowOptions = {
const interactions: UserFlowInteractionsFn = async (
ctx: UserFlowContext
): Promise<any> => {
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',
Expand Down
32 changes: 22 additions & 10 deletions projects/movies/user-flows/navigation.uf.ts
Original file line number Diff line number Diff line change
@@ -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',
Expand All @@ -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<any> => {
const {flow, collectOptions} = ctx;
const { flow, collectOptions } = ctx;
const baseUrl = `${collectOptions.url}`;
const ListNavigations = [
'/list/category/popular',
Expand Down

0 comments on commit 4c8241f

Please sign in to comment.