How to use @vendure/testing - 10 common examples

To help you get started, we’ve selected a few @vendure/testing examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vendure-ecommerce / vendure / packages / core / e2e / shop-customer.e2e-spec.ts View on Github external
describe('Shop customers', () => {
    const { server, adminClient, shopClient } = createTestEnvironment(testConfig);
    let customer: GetCustomer.Customer;

    beforeAll(async () => {
        await server.init({
            dataDir: path.join(__dirname, '__data__'),
            initialData,
            productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-full.csv'),
            customerCount: 2,
        });
        await adminClient.asSuperAdmin();

        // Fetch the first Customer and store it as the `customer` variable.
        const { customers } = await adminClient.query(gql`
            query GetCustomerIds {
                customers {
                    items {
github vendure-ecommerce / vendure / packages / core / e2e / stock-control.e2e-spec.ts View on Github external
describe('Stock control', () => {
    const { server, adminClient, shopClient } = createTestEnvironment(
        mergeConfig(testConfig, {
            paymentOptions: {
                paymentMethodHandlers: [testSuccessfulPaymentMethod],
            },
        }),
    );

    beforeAll(async () => {
        await server.init({
            dataDir: path.join(__dirname, '__data__'),
            initialData,
            productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-stock-control.csv'),
            customerCount: 2,
        });
        await adminClient.asSuperAdmin();
    }, TEST_SETUP_TIMEOUT_MS);
github vendure-ecommerce / vendure / packages / core / e2e / shop-order.e2e-spec.ts View on Github external
describe('Shop orders', () => {
    const { server, adminClient, shopClient } = createTestEnvironment(
        mergeConfig(testConfig, {
            paymentOptions: {
                paymentMethodHandlers: [
                    testSuccessfulPaymentMethod,
                    testFailingPaymentMethod,
                    testErrorPaymentMethod,
                ],
            },
            orderOptions: {
                orderItemsLimit: 99,
            },
        }),
    );

    beforeAll(async () => {
        await server.init({
github vendure-ecommerce / vendure / packages / core / e2e / customer.e2e-spec.ts View on Github external
describe('Customer resolver', () => {
    const { server, adminClient, shopClient } = createTestEnvironment(
        mergeConfig(testConfig, { plugins: [TestEmailPlugin] }),
    );

    let firstCustomer: GetCustomerList.Items;
    let secondCustomer: GetCustomerList.Items;
    let thirdCustomer: GetCustomerList.Items;

    beforeAll(async () => {
        await server.init({
            dataDir: path.join(__dirname, '__data__'),
            initialData,
            productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-minimal.csv'),
            customerCount: 5,
        });
        await adminClient.asSuperAdmin();
    }, TEST_SETUP_TIMEOUT_MS);
github vendure-ecommerce / vendure / packages / core / e2e / role.e2e-spec.ts View on Github external
describe('Role resolver', () => {
    const { server, adminClient } = createTestEnvironment(testConfig);
    let createdRole: Role.Fragment;
    let defaultRoles: Role.Fragment[];

    beforeAll(async () => {
        await server.init({
            dataDir: path.join(__dirname, '__data__'),
            initialData,
            productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-minimal.csv'),
            customerCount: 1,
        });
        await adminClient.asSuperAdmin();
    }, TEST_SETUP_TIMEOUT_MS);

    afterAll(async () => {
        await server.destroy();
    });
github vendure-ecommerce / vendure / packages / core / e2e / auth.e2e-spec.ts View on Github external
describe('Authorization & permissions', () => {
    const { server, adminClient } = createTestEnvironment(testConfig);

    beforeAll(async () => {
        await server.init({
            dataDir: path.join(__dirname, '__data__'),
            initialData,
            productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-minimal.csv'),
            customerCount: 1,
        });
        await adminClient.asSuperAdmin();
    }, TEST_SETUP_TIMEOUT_MS);

    afterAll(async () => {
        await server.destroy();
    });

    describe('admin permissions', () => {
github vendure-ecommerce / vendure / packages / core / e2e / country.e2e-spec.ts View on Github external
describe('Facet resolver', () => {
    const { server, adminClient } = createTestEnvironment(testConfig);
    let countries: GetCountryList.Items[];
    let GB: GetCountryList.Items;
    let AT: GetCountryList.Items;

    beforeAll(async () => {
        await server.init({
            dataDir: path.join(__dirname, '__data__'),
            initialData,
            productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-minimal.csv'),
            customerCount: 1,
        });
        await adminClient.asSuperAdmin();
    }, TEST_SETUP_TIMEOUT_MS);

    afterAll(async () => {
        await server.destroy();
github vendure-ecommerce / vendure / packages / core / e2e / product.e2e-spec.ts View on Github external
describe('Product resolver', () => {
    const { server, adminClient, shopClient } = createTestEnvironment(testConfig);

    beforeAll(async () => {
        await server.init({
            dataDir: path.join(__dirname, '__data__'),
            initialData,
            customerCount: 1,
            productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-full.csv'),
        });
        await adminClient.asSuperAdmin();
    }, TEST_SETUP_TIMEOUT_MS);

    afterAll(async () => {
        await server.destroy();
    });

    describe('products list query', () => {
github vendure-ecommerce / vendure / packages / core / e2e / shop-catalog.e2e-spec.ts View on Github external
describe('Shop catalog', () => {
    const { server, adminClient, shopClient } = createTestEnvironment(testConfig);

    beforeAll(async () => {
        await server.init({
            dataDir: path.join(__dirname, '__data__'),
            initialData,
            productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-full.csv'),
            customerCount: 1,
        });
        await adminClient.asSuperAdmin();
    }, TEST_SETUP_TIMEOUT_MS);

    afterAll(async () => {
        await server.destroy();
    });

    describe('products', () => {
github vendure-ecommerce / vendure / packages / elasticsearch-plugin / e2e / elasticsearch-plugin.e2e-spec.ts View on Github external
describe('Elasticsearch plugin', () => {
    const { server, adminClient, shopClient } = createTestEnvironment(
        mergeConfig(testConfig, {
            plugins: [
                ElasticsearchPlugin.init({
                    indexPrefix: 'e2e-tests',
                    port: process.env.CI ? +(process.env.ELASTICSEARCH_PORT || 9200) : 9200,
                    host: process.env.CI
                        ? process.env.ELASTICSEARCH_HOST || 'elasticsearch'
                        : 'http://192.168.99.100',
                }),
            ],
        }),
    );

    beforeAll(async () => {
        await server.init({
            dataDir: path.join(__dirname, '__data__'),

@vendure/testing

End-to-end testing tools for Vendure projects

GPL-3.0-or-later
Latest version published 4 days ago

Package Health Score

89 / 100
Full package analysis

Popular @vendure/testing functions