fix flakey test

This commit is contained in:
jackkav
2025-03-18 09:28:38 +01:00
committed by Jay Wu
parent b39f7b2f95
commit 89b58631ca

View File

@@ -5,28 +5,15 @@ import { test } from '../../playwright/test';
test.describe('Global Environments', async () => {
test('create a new global environment', async ({ page }) => {
await page.getByLabel('Create in project').click();
await page.getByLabel('Create', { exact: true }).getByText('Environment').click();
await page.getByRole('button', { name: 'Create', exact: true }).click();
await page.getByTestId('CreateEnvironmentDropdown').click();
await page.getByText('Private environment').click();
await page.getByLabel('Project Actions').click();
await page.getByText('Duplicate').click();
await page.getByText('New Environment (Copy)').click();
});
test('import and use a global environment from a collection', async ({ app, page }) => {
await loadFixtureFile('collection-for-global-environments.yaml', app, page);
await loadFixtureFile('global-environment.yaml', app, page);
await page.getByRole('link', { name: 'collection-for-global-' }).click();
await page.getByTestId('New Request').getByLabel('GET New Request', { exact: true }).click();
// check if it appears red with error message in tag editor
// check if it has error message
await page.getByText('Body', { exact: true }).click();
await page.getByText('_[\'global-base\']').click();
await expect(page.getByLabel('Live Preview')).toContainText('Failed to render environment variables: _[\'global-base\']');
await page.getByRole('button', { name: 'Done' }).click();
await expect(page.getByTitle('Failed to render environment variables: _[\'global-base\']')).toHaveText('_[\'global-base\']');
// check if it appears as a custom message when sending the request
await page.getByRole('button', { name: 'Send' }).click();
await page.getByRole('heading', { name: '2 environment variables are' }).click();
@@ -41,7 +28,16 @@ test.describe('Global Environments', async () => {
await page.locator('pre').filter({ hasText: '| 4444' }).click();
await page.locator('pre').filter({ hasText: '| 55555' }).click();
});
test('create a new global environment', async ({ page }) => {
await page.getByLabel('Create in project').click();
await page.getByLabel('Create', { exact: true }).getByText('Environment').click();
await page.getByRole('button', { name: 'Create', exact: true }).click();
await page.getByTestId('CreateEnvironmentDropdown').click();
await page.getByText('Private environment').click();
await page.getByLabel('Project Actions').click();
await page.getByText('Duplicate').click();
await page.getByText('New Environment (Copy)').click();
});
});
async function loadFixtureFile(fixture: string, app, page) {
const text = await loadFixture(fixture);