Skip to content
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
91 changes: 91 additions & 0 deletions e2e/smoke.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,97 @@ test.describe('seeded library', () => {
}
});

test('creates and reviews a real local OCTAVE chart when requested', async () => {
test.skip(
!process.env.SIGHTKICK_AUTO_CHART_AUDIO,
'set SIGHTKICK_AUTO_CHART_AUDIO for the live OCTAVE proof',
);
test.setTimeout(180_000);

harness = await launchApp({ seedLibrary: true });
await harness.app.evaluate(({ dialog }, audioPath) => {
dialog.showOpenDialog = async () => ({
canceled: false,
filePaths: [audioPath],
});
}, process.env.SIGHTKICK_AUTO_CHART_AUDIO!);
page = await harness.app.firstWindow();

await page.getByRole('button', { name: 'Create chart' }).click();
await expect(page.getByText('Create local drum chart')).toBeVisible();

if (process.env.SIGHTKICK_AUTO_CHART_YOUTUBE_URL) {
await page
.getByTestId('auto-chart-youtube-url')
.fill(process.env.SIGHTKICK_AUTO_CHART_YOUTUBE_URL);
}

if (process.env.SIGHTKICK_AUTO_CHART_START_PROOF) {
await page.screenshot({
path: process.env.SIGHTKICK_AUTO_CHART_START_PROOF,
});
}

await page.getByRole('button', { name: 'Choose local audio' }).click();
await expect(page.getByTestId('auto-chart-progress')).toBeVisible();

const review = page.getByText('Review generated drum chart');
const failed = page.getByText('failed', { exact: true });

await expect(review.or(failed)).toBeVisible({ timeout: 150_000 });

if (await failed.isVisible()) {
throw new Error(
await page.getByTestId('auto-chart-progress').innerText(),
);
}

await expect(page.getByText('Auto-charted with STRUM')).toBeVisible();

if (process.env.SIGHTKICK_AUTO_CHART_PREVIEW_PROOF) {
await page.screenshot({
path: process.env.SIGHTKICK_AUTO_CHART_PREVIEW_PROOF,
});
}

await page.getByRole('button', { name: 'Add to library' }).click();

const generated = page.getByTestId(/song-item-/).filter({
hasText:
process.env.SIGHTKICK_AUTO_CHART_EXPECTED_NAME ?? 'raging-drop-25s',
});

await expect(generated).toBeVisible({ timeout: 30_000 });
await expect(generated.getByText('Auto-charted with STRUM')).toBeVisible();
await expect(review).toBeHidden();

if (process.env.SIGHTKICK_AUTO_CHART_AFTER_PROOF) {
await page.screenshot({
path: process.env.SIGHTKICK_AUTO_CHART_AFTER_PROOF,
});
}

await generated.click();
await page.getByRole('button', { name: 'perform' }).click();

const generatedSheet = page.locator('svg').first();

await expect(generatedSheet).toBeVisible();
await expect
.poll(async () => page.locator('svg path').count(), { timeout: 30_000 })
.toBeGreaterThan(0);
await expect(page.getByTestId('play-toggle')).not.toHaveClass(
/ant-btn-loading/,
{ timeout: 30_000 },
);

if (process.env.SIGHTKICK_AUTO_CHART_SHEET_PROOF) {
await page.screenshot({
path: process.env.SIGHTKICK_AUTO_CHART_SHEET_PROOF,
});
}
});

test('scans the folder, lists the song, and renders real sheet music', async () => {
harness = await launchApp({ seedLibrary: true });
page = await harness.app.firstWindow();
Expand Down
14 changes: 14 additions & 0 deletions src/main/AppState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ import { updateSong } from './ipc/updateSong';
import { rescanSongs } from './ipc/rescanSongs';
import { exportPdf } from './ipc/exportPdf';
import { importSong, selectImportSong } from './ipc/importSong';
import {
autoChartQueue,
cancelAutoChart,
createAutoChart,
discardAutoChartPreview,
importAutoChart,
retryAutoChart,
} from './ipc/autoChart';

class AppState {
private static instance: AppState;
Expand Down Expand Up @@ -103,6 +111,11 @@ class AppState {
ipcMain.on('download-song', downloadSong);
ipcMain.on('select-import-song', selectImportSong);
ipcMain.on('import-song', importSong);
ipcMain.on('create-auto-chart', createAutoChart);
ipcMain.on('cancel-auto-chart', cancelAutoChart);
ipcMain.on('retry-auto-chart', retryAutoChart);
ipcMain.on('discard-auto-chart-preview', discardAutoChartPreview);
ipcMain.on('import-auto-chart', importAutoChart);

ipcMain.on('check-stem-tools', checkStemTools);
ipcMain.on('check-stem-tools-update', checkStemToolsUpdate);
Expand Down Expand Up @@ -203,6 +216,7 @@ class AppState {
stopListenMidi();
killActiveSplit();
cancelStemTools();
void autoChartQueue.shutdown();
}
}

Expand Down
Loading