Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installable PWA #37

Merged
merged 9 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ lerna-debug.log*
node_modules
.DS_Store
dist
dev-dist
dist-ssr
coverage
*.local
Expand Down
14 changes: 5 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,19 @@

GetFit is a simple frontend-only exercise planner created with Vue3, TypeScript, and Vite. Used libraries include Pinia, Vuetify, Cypress and Vitest. For CI, the project uses Github Actions.

To test this app in production, visit <https://ajuvonen.github.io/getfit>
To test this app in production, visit <https://ajuvonen.github.io/getfit>. You can also install the app as a PWA on your own device.

## Requirements

Node 20+

## Running the project

1. Run `npm install`
2. Run `npm run build`
3. Run `npm preview`
4. Navigate to address shown on the terminal
PWA functionalities require a PWA-compatible browser.

## Running e2e tests

1. Repeat steps 1-2 of the instruction above
2. Run `npm run test:e2e`
1. Run `npm install`
2. Run `npm run build`
3. Run `npm run test:e2e`

## Running unit tests

Expand Down
3 changes: 2 additions & 1 deletion cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import {defineConfig} from 'cypress';
export default defineConfig({
e2e: {
specPattern: 'cypress/e2e/**/*.cy.ts',
baseUrl: 'http://localhost:5173/getfit/',
baseUrl: 'http://localhost:5173/getfit',
video: false,
trashAssetsBeforeRuns: true,
pageLoadTimeout: 5000,
},
});
10 changes: 10 additions & 0 deletions cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,15 @@
// Import commands.js using ES2015 syntax:
import './commands';

beforeEach(async () => {
if (!window.navigator || !navigator.serviceWorker) {
return null;
}
const registrations = await navigator.serviceWorker.getRegistrations();
return Promise.all(registrations.map((registration) => {
return registration.unregister();
}));
});

// Alternatively you can use CommonJS syntax:
// require('./commands')
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GetFit</title>
<meta name="theme-color" content="#FAFAFA">
</head>
<body>
<div id="app"></div>
Expand Down
Loading