mirror of
https://github.com/Kong/insomnia
synced 2024-11-07 22:30:15 +00:00
chore: add smoke test for git-sync [INS-4132] (#7682)
* chore: add prerelease test for git-sync [INS-4132] * Update git-sync.test.ts * mv to smoke
This commit is contained in:
parent
03581544cf
commit
39a2f375c8
@ -0,0 +1,72 @@
|
||||
import { test } from '../../playwright/test';
|
||||
|
||||
test('Git Interactions (clone, checkout branch, pull, push, stage changes, ...)', async ({ page }) => {
|
||||
// git clone
|
||||
await page.waitForSelector('[data-test-git-enable="true"]');
|
||||
await page.getByLabel('Clone git repository').click();
|
||||
await page.getByRole('tab', { name: ' Git' }).click();
|
||||
await page.getByPlaceholder('https://github.com/org/repo.git').fill('https://github.com/Kong/insomnia-git-example.git');
|
||||
await page.getByPlaceholder('Name').fill('J');
|
||||
await page.getByPlaceholder('Email').fill('J');
|
||||
await page.getByPlaceholder('MyUser').fill('J');
|
||||
await page.getByPlaceholder('88e7ee63b254e4b0bf047559eafe86ba9dd49507').fill('J');
|
||||
await page.getByTestId('git-repository-settings-modal__sync-btn').click();
|
||||
await page.getByLabel('Toggle preview').click();
|
||||
|
||||
// switch branches
|
||||
await page.getByTestId('git-dropdown').getByLabel('Git Sync').click();
|
||||
await page.getByRole('button', { name: ' Branches' }).click();
|
||||
await page.getByRole('cell', { name: 'main(current)' }).click();
|
||||
await page.getByRole('cell', { name: 'abc' }).click();
|
||||
await page.getByRole('row', { name: 'abc Checkout' }).getByRole('button').click();
|
||||
await page.getByRole('cell', { name: 'abc(current)' }).click();
|
||||
await page.getByRole('button', { name: 'Done' }).click();
|
||||
|
||||
// perform some changes and commit them
|
||||
await page.locator('pre').filter({ hasText: 'title: Endpoint Security' }).click();
|
||||
await page.getByRole('textbox').fill(' test');
|
||||
await page.getByTestId('git-dropdown').getByLabel('Git Sync').click();
|
||||
await page.getByRole('button', { name: ' Commit' }).click();
|
||||
await page.getByText('Modified Objects').click();
|
||||
await page.getByText('ApiSpec').click();
|
||||
await page.getByPlaceholder('A descriptive message to').click();
|
||||
await page.getByPlaceholder('A descriptive message to').fill('example commit message');
|
||||
await page.getByRole('dialog').getByText('abc').click();
|
||||
await page.getByRole('button', { name: ' Commit' }).click();
|
||||
await page.getByText('No changes to commit.').click();
|
||||
await page.getByRole('button', { name: 'Close' }).click();
|
||||
|
||||
// push changes
|
||||
// await page.getByTestId('git-dropdown').getByLabel('Git Sync').click();
|
||||
// await page.getByRole('button', { name: ' Push' }).click();
|
||||
// await page.getByText('HTTP Error: 401 Unauthorized').click();
|
||||
// await page.getByRole('button', { name: '' }).click();
|
||||
|
||||
// switch back to main branch, which should not have said changes
|
||||
await page.getByTestId('git-dropdown').getByLabel('Git Sync').click();
|
||||
await page.getByRole('button', { name: 'main' }).click();
|
||||
await page.getByTestId('git-dropdown').getByLabel('Git Sync').click();
|
||||
await page.getByRole('button', { name: ' Branches' }).click();
|
||||
await page.getByRole('cell', { name: 'main(current)' }).click();
|
||||
await page.getByRole('button', { name: 'Done' }).click();
|
||||
await page.getByTestId('CodeEditor').getByText('Endpoint Security').click();
|
||||
|
||||
// switch to the branch with the changes and check if they are there
|
||||
await page.getByTestId('git-dropdown').getByLabel('Git Sync').click();
|
||||
await page.getByRole('button', { name: 'abc' }).click();
|
||||
await page.getByTestId('git-dropdown').getByLabel('Git Sync').click();
|
||||
await page.getByRole('button', { name: ' Branches' }).click();
|
||||
await page.getByRole('cell', { name: 'abc(current)' }).click();
|
||||
await page.getByRole('button', { name: 'Done' }).click();
|
||||
await page.getByText('Endpoint Security test').click();
|
||||
|
||||
// check git history
|
||||
await page.getByTestId('git-dropdown').getByLabel('Git Sync').click();
|
||||
await page.getByRole('button', { name: ' Fetch' }).click();
|
||||
await page.getByTestId('git-dropdown').getByLabel('Git Sync').click();
|
||||
await page.getByRole('button', { name: ' History' }).click();
|
||||
await page.getByRole('cell', { name: 'example commit message' }).click();
|
||||
await page.getByRole('cell', { name: 'just now' }).click();
|
||||
await page.getByRole('cell', { name: 'J', exact: true }).click();
|
||||
|
||||
});
|
@ -1,81 +0,0 @@
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { test } from '../../playwright/test';
|
||||
|
||||
// TODO: Fix git branching and dropdown flakes
|
||||
test.fixme('Clone Repo with bad values @failing', async ({ page }) => {
|
||||
await page.getByRole('button', { name: 'Create' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Git Clone' }).click();
|
||||
await page.getByRole('tab', { name: 'Git' }).nth(2).click();
|
||||
|
||||
// Fill in Git Sync details and clone repository
|
||||
await page.getByText('Git URI (https)').fill('https://github.com/kong/dino-park-insomnia');
|
||||
await page.getByText('Author Name').fill('test');
|
||||
await page.getByText('Author Email').fill('test');
|
||||
await page.getByText('Username').fill('test');
|
||||
await page.getByText('Authentication Token').fill('test');
|
||||
await page.getByRole('dialog').getByRole('button', { name: 'Clone' }).click();
|
||||
|
||||
// Basic check repository data is loaded
|
||||
// Design doc
|
||||
await page.getByText('"Our Dino Park API"').click();
|
||||
await page.getByRole('link', { name: 'Debug' }).click();
|
||||
// Requests
|
||||
await page.getByRole('button', { name: 'POST Turn on/off the electricity of the fences' }).click();
|
||||
// Environments
|
||||
await page.getByRole('button', { name: 'No Environment' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Use Via Kong GW' }).click();
|
||||
// Tests
|
||||
await page.getByRole('link', { name: 'Test' }).click();
|
||||
await page.getByRole('heading', { name: 'Check status' }).click();
|
||||
|
||||
// Check branch history
|
||||
await page.getByTestId('git-dropdown').locator('button').click();
|
||||
await page.getByRole('menuitem', { name: 'History' }).click();
|
||||
await page.locator('text=Git History').click();
|
||||
|
||||
// Check a recent and old commit show up on history
|
||||
await page.getByRole('cell', { name: 'bump to OpenAPI v3.1' }).click();
|
||||
await page.getByRole('cell', { name: 'Fix environments' }).click();
|
||||
await page.locator('text=Done').click();
|
||||
|
||||
// Create a branch and try to push with bad Git token
|
||||
await page.getByTestId('git-dropdown').locator('button').click();
|
||||
await page.getByRole('menuitem', { name: 'Branches' }).click();
|
||||
await page.getByPlaceholder('testing-branch').fill('test123');
|
||||
await page.getByRole('button', { name: '+ Create' }).click();
|
||||
await page.getByRole('cell', { name: 'test123(current)' }).click();
|
||||
await page.getByRole('button', { name: 'Done' }).click();
|
||||
await page.getByRole('button', { name: 'test123' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Push' }).click();
|
||||
await expect(page.locator('.app')).toContainText('Error Pushing Repository');
|
||||
});
|
||||
|
||||
test.fixme('Clone Gitlab Repo with bad values', async ({ page }) => {
|
||||
await page.getByRole('button', { name: 'Create in project' }).click();
|
||||
await page.getByRole('menuitemradio', { name: 'Git Clone' }).click();
|
||||
await page.getByRole('tab', { name: 'Git' }).nth(2).click();
|
||||
|
||||
// Fill in Git Sync details and clone repository
|
||||
await page.getByText('Git URI (https)').fill('https://gitlab.com/gitlab-examples/gitlab-examples.gitlab.io.git');
|
||||
await page.getByText('Author Name').fill('test');
|
||||
await page.getByText('Author Email').fill('test');
|
||||
await page.getByText('Username').fill('test');
|
||||
await page.getByText('Authentication Token').fill('test');
|
||||
await page.getByRole('dialog').getByRole('button', { name: 'Clone' }).click();
|
||||
|
||||
// Create a branch and try to push with bad Git token
|
||||
await page.getByRole('button', { name: 'master' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Branches' }).click();
|
||||
await page.getByPlaceholder('testing-branch').fill('test123');
|
||||
await page.getByRole('button', { name: '+ Create' }).click();
|
||||
await page.getByRole('cell', { name: 'test123(current)' }).click();
|
||||
await page.getByRole('button', { name: 'Done' }).click();
|
||||
await page.getByRole('button', { name: 'test123' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Push' }).click();
|
||||
await expect(page.locator('.app')).toContainText('Error Pushing Repository');
|
||||
});
|
||||
|
||||
// TODO(kreosus): more git sync prerelease tests will be added when gh auth secrets are properly setup for CI use
|
||||
|
||||
// TODO(kreosus): more preferences scenarios will be added in the followup iterations of increasing app test coverage
|
@ -1,10 +1,11 @@
|
||||
import { test } from '../../playwright/test';
|
||||
|
||||
test('Clone from github', async ({ page }) => {
|
||||
// waitting for the /features api request to finish
|
||||
await page.waitForSelector('[data-test-git-enable="true"]');
|
||||
await page.getByLabel('Clone git repository').click();
|
||||
await page.getByRole('tab', { name: ' Git' }).click();
|
||||
await page.getByPlaceholder('https://github.com/org/repo.git').fill('https://github.com/jackkav/insomnia-git-example.git');
|
||||
await page.getByPlaceholder('https://github.com/org/repo.git').fill('https://github.com/Kong/insomnia-git-example.git');
|
||||
await page.getByPlaceholder('Name').fill('J');
|
||||
await page.getByPlaceholder('Email').fill('J');
|
||||
await page.getByPlaceholder('MyUser').fill('J');
|
||||
@ -12,6 +13,7 @@ test('Clone from github', async ({ page }) => {
|
||||
await page.getByTestId('git-repository-settings-modal__sync-btn').click();
|
||||
await page.getByLabel('Toggle preview').click();
|
||||
});
|
||||
|
||||
test('Sign in with GitHub', async ({ app, page }) => {
|
||||
await page.getByRole('button', { name: 'New Document' }).click();
|
||||
await page.getByRole('dialog').getByRole('button', { name: 'Create' }).click();
|
||||
|
Loading…
Reference in New Issue
Block a user