0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00
verdaccio/e2e/ui/cypress.config.ts
Juan Picado 0481b9a329
feat: upgrade react 18 (#3495)
* chore: update react 18

* Create four-ways-try.md

* Update signin.cy.ts

* chore: new ci

* Update e2e-ui.yml

* Update e2e-ui.yml

* ci

* ci

* ci

* Update e2e-ui.yml

* Update e2e-ui.yml

* chore: fix ui test

* Update publish.cy.ts

* chore: update tests

* add strict mode
2022-11-12 22:05:08 +01:00

60 lines
2 KiB
TypeScript

import { defineConfig } from 'cypress';
import { join } from 'path';
import { Registry, ServerQuery } from 'verdaccio';
import { parseConfigFile } from '@verdaccio/config';
import { HEADERS, fileUtils } from '@verdaccio/core';
import { generatePackageMetadata } from '@verdaccio/test-helper';
let registry1;
export default defineConfig({
e2e: {
setupNodeEvents(on) {
on('before:run', async () => {
const configProtected = parseConfigFile(join(__dirname, './config/config.yaml'));
const registry1storage = await fileUtils.createTempStorageFolder('storage-1');
const protectedRegistry = await Registry.fromConfigToPath({
...configProtected,
storage: registry1storage,
});
registry1 = new Registry(protectedRegistry.configPath, {
createUser: true,
credentials: { user: 'test', password: 'test' },
});
await registry1.init();
});
on('after:run', async () => {
registry1.stop();
});
on('task', {
publishScoped({ pkgName }) {
const scopedPackageMetadata = generatePackageMetadata(pkgName, '1.0.6');
const server = new ServerQuery(registry1.getRegistryUrl());
server
.putPackage(scopedPackageMetadata.name, scopedPackageMetadata, {
[HEADERS.AUTHORIZATION]: `Bearer ${registry1.getToken()}`,
})
.then(() => {});
return null;
},
publishProtected({ pkgName }) {
const protectedPackageMetadata = generatePackageMetadata(pkgName, '5.0.5');
const server = new ServerQuery(registry1.getRegistryUrl());
server
.putPackage(protectedPackageMetadata.name, protectedPackageMetadata, {
[HEADERS.AUTHORIZATION]: `Bearer ${registry1.getToken()}`,
})
.then(() => {});
},
registry() {
return {
registryUrl: registry1.getRegistryUrl(),
port: registry1.getPort(),
};
},
});
},
},
});