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

Vue3 upgrade #296

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
80d4b3e
Initial changes for vue3 upgrade
vvi230714 Jan 17, 2024
ac6747d
Updated webpack vue loader config
vvi230714 Jan 31, 2024
4e4f736
First no error Vite Build
vvi230714 Feb 1, 2024
bf32656
Vite testing updates
vvi230714 Feb 6, 2024
fb91c9c
Updates to try to get something to render
pwolanin Feb 21, 2024
5e5c648
Merge remote-tracking branch 'origin/master' into vue3-upgrade
pwolanin Feb 21, 2024
e869255
add back bulma scss
pwolanin Mar 13, 2024
ce1ad61
update leaflet use
pwolanin Mar 13, 2024
56b999d
vue-leaflet fixes
vvi230714 Apr 14, 2024
c1e1902
Trying to get zoomToWard to work again
pwolanin Apr 17, 2024
a8d6cbe
removed all vue filters
vvi230714 Apr 18, 2024
367a3f0
Quick fix for hover tips
pwolanin May 8, 2024
6fb754b
rm mapzen and update node version for actions
pwolanin May 14, 2024
54ad9ab
try to get action to run
pwolanin May 14, 2024
ca7445a
color fix
pwolanin May 15, 2024
3918cb5
deploy action fix
pwolanin May 15, 2024
df98caa
First working test
vvi230714 Jul 4, 2024
514b00e
Commit to resolve issues caused by last merge
vvi230714 Jul 29, 2024
a05da70
Fixed committe person and added verbose mode to jest
vvi230714 Aug 3, 2024
c75dac8
Fixed content-page test
vvi230714 Aug 13, 2024
b7b8fed
updated package lock
vvi230714 Aug 21, 2024
74f64d8
update CI action versions
pwolanin Sep 11, 2024
281a013
Unit Test Fixes
vvi230714 Sep 16, 2024
2f919fe
trying to get jest to work
pwolanin Sep 25, 2024
b2a9a2d
See if we can do test builds
pwolanin Dec 11, 2024
e943f31
removed buefy from test
vvi230714 Dec 13, 2024
8ededa3
Added cypress dependencies
vvi230714 Dec 18, 2024
729e4e5
use ubuntu-22.04
pwolanin Dec 18, 2024
5918730
Some Cypress Component Test Updates
vvi230714 Dec 23, 2024
a9e5063
Component Tests
vvi230714 Jan 7, 2025
9f99708
try running cypress
pwolanin Jan 15, 2025
fd3c55c
try to use realHover()
pwolanin Jan 15, 2025
440f9e2
playing with realHover
pwolanin Jan 15, 2025
88097fb
Baseball Card component test updates. Deleted Ward map component test.
vvi230714 Jan 18, 2025
fb4ff4a
Cypress E2E test addition
vvi230714 Jan 25, 2025
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
26 changes: 6 additions & 20 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,28 +1,14 @@
{
"presets": [
["env", {
modules: false,
useBuiltIns: true,
targets: {
browsers: [
'> 1%',
'last 2 versions'
]
["@babel/preset-env", {
"useBuiltIns": "entry",
"targets": {
"node": "current"
}
}]
],
"plugins": [
'@babel/plugin-transform-modules-commonjs',
"transform-object-rest-spread"
],
"env": {
"test": {
"presets": [
["env", {
targets: {
"node": "current"
}
}]
]
}
}
]
}
13 changes: 7 additions & 6 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,25 @@ on:
jobs:
build:

runs-on: ubuntu-latest
runs-on: ubuntu-22.04

strategy:
matrix:
node-version: [14.x]
node-version: [20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run lint
# - run: npm run lint
- run: npm run build
- run: npm test
- run: npm run cy:run
# - run: npm test
- run: npm run e2e-ci
- name: Upload E2E Test Report
uses: actions/upload-artifact@v3
Expand Down
16 changes: 12 additions & 4 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,30 @@ defaults:
jobs:
build:

runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 20.x
cache: 'npm'
- run: npm ci
- run: npm run build

# Deployment job
- name: Deploy 🚀
if: ${{ github.ref_name == 'master' }}
uses: JamesIves/[email protected]
with:
with:
BRANCH: gh-pages # The branch the action should deploy to.
FOLDER: public # The folder the action should deploy.
FOLDER: build # The folder the action should deploy.
- name: Test build
if: ${{ github.ref_name != 'master' }}
uses: JamesIves/[email protected]
with:
BRANCH: gh-pages-test # The branch the action should deploy to.
FOLDER: build # The folder the action should deploy.

7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.DS_Store
node_modules/
build/
public/build.js
public/build.js.map
public/assets
Expand All @@ -8,7 +9,7 @@ yarn-error.log
data-scripts/venv
data-scripts/__pycache__
data-scripts/*.pyc

public/build
# Editor directories and files
.idea
*.suo
Expand All @@ -17,4 +18,6 @@ data-scripts/*.pyc
*.sln
/test-results/
/playwright-report/
/playwright/.cache/
/playwright/.cache/
cypress/screenshots/*
cypress/videos/*
12 changes: 0 additions & 12 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM node:14-alpine3.15
RUN apk update && apk add --no-cache bash
FROM node:20-alpine3.18
RUN apk update && apk add --no-cache bash && apk add --no-cache python3
ENTRYPOINT ["bash"]
14 changes: 14 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
"presets": [
["@babel/preset-env", {
"useBuiltIns": "entry",
"targets": {
"node": "current"
}
}]
],
"plugins": [
'@babel/plugin-transform-modules-commonjs',
"transform-object-rest-spread"
]
}
38 changes: 38 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
const { defineConfig } = require('cypress');
const { startDevServer } = require('@cypress/vite-dev-server');

module.exports=defineConfig({
component: {
specPattern: '**/*.cy.{js,jsx,ts,tsx}',
devServer: {
framework: 'vue',
bundler: 'vite',
},
},
e2e: {
baseUrl: 'http://localhost:5173', // Default Vite dev server port
supportFile: 'cypress/support/e2e.js',
specPattern: 'cypress/e2e/**/*.cy.js',
viewportWidth: 1280,
viewportHeight: 720,
defaultCommandTimeout: 3000,
video: true,
retries: {
runMode: 2,
openMode: 0,
},
setupNodeEvents(on, config) {
on('dev-server:start', (options) => {
return startDevServer({
options,
viteConfig: {
configFile: 'vite.config.js', // Path to your Vite config file
},
});
});

return config;
},
},
});

90 changes: 90 additions & 0 deletions cypress/component/baseball-card.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import BaseballCard from '../../src/components/baseball-card/index.vue';

describe('BaseballCard Component', () => {
it('renders correctly with props', () => {
const props = {
name: 'John Doe',
ward: 1,
subWard: 'A',
party: 'democratic',
photo: 'https://example.com/photo.jpg',
registeredVotersParty: 1000,
turnoutParty: 400,
turnoutTotal: 600,
divisionCount: 30,
committeePersonCount: 25,
};

cy.mount(BaseballCard, { props });

// Verify basic rendering
cy.get('.stats h3').contains('John Doe');
cy.get('.ward-ordinal').contains('1st Ward A');
cy.get('dt').contains('Voters (D)');
cy.get('dd').contains('1,000');
cy.get('dt').contains('Turnout (D)');
cy.get('dd').contains('40%');
});

it('computes the correct URL', () => {
const props = {
name: 'Jane Doe',
ward: 3,
subWard: 'B',
party: 'republican',
registeredVotersParty: 500,
turnoutParty: 200,
turnoutTotal: 300,
divisionCount: 10,
committeePersonCount: 15,
};

cy.mount(BaseballCard, { props });
cy.get(".button").should('have.attr', 'to', '/leaders/republican/3B/jane-doe');
});

it('renders fallback values for missing data', () => {
const props = {
name: 'Anonymous',
ward: 4,
party: 'independent',
};

cy.mount(BaseballCard, { props });

cy.get('dt').contains('Voters (I)');
cy.get('dd').contains('Unknown');
cy.get('dt').contains('Turnout (I)');
cy.get('dd').contains('Unknown');
cy.get('dt').contains('Vacancies');
cy.get('dd').contains('Unknown');
});

it('responds to hover interactions', () => {
const props = {
name: 'Hover Test',
ward: 5,
party: 'democratic',
};

cy.mount(BaseballCard, { props });

// // Simulate hover interaction
cy.get('.front').should('be.visible');

// Check that the back side is rotated out of view
cy.get('.back').should('not.be.visible');

cy.get('.flip-container').realHover().find('.front').should(($front) => {
expect($front).to.not.be.visible;
expect($front).to.be.hidden;
});
// Still flipped.
cy.get('.front').should('be.hidden');

cy.get('.flip-container').realHover().find('.back').should(($back) => {
expect($back).to.be.visible;
});

});
})
61 changes: 61 additions & 0 deletions cypress/component/committee-person.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import CommitteePerson from '../../src/components/committee-person.vue'

describe('CommitteePerson Component', () => {
beforeEach(() => {
// Mount the component before each test
cy.mount(CommitteePerson, {
props: {
fullName: 'John Doe',
division: 3,
address: '123 Main Street, Springfield',
title: 'Chairman',
email: '[email protected]'
}
});
});

it('renders the full name correctly', () => {
cy.get('.title.is-4').should('contain.text', 'John Doe');
});

it('renders the division with ordinal formatting', () => {
cy.get('.subtitle.is-6 span:first').should('contain.text', '3rd Division');
});

it('renders the title when provided', () => {
cy.get('.subtitle.is-6').should('contain.text', '& Chairman');
});

it('does not render the title when not provided', () => {
cy.mount(CommitteePerson, {
props: {
fullName: 'John Doe',
division: 3,
address: '123 Main Street, Springfield',
email: '[email protected]'
}
});
cy.get('.subtitle.is-6').should('not.contain.text', '&');
});

it('renders the address correctly', () => {
cy.get('address').should('contain.text', '123 Main Street, Springfield');
});

it('renders the email as a mailto link when provided', () => {
cy.get('a[href="mailto:[email protected]"]').should('contain.text', '[email protected]');
});

it('does not render the email link when not provided', () => {
cy.mount(CommitteePerson, {
props: {
fullName: 'John Doe',
division: 3,
address: '123 Main Street, Springfield',
title: 'Chairman'
}
});
cy.get('a[href^="mailto:"]').should('not.exist');
});
});

34 changes: 34 additions & 0 deletions cypress/component/notification.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import Notification from '../../src/components/notification.vue'

describe('Notification Component', () => {
const message = 'This is a danger notification!';

beforeEach(() => {
// Mount the component before each test
cy.mount(Notification, {
props: {
msg: message,
}
});
});

it('renders the notification message correctly', () => {
cy.get('.notification.is-danger').should('contain.text', message);
});

it('emits the dismiss event when the delete button is clicked', () => {
const onDismissSpy = cy.spy().as('onDismissSpy');

cy.mount(Notification, {
props: {
msg: message,
onDismiss: onDismissSpy
}
});

cy.get('.delete').click();
cy.get('@onDismissSpy').should('have.been.calledOnce');
});

});

Loading