Skip to content

Commit

Permalink
remove old unused test
Browse files Browse the repository at this point in the history
  • Loading branch information
jackkav committed Jun 12, 2024
1 parent f02a98a commit 046ef84
Showing 1 changed file with 0 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,80 +144,5 @@ test.describe('Debug-Sidebar', async () => {
await page.getByRole('menuitemradio', { name: 'Http Request' }).click();
await page.getByLabel('Request Collection').getByRole('row', { name: 'New Request' }).click();
});

test('Add new string variable via environment overrides', async ({ page }) => {
// Create new Folder
await page.getByLabel('Create in collection').click();
await page.getByLabel('New Folder').click();
await page.locator('#prompt-input').fill('New Folder');
await page.getByText('New Folder').press('Enter');

// Open 'New folder' folder
const folderLocator = page.getByTestId('Dropdown-New-Folder');
const environmentLocator = page.getByRole('menuitemradio', { name: 'Environment' });
await folderLocator.click();
await environmentLocator.click();

// Add a new string environment variable
const expected = '{ "foo":"bar" }';
const editorTextLocator = await page.getByTestId('CodeEditor').getByRole('textbox');
const selectAllShortcut = process.platform === 'darwin' ? 'Meta+A' : 'Control+A';
await editorTextLocator.press(selectAllShortcut);
await editorTextLocator.fill(expected);

// Close and re-open modal
await page.getByText('Close').click();
await folderLocator.click();
await environmentLocator.click();

// Validate expected values persisted
const actualRows = await page.getByTestId('CodeEditor').locator('.CodeMirror-line').allInnerTexts();
expect(actualRows.length).toBeGreaterThan(0);

const actualJSON = JSON.parse(actualRows.join(' '));
expect(actualJSON).toEqual(JSON.parse(expected));
});

test('Add new string variable to an existing environment overrides folder', async ({ page }) => {
// Open 'Test Folder' folder
const folderLocator = page.getByTestId('Dropdown-test-folder');
const environmentLocator = page.getByRole('menuitemradio', { name: 'Environment' });
await folderLocator.click();
await environmentLocator.click();

// Add a new string environment variable to existing overrides

// 1. Retrieve current editor rows
const editorLocator = page.getByTestId('CodeEditor').locator('.CodeMirror-line');
const rows = await editorLocator.allInnerTexts();

// 2. Merge rows and convert to JSON
const editorJSON = JSON.parse(rows.join(' '));

// 3. Modify JSON with new string environment variable
editorJSON.REQUEST = 'HTTP';
const expected = editorJSON;

// 4. Apply new JSON to editor
const editorTextLocator = await page.getByTestId('CodeEditor').getByRole('textbox');
const selectAllShortcut = process.platform === 'darwin' ? 'Meta+A' : 'Control+A';
await editorTextLocator.press(selectAllShortcut);
await editorTextLocator.fill(JSON.stringify(expected));

// Close and re-open Modal
await page.getByText('Close').click();
await folderLocator.click();
await environmentLocator.click();

// Validate expected values persisted
const actualRows = await editorLocator.allInnerTexts();
expect(actualRows.length).toBeGreaterThan(0);

const actualJSON = JSON.parse(actualRows.join(' '));
expect(actualJSON).toEqual(expected);

});

// TODO: more scenarios will be added in follow-up iterations of increasing test coverage
});
});

0 comments on commit 046ef84

Please sign in to comment.