Files
insomnia/packages/insomnia-test/tests/git-sync/pull-remote-changes.spec.ts
T

27 lines
1.3 KiB
TypeScript

import { faker } from '@faker-js/faker';
import { ProjectType } from '@package/enums/project-types';
import { DEFAULT_TIMEOUT, GIT_CREDENTIAL, pushServerFile, test } from '@package/misc/git-fixtures';
import { buildCollectionFile } from '@package/misc/git-fixtures';
import { Collection } from '@package/models/collection';
import { Project } from '@package/models/project';
import { expect } from "@playwright/test";
test('Verify pulling brings in a collection that was pushed to the remote by another client', async ({ user }) => {
const { gitSyncFlow, preferencesFlow, workspaceFlow } = user.flowManager;
const { workspacePage } = user.pageManager;
await preferencesFlow.addGitCredential(GIT_CREDENTIAL);
await workspaceFlow.cloneGitProject(new Project(faker.string.alphanumeric(10), ProjectType.Git), GIT_CREDENTIAL.name);
const remoteCollection = new Collection(faker.string.alpha(10));
await pushServerFile({
path: `${faker.string.alpha(10).toLowerCase()}.yaml`,
content: buildCollectionFile(remoteCollection.name),
});
const nodeBeforePull = await workspacePage.findItemNode(remoteCollection);
await gitSyncFlow.pull();
expect(nodeBeforePull).toBeUndefined();
await expect.poll(async () => workspacePage.findItemNode(remoteCollection), { timeout: DEFAULT_TIMEOUT }).toBeDefined();
});