mirror of
https://github.com/usebruno/bruno.git
synced 2026-07-01 00:24:08 +00:00
fix: autosave playwright test (#7641)
* fix: autosave playwright test * fix
This commit is contained in:
@@ -11,6 +11,8 @@ import {
|
||||
} from '../utils/page';
|
||||
import { buildCommonLocators } from '../utils/page/locators';
|
||||
|
||||
const saveShortcut = process.platform === 'darwin' ? 'Meta+s' : 'Control+s';
|
||||
|
||||
test.describe('Variable Tooltip', () => {
|
||||
test.afterEach(async ({ page }) => {
|
||||
if (!page.isClosed()) {
|
||||
@@ -44,7 +46,7 @@ test.describe('Variable Tooltip', () => {
|
||||
const urlEditor = page.locator('#request-url .CodeMirror');
|
||||
await urlEditor.click();
|
||||
await page.keyboard.type('https://api.example.com?key={{apiKey}}');
|
||||
await page.keyboard.press('Control+s');
|
||||
await page.keyboard.press(saveShortcut);
|
||||
});
|
||||
|
||||
await test.step('Test basic tooltip', async () => {
|
||||
@@ -76,7 +78,7 @@ test.describe('Variable Tooltip', () => {
|
||||
const headerValueEditor = headerRow.locator('.CodeMirror').nth(1);
|
||||
await headerValueEditor.click();
|
||||
await page.keyboard.type('Bearer {{secretToken}}');
|
||||
await page.keyboard.press('Control+s');
|
||||
await page.keyboard.press(saveShortcut);
|
||||
|
||||
// Test tooltip with secret
|
||||
const secretVar = headerValueEditor.locator('.cm-variable-valid').filter({ hasText: 'secretToken' }).first();
|
||||
@@ -132,7 +134,7 @@ test.describe('Variable Tooltip', () => {
|
||||
const urlEditor = page.locator('#request-url .CodeMirror');
|
||||
await urlEditor.click();
|
||||
await page.keyboard.type('{{endpoint}}');
|
||||
await page.keyboard.press('Control+s');
|
||||
await page.keyboard.press(saveShortcut);
|
||||
});
|
||||
|
||||
await test.step('Test variable referencing other variables', async () => {
|
||||
@@ -243,7 +245,7 @@ test.describe('Variable Tooltip', () => {
|
||||
const urlEditor = locators.request.urlInput();
|
||||
await urlEditor.click();
|
||||
await page.keyboard.type('https://example.com');
|
||||
await page.keyboard.press('Control+s');
|
||||
await page.keyboard.press(saveShortcut);
|
||||
});
|
||||
|
||||
await test.step('Test process.env variable tooltip', async () => {
|
||||
@@ -255,7 +257,7 @@ test.describe('Variable Tooltip', () => {
|
||||
await urlEditor.click();
|
||||
await page.keyboard.press('End');
|
||||
await page.keyboard.type('?env={{process.env.HOME}}');
|
||||
await page.keyboard.press('Control+s');
|
||||
await page.keyboard.press(saveShortcut);
|
||||
|
||||
// Hover over process.env variable
|
||||
const processEnvVar = urlEditor.locator('.cm-variable-valid, .cm-variable-invalid').filter({ hasText: 'process.env.HOME' }).first();
|
||||
@@ -289,7 +291,7 @@ test.describe('Variable Tooltip', () => {
|
||||
const urlEditor = page.locator('#request-url .CodeMirror');
|
||||
await urlEditor.click();
|
||||
await page.keyboard.type('https://api.example.com');
|
||||
await page.keyboard.press('Control+s');
|
||||
await page.keyboard.press(saveShortcut);
|
||||
});
|
||||
|
||||
await test.step('Edit URL to create draft with undefined variable', async () => {
|
||||
@@ -397,7 +399,7 @@ test.describe('Variable Tooltip', () => {
|
||||
const urlEditor = page.locator('#request-url .CodeMirror');
|
||||
await urlEditor.click();
|
||||
await page.keyboard.type('https://api.example.com');
|
||||
await page.keyboard.press('Control+s');
|
||||
await page.keyboard.press(saveShortcut);
|
||||
});
|
||||
|
||||
await test.step('Test invalid variable name with space', async () => {
|
||||
@@ -414,7 +416,7 @@ test.describe('Variable Tooltip', () => {
|
||||
const cm = el.CodeMirror;
|
||||
cm.setValue('{\n "userId": "{{user id}}"\n}');
|
||||
});
|
||||
await page.keyboard.press('Control+s');
|
||||
await page.keyboard.press(saveShortcut);
|
||||
|
||||
// Hover over the invalid variable
|
||||
await page.mouse.move(0, 0);
|
||||
|
||||
Reference in New Issue
Block a user