GithubHelp home page GithubHelp logo

christopherpholder / app-speed Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 9.81 MB

๐ŸŒŸ Beyond First Impressions: Measure your apps performance on user interactions

TypeScript 98.59% JavaScript 0.47% HTML 0.32% SCSS 0.62% Shell 0.01%

app-speed's Introduction

AppSpeed

The purpose of this repository it to create a simple way to run lighthouse user-flows online in a stable environment. It should have a web interface and allow users store and schedule user-flow audits.

General architecture for user-flow runner

  • APIGateway configured as a websocket
  • Lambda function to handle interactions
  • SQS Fifo to schedule the audits
  • SSM Document to initiate the runner
  • EC2 instance to run audits in a stable environment
  • S3 bucket to store the results

Screenshot 2022-11-15 at 15 34 17

The application is deployed using GitHub CI

Production Url

Development URL

app-speed's People

Contributors

biophoton avatar christopherpholder avatar

Stargazers

 avatar  avatar

Watchers

 avatar

app-speed's Issues

Send results via Email

Motivation

As I user I don't always want to wait for the results of the audit
I would like to be able to be notified with an email when the audit is complete

Implementation Ideas and questions

  • Should this can be an optional param in the audit form?
  • Should this require the user to log in?
  • Should this include additional notification methods?

feature: add exclude option to filter command

Motivation

As user i want to be able to see what chunks are required for a feature and are not require for a parent feature.

  • feature = entry point, route, feature, lazy component or dynamic-import

Description

Allow user to select both included entry points and excluded entry points on filter command.

Examples:

Full Command

esbuild-meta filter --dist stats.json --entry movie-detail-page --excludeFromEntry main

Command with Alias

esbuild-meta -d stats.json -e movie-detail-page -x main

Handling invalid input

If the user passes an entry point that does not exist it should throw an error. The error should contain the invalid entry input.

  • handle entry input not existing

Clear Stages in user-flow scheduling

Motivation

As a user,
when i run an audit on the portal,
i want to be updated on what is happening

Description

Update the user using a processing widget

image

Stages

  1. initializing (validating the audit request and adding it to the queue)
  2. scheduled (audit has been added to the queue SQS)
  3. running (audit is currently running on the server)
  4. fetching (audit results are being fetched from the S3)
  5. complete

Feature: User Flow Builder Form

Description

As a user i would like to be able to add all the interactions in an intuitive way throw a form to be tested.

Details

The general idea is to have a component called user-flow-audit-builder

  • It will contain one optional input of type AppSpeedAudit

  • The component will be a form

As a default is will start with:

  • Audit Name Input
  • Audit Device Toggle
  • Analyze Submit Button
    (These can potentially be in one row)

It will also start with the following default steps:

  • Start Navigation
  • Navigate
  • End Navigation

Each Step will have a ... more button on the top right corner

The more button will allow you to:

  • Add Step Before
  • Add Step After
  • Remove Step
  • Edit Step As JSON (TBD)

In general I am Implementing the same behavior as Chrome Recorder

image

Add persistence for viewing results

Story

A user can load a URL with the audit id and view a previews audit result

Motivation

As a user, I would like to be able to send a link so that a second user can see and download the results

TODOS

  • Generate a unique hash per audit as an id
  • Store a bucket object with the results URL

Service to manage User-Flow Step Form

Description

Logic related to the user-flow step should be moved out of the template and into a separate service.

Public Methods

It should have a method that when called can reset to a default. This actually means clearing it and leaving it with a type control only or it can also add the default values and controls for a newly selected step type.

  • resetStepForm

It should have a method to add new options or props to the step.

  • addStepProp

Public Properties

It should expose all the necessary information to display the form.

  • stepDetails$

type: formControl;
props: stepProp[]
optionalProps: stepProp[]

Send update to the client when the runner started auditing

Motivation

The user should be notified when the audit has been initiated

TODOS

  • Send a message to the client when the audit running
    When the Runner pulls the audit from the FIFO Queue it should notify the client via a WebSocket

  • Handle new state and display a message in the client app
    When the Client gets the notification it should update the toaster text

Improve running audit status and display

Motivation

When running an audit using the UI, the user should be able to see the state of the audit process.
this would show the use the audit did not fail and give them an idea of its status.

Audit status options

  • [sI] Idle > The audit has not been submitted
  • [sS] Scheduling > The WebSocket has been connected and the audit is being scheduled
  • [sQ] In queue > The Audit has been scheduled in the SQS FIFO Queue
  • [sA] Auditing > The Audit is in the runner and tests are being run
  • [sL] Loading > The audit results are being loaded on the client.
  • [sD] Done > The Audit is loaded and there are no further actions to be done
  • [sF] Failed > The audit or displaying the results did not work

Display components

  • [dR] Results box > The result viewer is visible
  • [dT] Toaster Text > The toaster displays text related to the status of the audit
  • [dL] Loading Spinner > The audit

Implementations steps

The status is visualized over the the above display components:

Legend:

  • Visible = V

  • Not Visible = NV

  • Idle ('idle')

    • RB - NV
    • TT - NV
    • LS - NV
  • Scheduling (optional)

    • RB - V
    • TT - 'Audit is being scheduled...'
    • LS - V
  • In queue ('queued')

    • RB - V
    • TT - 'The audit has been scheduled'
    • LS - V
  • [+] #11

    • [+] RB - V
    • [+] RB - 'Audit is in progress, results will be available shortly'
    • [+] LS - V
  • Loading ('loading')

    • RB - V
    • TT - 'Downloading results from storage'
    • LS - V
  • Done ('done')

    • RB - V
    • TT - NV
    • LS - NV
  • [+] #12

    • [+] RB - V
    • [+] TT - 'Sorry there was an error running the audit'
    • [+] LS - NV
    • [+] Alert - Should alert devs via email.

Document patterns used to create cli application

TL;DR;

The CLI was build with intent and was implements many patterns to reduce the cost of maintaining it and adding features. It is worth taking the time to document the decisions and pattern present in the app.

This is not a one time thing but a habit that should become engrain in this project. This should be documented!

Details

This Repo attempts to Produce Object Oriented Programming.

  • (DIP) Dependency Inversion Principle
  • Principle of inversion of controls
  • Dependency Injection

image

Recreation of User-Flows

Motivation

We are having issues migrating a lib from CJS to ESM. The reason for this issue is to get a better understanding of how to create a CLI lib from scratch correctly and with proper testing-.

Description

This issue describes how we can recreate user-flow from scratch, step by step.

It starts by asking fundamental questions and attempting to answer them with something actionable.


Project Setup

  • Show this project use NX?

NX is great for managing multiple packages and will help us maintain the separation between the sections of the repo. However, it should not be used as a dependency of the CLI

  • How should we split up the libs?

  • Should we use an app, lib structure or packages, etc?

  • What should be the testing strategy?

  • What development methodology should be used?

Do not run pipeline on readme changes

Description

The pipeline should not run when a PR is open with only changes to markdown files. It should also not run on merge with the same conditions

Distribute CI/CD

The code for the ci/cd is all in one large file with has so many repetitions.
Logic should be extracted to follow dry.

Fix server flakiness

Collecting information

Here is a description of the possible causes and solutions to the flakiness.

Calling during instance stopping

When the server runner does not find any more audits in the queue, it initiates a shot down.
Audit scheduling and queuing depend on the instance status if stop it initiates the runner, if not it only schedules.
If the server is in the process of being terminated and it attempts to schedule a new audit it can fail to run the new audit.

Load Balancing

Development and Production Servers

System Manager Auto Termination

Terminate shutdown on new queue item

When the server pulls from the queue (30s?) and does not find a scheduled audit it initiates a shutdown and kills the runner by returning void.

execSync('shutdown -h -t 5 & exit 0', {shell: '/bin/bash'});
return;

Potentially we could reduce the scheduling issue by not terminating the recursive function and killing the shutdown command if the pulling returns a value.
This would also allow us to increase the shutdown time to catch audits scheduled closer together.

TODOS

  • Server Manager SAM
  • Terminate shutdown on a new queue item

Server Manager SAM

Separating the logic for Server management and stand status checking will reduce the risk of coordination issues between the runner and the API gateway.

Functions

  • Server Status Checkers
  • Server Status Awaiters
  • System Manager Run Command
  • System Manager Command Status

Align Server Deployment

TODOS

  • Server Should be deployed with NX Command as target
  • NX command should allow specifying dev or prod
  • Deployment Target Should be part of the same pipeline sequence and have dependencies
  • Deployment Should utilize NX affected

Dynamic User-Flow Audit Builder

User-Story

As a user I can create share and edit custom user-flow audits.

Description

As a key feature in the application is the creation of more complex user flow audits. This means a user should be able to audit almost anything it is able to do locally using user-flow.

For this purpose the user-flow server now takes in a customized puppeteer reply JSON that has been extended to include user flow steps.

Store Audit On URL

User-Story

As a user I can share a custom user flow audit be sending a URL.

Description

To store the state and make sharing the audits easer, we will store the audit in the URL as a query parameter and sync it with the form value.

  • The audit builder Form is initialized from the query parameter
  • Query Parameter is missing a required input, a default will be provided and initialized.
  • When a value changes on the form the query parameter will reflect the change.

Global and Steps

The following is a breakdown of the properties of a user flow audit.

Top level

title

Type: string
Validation: todo
Required: True
Description: todo

timeout

Type: number
Default: todo
Max: todo
Min: todo
Required: true
Description: todo

device

Type: 'mobile' | 'tablet' | 'desktop'
Default: 'mobile'
Required: true

steps

Steps are an array of steps and will be handled separately.


Notes:
This Issue was originally based of #45 and #58 but due to requirement changes we have moved it here.

Users can add a replay script to ufo and measure their actions

Motivation

As a user I would like to be able to give ufo a list of actions to audit.

Suggested UI behaviour

  • Under the run audit text input box there should be link

Screenshot 2023-02-05 at 18 37 18

  • Clicking the link show change the form so the user can add an json replay.

Screenshot 2023-02-05 at 18 42 31

There should be an example user-flow inside of it.
There should also be a link to docs explaining how to use it.

Safety check - user - flows cannot contain the link to ufo !!! Infinite loop !!!

Future additions:
A button ti import the replay/user-flow
replay/user-flow validation, if its not correct it won't submit ...
A video detailing how two create a user-flow

Fix linting rule for container component naming

Features are located inside of container components which are named as such for example: export class SimpleAuditContainer

This causes this error:

Error: 25:14 error Component class names should end with one of these suffixes: "Component" (https://angular.io/styleguide#style-02-03) @angular-eslint/component-class-suffix

This is being suppressed using: // eslint-disable-next-line @angular-eslint/component-class-suffix

The suppressed comment should be removed by improving the lining rules for the features lib

Improve Yargs Command Typing

Description

Main currently looks like this:

const argv = await yargs(hideBin(process.argv))
  .options({ verbose, help, shutdown, dryRun })
  .command([ userFlowCommand ])
  .parse();

This means that all the commands have a default set of options.

However, the command typing is incorrect:

type UserFlowCommand = CommandModule<NonNullable<unknown>, UserFlowCommandOptions>

As it should include the global types in the command generict type.


We are also incorrectly declarring the command modules in yargs as we pass it as a command array and it propably should not be, eg: .command([ userFlowCommand ]).


We are also incorrectly using the Command builder

const userFlowBuilder: CommandBuilder = { queue, store };

This should be using the proper (argv) => argv.options(...options) with its correct typing.


We are also incorrectly using the type declarations of the command arguments. We should use the yargs typing that inferres it insead of creating out own interface!

TODOS

  • Fix command module typing to include generics of options
  • Fix command declaration to not be array of commands
  • Use typed functional command builders
  • Use InferredOptionTypes instead of our own interface

Handle Networkconnection

As some of the application's depend on a network connection we need to handle it's state.

The logic of the Websocke as well as the UI depends on a stable connection. Id the connection drops we have to handle errors and informing the user about it.

TODOS:

  • Implement a API /is-online that returns 1 to get a way to check if a internet connection is given
  • Implement a NetworkConnection service that exposes the online status
  • Implement a Ws service that wraps the default RxJS WebSocketSubject
    • implement a init method to initialize the connecction logic
    • disconnect the ws id the network connection drops
    • disconnect the ws id the network connection drops
  • Disable the SimpleAuditForm if the connection dropped
  • Enable the SimpleAuditForm if the connection establishes again
  • Initialize the WS login after the first interaction that requires a WS connection is done (e.g. click the submit button, open a result)
  • Add disabled styles to forms
  • Remove old code

Migrate Angular to v17.1

  • Convert input setters to signal inputs.
  • Migrate to new application builder
  • Migrate to Material Standalone
  • Migrate RX-Angular

Implementing SVGs

Description

The application requires using SVGs and we want to handle that in a performant way.

Implementation

As a final solution we plan to use ngx-fast-svg, however there seems to be an use related to the lib that is causing it not to work properly in the repo. Therefore, for the moment we will implement SVG as templates and optimize them later.

Add Report Viewer

TL;DR

A user should be able to see the report using a viewer.

Description

A feature lib that takes the report generated by lighthouse and displays the results.

It should have a viewer for:

  • Category overview

  • Metrics

image

  • Filmstrip

image

  • Diagnostics

image

  • Passed Audits

image

List of todos

  • There should be a max size maybe 1400px for the viewer.

  • It should have a global section with details about the audit.

image

  • Only one audit step should be visible at the time

  • There should be a sticky menu at the top allowing you to switch steps

The sticky menu should look like a time line.

Icon -> Step Pic -> Step Pic

Summary -> Step -> Step

Category Overview

Metrics

  • Item and value should be on same line

  • Desktop should have two items per row

Filmstrip

  • Filmstrip pictures should have a border.

  • Consider multi line for mobile

image

Diagnostic

  • Prettify Audit Description URL (use the helpers from metrics)

  • #86

image

  • Add filter for related metric

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.