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

test: Fix CI pulling ARM image, causes errors #77

Closed
wants to merge 3 commits into from
Closed
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
2 changes: 1 addition & 1 deletion .github/workflows/main-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
runs-on: ubuntu-latest
services:
cockroach_db:
image: cockroachdb/cockroach:latest
image: cockroachdb/cockroach:v24.2.1
env:
COCKROACH_ARGS: 'start-single-node --insecure'
ports:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@
}}
required
selected={{
value: currentExercise.changeType ?? 'Percentage',
label: currentExercise.changeType ? convertCamelCaseToNormal(currentExercise.changeType) : 'Percentage'
value: currentExercise.changeType,
label: convertCamelCaseToNormal(currentExercise.changeType)
}}
>
<Select.Label class="p-0 text-sm font-medium leading-none">Load change type</Select.Label>
Expand All @@ -300,6 +300,7 @@
id="exercise-set-decrement"
placeholder="Type here"
required
step={0.5}
type="number"
bind:value={currentExercise.changeAmount}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export function averagePercentageChange(arr: number[]): number {
return totalPercentageChange / numberOfIncrements;
}

export function convertCamelCaseToNormal(text?: string): string {
export function convertCamelCaseToNormal(text?: string | null): string {
if (!text) return '';
return text
.replace(/([a-z])([A-Z])/g, '$1 $2')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
}

function getNextLoad(setIdx: number) {
if (!['Top', 'Down'].includes(exercise.setType)) return;
if (!['Down'].includes(exercise.setType)) return;
if (typeof exercise.sets[0].load !== 'number') return;
return floorToNearestMultiple(calculateNextLoad(setIdx), exercise.minimumWeightChange ?? 5).toString();
}
Expand Down Expand Up @@ -190,8 +190,6 @@
type="number"
bind:value={set.load}
/>
{:else if exercise.setType === 'MyorepMatch'}
<span></span>
{:else}
<span></span>
{/if}
Expand Down
22 changes: 12 additions & 10 deletions tests/models/workouts.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { test, expect, type Page } from '../fixtures';
import { createMesocycle } from './commonFunctions';

const todaysDateString = new Date().toLocaleDateString(undefined, { month: 'long', day: '2-digit' });
function getTodaysDateString() {
return new Date().toLocaleDateString(undefined, { month: 'long', day: '2-digit' });
}

async function createMesoForTest(page: Page) {
await page.goto('/exercise-splits');
Expand Down Expand Up @@ -32,7 +34,7 @@ test('create workout', async ({ page }) => {
await page.getByRole('button', { name: 'Next' }).click();
await page.getByRole('button', { name: 'Save' }).click();
await expect(page.getByRole('status')).toContainText('Workout created successfully');
await page.getByRole('link', { name: `${todaysDateString}` }).click();
await page.getByRole('link', { name: `${getTodaysDateString()}` }).click();
await expect(page.getByRole('tabpanel')).toContainText('Mesocycle No mesocycle User bodyweight 100');
await page.getByRole('tab', { name: 'Exercises' }).click();
await expect(page.getByRole('tabpanel')).toContainText(
Expand Down Expand Up @@ -91,7 +93,7 @@ test('create workout with all set types', async ({ page }) => {
await page.getByLabel('Sets').fill('2');
await page.locator('button').filter({ hasText: 'Straight' }).click();
await page.getByRole('option', { name: 'Drop' }).click();
await page.locator('button').filter({ hasText: 'Percentage' }).click();
await page.locator('button').filter({ hasText: 'Pick one' }).click();
await page.getByRole('option', { name: 'Absolute load' }).click();
await page.locator('#exercise-set-decrement').fill('5');
await page.getByRole('button', { name: 'Add exercise' }).click();
Expand Down Expand Up @@ -151,7 +153,7 @@ test('create workout with all set types', async ({ page }) => {
await page.getByTestId('Leg press-set-2-action').click();
await page.getByRole('button', { name: 'Next' }).click();
await page.getByRole('button', { name: 'Save' }).click();
await page.getByRole('link', { name: `${todaysDateString}` }).click();
await page.getByRole('link', { name: `${getTodaysDateString()}` }).click();
await expect(page.getByRole('tabpanel')).toContainText('Mesocycle No mesocycle User bodyweight 100');
await page.getByRole('tab', { name: 'Exercises' }).click();
await expect(page.getByRole('main')).toContainText(
Expand Down Expand Up @@ -204,7 +206,7 @@ test('create a workout with active mesocycle', async ({ page }) => {
await page.getByRole('button', { name: 'Next' }).click();
await page.getByRole('button', { name: 'Save' }).click();
await expect(page.getByRole('status')).toContainText('Workout created successfully');
await page.getByRole('link', { name: `${todaysDateString} Pull A` }).click();
await page.getByRole('link', { name: `${getTodaysDateString()} Pull A` }).click();
await expect(page.getByRole('tabpanel')).toContainText('Mesocycle MyMeso Pull A User bodyweight 100');
await page.getByRole('tab', { name: 'Exercises' }).click();
await expect(page.getByRole('tabpanel')).toContainText(
Expand Down Expand Up @@ -240,7 +242,7 @@ test('create workout without using active mesocycle', async ({ page }) => {
await page.getByRole('button', { name: 'Next' }).click();
await page.getByRole('button', { name: 'Save' }).click();
await expect(page.getByRole('status')).toContainText('Workout created successfully');
await page.getByRole('link', { name: `${todaysDateString}` }).click();
await page.getByRole('link', { name: `${getTodaysDateString()}` }).click();
await expect(page.getByRole('tabpanel')).toContainText('Mesocycle No mesocycle User bodyweight 100');
await page.getByRole('tab', { name: 'Exercises' }).click();
await expect(page.getByRole('tabpanel')).toContainText(
Expand All @@ -255,7 +257,7 @@ test('skip a workout', async ({ page }) => {
await page.getByRole('button', { name: 'Skip' }).click();
await expect(page.getByRole('status')).toContainText('Workout skipped successfully');
await page.getByRole('link', { name: 'Workouts' }).click();
await expect(page.getByRole('main')).toContainText(`${todaysDateString} Pull A (skipped)`);
await expect(page.getByRole('main')).toContainText(`${getTodaysDateString()} Pull A (skipped)`);
});

test('delete a workout', async ({ page }) => {
Expand Down Expand Up @@ -284,7 +286,7 @@ test('delete a workout', async ({ page }) => {
await page.getByLabel('create-workout').click();
await expect(page.getByRole('main')).toContainText('Push A Day 2, Cycle 1 ChestTricepsSide delts');
await page.getByRole('link', { name: 'Workouts' }).click();
await page.getByRole('link', { name: 'September 11 Pull A' }).click();
await page.getByRole('link', { name: `${getTodaysDateString()} Pull A` }).click();
await page.getByLabel('workout-options').click();
await page.getByRole('menuitem', { name: 'Delete' }).click();
await page.getByRole('button', { name: 'Yes, delete' }).click();
Expand Down Expand Up @@ -314,7 +316,7 @@ test('edit a workout', async ({ page }) => {
await page.getByRole('button', { name: 'Next' }).click();
await page.getByRole('button', { name: 'Save' }).click();

await page.getByRole('link', { name: 'September 11 Pull A' }).click();
await page.getByRole('link', { name: `${getTodaysDateString()} Pull A` }).click();
await page.getByLabel('workout-options').click();
await page.getByRole('menuitem', { name: 'Edit' }).click();
await page.getByPlaceholder('Type here').fill('95');
Expand All @@ -325,7 +327,7 @@ test('edit a workout', async ({ page }) => {
await page.getByRole('button', { name: 'Next' }).click();
await page.getByRole('button', { name: 'Save' }).click();

await page.getByRole('link', { name: 'September 11 Pull A' }).click();
await page.getByRole('link', { name: `${getTodaysDateString()} Pull A` }).click();
await expect(page.getByRole('tabpanel')).toContainText(
'Mesocycle MyMeso Pull A User bodyweight 95 Targeted muscle groups Lats'
);
Expand Down
Loading