From 7417acb7b91ef2125e0459254fd443e1fb8152e4 Mon Sep 17 00:00:00 2001 From: Filipe Freire Date: Fri, 20 Jan 2023 16:04:50 +0000 Subject: [PATCH] Git Sync prerelease tests (#5705) * WIP-clone-bad-values * WIP * test * WIP-clone-bad-values * WIP * wip * Git-Sync-Test * improve a bit the locators * Update settings.json * fix role from button to menuitem Co-authored-by: kreosus --- .../prerelease/git-sync-interactions.test.ts | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 packages/insomnia-smoke-test/tests/prerelease/git-sync-interactions.test.ts diff --git a/packages/insomnia-smoke-test/tests/prerelease/git-sync-interactions.test.ts b/packages/insomnia-smoke-test/tests/prerelease/git-sync-interactions.test.ts new file mode 100644 index 0000000000..dce7ca6d8e --- /dev/null +++ b/packages/insomnia-smoke-test/tests/prerelease/git-sync-interactions.test.ts @@ -0,0 +1,56 @@ +import { expect } from '@playwright/test'; + +import { test } from '../../playwright/test'; + +test('Clone Repo with bad values', async ({ page }) => { + await page.click('[data-testid="project"] >> text=Insomnia'); + 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('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.getByRole('button', { name: 'main' }).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: 'initial commit' }).click(); + await page.locator('text=Done').click(); + + // Create a branch and try to push with bad Git token + await page.getByRole('button', { name: 'main' }).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