-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: multiple tab #8304
Open
CurryYangxx
wants to merge
2
commits into
feat/multiple-tab
Choose a base branch
from
test/multiple-tab
base: feat/multiple-tab
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
test: multiple tab #8304
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
88 changes: 88 additions & 0 deletions
88
packages/insomnia-smoke-test/tests/smoke/insomnia-tab.test.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,88 @@ | ||
import { expect } from '@playwright/test'; | ||
|
||
import { test } from '../../playwright/test'; | ||
|
||
const DEFAULT_REQUEST_NAME = 'New Request'; | ||
|
||
test.describe('multiple-tab feature test', () => { | ||
test.slow(process.platform === 'darwin' || process.platform === 'win32', 'Slow app start on these platforms'); | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await page.getByLabel('Create in project').click(); | ||
await page.getByLabel('Request collection', { exact: true }).click(); | ||
await page.getByRole('button', { name: 'Create', exact: true }).click(); | ||
}); | ||
|
||
test('add tab & close tab', async ({ page }) => { | ||
await page.getByLabel('Create in collection').click(); | ||
await page.getByLabel('HTTP Request').click(); | ||
const tab = await page.getByLabel('Insomnia Tabs').getByLabel(`tab-${DEFAULT_REQUEST_NAME}`, { exact: true }); | ||
expect(tab).toBeVisible(); | ||
expect(await tab.getAttribute('data-selected')).toBe('true'); | ||
await tab.getByRole('button').click(); | ||
await expect(tab).toBeHidden(); | ||
}); | ||
|
||
test('active tab sync with the sidebar active request', async ({ page }) => { | ||
await page.getByLabel('Create in collection').click(); | ||
await page.getByLabel('HTTP Request').click(); | ||
await page.getByTestId('New Request').dblclick(); | ||
await page.getByRole('textbox', { name: 'GET New Request' }).fill('New Request A'); | ||
await page.getByLabel('Create in collection').click(); | ||
await page.getByLabel('HTTP Request').click(); | ||
await page.getByTestId('New Request').dblclick(); | ||
await page.getByRole('textbox', { name: 'GET New Request' }).fill('New Request B'); | ||
await page.getByTestId('New Request A').click(); | ||
await page.waitForTimeout(1000); | ||
const tabA = await page.getByLabel('Insomnia Tabs').getByLabel('tab-New Request A', { exact: true }); | ||
expect(await tabA.getAttribute('data-selected')).toBe('true'); | ||
await page.getByTestId('New Request B').click(); | ||
await page.waitForTimeout(1000); | ||
const tabB = await page.getByLabel('Insomnia Tabs').getByLabel('tab-New Request B', { exact: true }); | ||
expect(await tabB.getAttribute('data-selected')).toBe('true'); | ||
}); | ||
|
||
test('close tab after delete a request', async ({ page }) => { | ||
await page.getByLabel('Create in collection').click(); | ||
await page.getByLabel('HTTP Request').click(); | ||
const tab = await page.getByLabel('Insomnia Tabs').getByLabel(`tab-${DEFAULT_REQUEST_NAME}`, { exact: true }); | ||
expect(tab).toBeVisible(); | ||
await page.getByTestId('Dropdown-New-Request').click(); | ||
await page.getByLabel('Delete').click(); | ||
await page.getByRole('button', { name: 'Delete', exact: true }).click(); | ||
await expect(tab).toBeHidden(); | ||
}); | ||
|
||
test('change icon after change request method', async ({ page }) => { | ||
await page.getByLabel('Create in collection').click(); | ||
await page.getByLabel('HTTP Request').click(); | ||
await page.waitForTimeout(1000); | ||
expect(await page.getByLabel('Insomnia Tabs').getByLabel('Tab Tag').innerText()).toEqual('GET'); | ||
await page.getByLabel('Request Method').click(); | ||
await page.getByRole('button', { name: 'POST' }).click(); | ||
await page.waitForTimeout(1000); | ||
expect(await page.getByLabel('Insomnia Tabs').getByLabel('Tab Tag').innerText()).toEqual('POST'); | ||
}); | ||
|
||
test('click + button to add a new request', async ({ page }) => { | ||
await page.getByLabel('Tab Plus').click(); | ||
await page.getByRole('menuitem', { name: 'add request to current' }).click(); | ||
await page.getByTestId(DEFAULT_REQUEST_NAME).click(); | ||
await page.getByTestId(DEFAULT_REQUEST_NAME).dblclick(); | ||
await page.getByRole('textbox', { name: 'GET New Request' }).fill('New Request A'); | ||
await page.getByTestId('project').click(); | ||
await page.getByLabel('Create in project').click(); | ||
await page.getByLabel('Request collection', { exact: true }).click(); | ||
await page.getByPlaceholder('My Collection').fill('Test add tab collection'); | ||
await page.getByRole('button', { name: 'Create', exact: true }).click(); | ||
await page.waitForTimeout(1000); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
await page.getByLabel('Tab Plus').click(); | ||
await page.getByRole('menuitem', { name: 'add request to other' }).click(); | ||
await page.getByLabel('Select Workspace').selectOption({ label: 'My Collection' }); | ||
await page.getByRole('dialog').getByRole('button', { name: 'Add' }).click(); | ||
await page.waitForTimeout(1000); | ||
expect(await page.getByTestId('workspace-context-dropdown').innerText()).toEqual('My Collection'); | ||
await page.getByTestId(DEFAULT_REQUEST_NAME).click(); | ||
}); | ||
|
||
}); |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
waits are a test smell and should always be avoided at al costs as they do not scale.
They also often also indicated an underlying issue. Its worth getting to the bottom of whats happening to cause your action to to result in an immediate change to the ui you're interested in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be remedied by dealing with the refs, ideally the test would also be scoped into the first PR, so its cool to merge this one in sooner rather than later