-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #107 from formkiq/formkiq/v3.2.3
v3.2.3 - bug fixes (folder encoding, info pane scroll, no empty documents message before load is complete) - adds copy id to document id on info pane - adds API Key config
- Loading branch information
Showing
26 changed files
with
2,095 additions
and
411 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
formkiq/apps/formkiq-document-console-react-e2e/src/page-objects/ApiKeysPage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import { Locator, Page } from '@playwright/test'; | ||
|
||
export class ApiKeysPage { | ||
readonly page: Page; | ||
readonly navigateLink: Locator; | ||
readonly integrationDropdown: Locator; | ||
readonly createButton: Locator; | ||
readonly newModal: NewApiKeyModalObject; | ||
readonly deleteModal: DeleteApiKeyModalObject; | ||
|
||
constructor(page: Page) { | ||
this.page = page; | ||
this.integrationDropdown = page.getByTestId('expand-integrations'); | ||
this.navigateLink = page.getByTestId('nav-api-keys'); | ||
this.createButton = page.getByTestId('create-api-key').first(); | ||
this.newModal = new NewWebhookModalObject(page); | ||
this.deleteModal = new DeleteWebhookModalObject(page); | ||
} | ||
|
||
async openPage() { | ||
await this.integrationDropdown.click(); | ||
await this.navigateLink.click(); | ||
} | ||
|
||
async openNewModal() { | ||
await this.createButton.click(); | ||
} | ||
|
||
async openDeleteModal(name: string) { | ||
await this.page | ||
.getByTestId(`api-key-${name}`) | ||
.getByTestId('delete-api-key') | ||
.click(); | ||
} | ||
} | ||
|
||
class DeleteApiKeyModalObject { | ||
readonly page: Page; | ||
readonly ok: Locator; | ||
readonly cancel: Locator; | ||
readonly body: Locator; | ||
|
||
constructor(page: Page) { | ||
this.page = page; | ||
this.ok = page.getByTestId('global-modal-ok'); | ||
this.cancel = page.getByTestId('global-modal-cancel'); | ||
this.body = page.getByTestId('global-confirm-body'); | ||
} | ||
|
||
async cancelDeletion() { | ||
await this.cancel.click(); | ||
} | ||
|
||
async confirmDeletion() { | ||
await this.ok.click(); | ||
} | ||
} | ||
|
||
class NewApiKeyModalObject { | ||
readonly page: Page; | ||
readonly confirm: Locator; | ||
readonly close: Locator; | ||
readonly cancel: Locator; | ||
readonly nameInput: Locator; | ||
readonly body: Locator; | ||
|
||
constructor(page: Page) { | ||
this.page = page; | ||
this.confirm = page.getByTestId('confirm-api-key-creation'); | ||
this.close = page.getByTestId('close-api-key-creation'); | ||
this.cancel = page.getByTestId('cancel-api-key-creation'); | ||
this.nameInput = page.getByTestId('api-key-name-input'); | ||
this.body = page.getByTestId('api-key-creation-modal'); | ||
} | ||
|
||
async enterName(name: string) { | ||
await this.nameInput.type(name); | ||
} | ||
|
||
async cancelCreation() { | ||
await this.cancel.click(); | ||
} | ||
|
||
async closeModal() { | ||
await this.close.click(); | ||
} | ||
|
||
async confirmCreation() { | ||
await this.confirm.click(); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
formkiq/apps/formkiq-document-console-react-e2e/src/specs/api-keys.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { expect } from '@playwright/test'; | ||
import { test } from '../fixtures'; | ||
|
||
test.beforeEach(async ({ LoginPage }) => { | ||
await LoginPage.login(); | ||
}); | ||
|
||
test('can navigate to the api keys page', async ({ page, ApiKeys }) => { | ||
await ApiKeys.openPage(); | ||
|
||
await page.waitForURL('/integrations/apiKeys'); | ||
}); | ||
|
||
test('can add and delete a new api key', async ({ page, ApiKeys }) => { | ||
await ApiKeys.openPage(); | ||
|
||
const apiKey = page.getByTestId(`api-key-my-new-api-key`); | ||
|
||
await ApiKeys.openNewModal(); | ||
await ApiKeys.newModal.enterName('my-new-api-key'); | ||
await ApiKeys.newModal.confirmCreation(); | ||
|
||
await expect(apiKey).toBeVisible(); | ||
|
||
await ApiKeys.openDeleteModal('my-new-api-key'); | ||
await ApiKeys.deleteModal.confirmDeletion(); | ||
|
||
await expect(apiKey).not.toBeVisible(); | ||
|
||
await page.waitForTimeout(1000); //brief pause before the end of the test to ensure deletion action resolves | ||
}); | ||
|
||
test('can cancel out of creating an api key', async ({ ApiKeys }) => { | ||
await ApiKeys.openPage(); | ||
|
||
await ApiKeys.openNewModal(); | ||
await ApiKeys.newModal.enterName('my-new-api-key'); | ||
await ApiKeys.newModal.cancelCreation(); | ||
|
||
await expect(ApiKeys.newModal.body).not.toBeVisible(); | ||
|
||
await ApiKeys.openNewModal(); | ||
await ApiKeys.newModal.enterName('my-new-api-key'); | ||
await ApiKeys.newModal.closeModal(); | ||
|
||
await expect(ApiKeys.newModal.body).not.toBeVisible(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
formkiq/apps/formkiq-document-console-react/src/app/Components/Generic/CopyButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { Tooltip } from 'react-tooltip'; | ||
import { CopyIcon } from '../Icons/icons'; | ||
import { useState } from 'react'; | ||
|
||
export type CopyButtonProps = { | ||
value: string; | ||
id?: string; | ||
}; | ||
|
||
export const CopyButton = (props: CopyButtonProps) => { | ||
const [text, setText] = useState('Copy'); | ||
|
||
const { value, id } = props; | ||
return ( | ||
<> | ||
<Tooltip id={id ?? 'copy-tooltip'} /> | ||
<button | ||
data-tooltip-id={id ?? 'copy-tooltip'} | ||
data-tooltip-content={text} | ||
onClick={() => { | ||
window.navigator.clipboard.writeText(value); | ||
setText('Copied!'); | ||
|
||
setTimeout(() => { | ||
setText('Copy'); | ||
}, 2000); | ||
}} | ||
> | ||
<CopyIcon /> | ||
</button> | ||
</> | ||
); | ||
}; |
Oops, something went wrong.