refactor: e2e (#7703)

* refactor: e2e

* fix: submodule check

* chore: extend startup timeout
This commit is contained in:
Jason Rasmussen
2024-03-07 10:14:36 -05:00
committed by GitHub
parent 2dcd0e516f
commit b733a29430
25 changed files with 332 additions and 395 deletions

View File

@@ -1,14 +1,10 @@
import { stat } from 'node:fs/promises';
import { apiUtils, app, dbUtils, immichCli } from 'src/utils';
import { beforeAll, beforeEach, describe, expect, it } from 'vitest';
import { app, immichCli, utils } from 'src/utils';
import { beforeEach, describe, expect, it } from 'vitest';
describe(`immich login-key`, () => {
beforeAll(() => {
apiUtils.setup();
});
beforeEach(async () => {
await dbUtils.reset();
await utils.resetDatabase();
});
it('should require a url', async () => {
@@ -30,8 +26,8 @@ describe(`immich login-key`, () => {
});
it('should login and save auth.yml with 600', async () => {
const admin = await apiUtils.adminSetup();
const key = await apiUtils.createApiKey(admin.accessToken);
const admin = await utils.adminSetup();
const key = await utils.createApiKey(admin.accessToken);
const { stdout, stderr, exitCode } = await immichCli(['login-key', app, `${key.secret}`]);
expect(stdout.split('\n')).toEqual([
'Logging in to http://127.0.0.1:2283/api',
@@ -47,8 +43,8 @@ describe(`immich login-key`, () => {
});
it('should login without /api in the url', async () => {
const admin = await apiUtils.adminSetup();
const key = await apiUtils.createApiKey(admin.accessToken);
const admin = await utils.adminSetup();
const key = await utils.createApiKey(admin.accessToken);
const { stdout, stderr, exitCode } = await immichCli(['login-key', app.replaceAll('/api', ''), `${key.secret}`]);
expect(stdout.split('\n')).toEqual([
'Logging in to http://127.0.0.1:2283',

View File

@@ -1,11 +1,10 @@
import { apiUtils, cliUtils, dbUtils, immichCli } from 'src/utils';
import { immichCli, utils } from 'src/utils';
import { beforeAll, describe, expect, it } from 'vitest';
describe(`immich server-info`, () => {
beforeAll(async () => {
apiUtils.setup();
await dbUtils.reset();
await cliUtils.login();
await utils.resetDatabase();
await utils.cliLogin();
});
it('should return the server info', async () => {

View File

@@ -1,19 +1,18 @@
import { getAllAlbums, getAllAssets } from '@immich/sdk';
import { mkdir, readdir, rm, symlink } from 'node:fs/promises';
import { apiUtils, asKeyAuth, cliUtils, dbUtils, immichCli, testAssetDir } from 'src/utils';
import { asKeyAuth, immichCli, testAssetDir, utils } from 'src/utils';
import { beforeAll, beforeEach, describe, expect, it } from 'vitest';
describe(`immich upload`, () => {
let key: string;
beforeAll(async () => {
apiUtils.setup();
await dbUtils.reset();
key = await cliUtils.login();
await utils.resetDatabase();
key = await utils.cliLogin();
});
beforeEach(async () => {
await dbUtils.reset(['assets', 'albums']);
await utils.resetDatabase(['assets', 'albums']);
});
describe('immich upload --recursive', () => {

View File

@@ -1,14 +1,10 @@
import { readFileSync } from 'node:fs';
import { apiUtils, immichCli } from 'src/utils';
import { beforeAll, describe, expect, it } from 'vitest';
import { immichCli } from 'src/utils';
import { describe, expect, it } from 'vitest';
const pkg = JSON.parse(readFileSync('../cli/package.json', 'utf8'));
describe(`immich --version`, () => {
beforeAll(() => {
apiUtils.setup();
});
describe('immich --version', () => {
it('should print the cli version', async () => {
const { stdout, stderr, exitCode } = await immichCli(['--version']);