Skip to content

Commit 6e0c75b

Browse files
committed
fix more warnings
1 parent 9e1f06f commit 6e0c75b

File tree

3 files changed

+33
-49
lines changed

3 files changed

+33
-49
lines changed

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ export default tseslint.config(
5757
rules: {
5858
...playwright.configs['flat/recommended'].rules,
5959
'playwright/expect-expect': 'off',
60-
'playwright/valid-title': 'off', //TODO: avoid using looping e2e tests
6160
'playwright/require-soft-assertions': 'error',
6261
'playwright/prefer-native-locators': 'error',
6362
'playwright/prefer-to-be': 'error',
6463
'playwright/prefer-to-contain': 'error',
64+
'playwright/no-wait-for-timeout': 'error',
6565
},
6666
},
6767
{

packages/insomnia-smoke-test/tests/smoke/insomnia-vault.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ test.describe('Check vault used in environment', () => {
7878
},
7979
});
8080

81-
test('test global private sub environment to store vaults', async ({ page, app }) => {
81+
test('global private sub environment to store vaults', async ({ page, app }) => {
8282
await page.getByTestId('settings-button').click();
8383
await page.getByTestId('dataFolders').fill(getFixturePath('vault-collection.yaml'));
8484
await page.getByTestId('dataFolders-btn').click();

packages/insomnia-smoke-test/tests/smoke/pre-request-script-features.test.ts

Lines changed: 31 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,8 @@ test.describe('pre-request features tests', () => {
250250

251251
// enter script
252252
await page.getByRole('tab', { name: 'Scripts' }).click();
253-
const preRequestScriptEditor = page.getByTestId('CodeEditor').getByRole('textbox');
254-
await preRequestScriptEditor.fill(`
253+
const editor = page.getByTestId('CodeEditor').getByRole('textbox');
254+
await editor.fill(`
255255
const rawReq = {
256256
url: 'http://127.0.0.1:4010/echo',
257257
method: 'POST',
@@ -634,56 +634,40 @@ test.describe('unhappy paths', () => {
634634
await page.getByLabel('Pre-request Scripts').click();
635635
});
636636

637-
const testCases = [
638-
{
639-
name: 'custom error is returned',
640-
preReqScript: `
641-
throw Error('my custom error');
642-
`,
643-
context: {
644-
insomnia: {},
645-
},
646-
expectedResult: {
647-
message: 'my custom error',
648-
},
649-
},
650-
{
651-
name: 'syntax error',
652-
preReqScript: `
653-
insomnia.INVALID_FIELD.set('', '')
654-
`,
655-
context: {
656-
insomnia: {},
657-
},
658-
expectedResult: {
659-
message: "Cannot read properties of undefined (reading 'set')",
660-
},
661-
},
662-
];
637+
test('custom errors are returned', async ({ page }) => {
638+
await page.getByLabel('Request Collection').getByTestId('echo pre-request script result').press('Enter');
639+
640+
// set request body
641+
await page.getByRole('tab', { name: 'Body' }).click();
642+
await page.getByRole('button', { name: 'Body' }).click();
643+
await page.getByRole('option', { name: 'JSON' }).click();
644+
645+
// enter script
646+
await page.getByRole('tab', { name: 'Scripts' }).click();
647+
const editor = page.getByTestId('CodeEditor').getByRole('textbox');
648+
await editor.fill(`throw Error('my custom error');`);
663649

664-
for (const tc of testCases) {
665-
test(tc.name, async ({ page }) => {
666-
const responsePane = page.getByTestId('response-pane');
650+
await page.getByRole('tab', { name: 'Body' }).click();
667651

668-
await page.getByLabel('Request Collection').getByTestId('echo pre-request script result').press('Enter');
652+
// send
653+
await page.getByTestId('request-pane').getByRole('button', { name: 'Send' }).click();
669654

670-
// set request body
671-
await page.getByRole('tab', { name: 'Body' }).click();
672-
await page.getByRole('button', { name: 'Body' }).click();
673-
await page.getByRole('option', { name: 'JSON' }).click();
655+
// verify
656+
await expect.soft(page.getByTestId('response-pane')).toContainText('my custom error');
674657

675-
// enter script
676-
await page.getByRole('tab', { name: 'Scripts' }).click();
677-
const preRequestScriptEditor = page.getByTestId('CodeEditor').getByRole('textbox');
678-
await preRequestScriptEditor.fill(tc.preReqScript);
658+
await page.getByRole('tab', { name: 'Scripts' }).click();
659+
await page.getByTestId('CodeEditor').getByRole('textbox').press('ControlOrMeta+a');
660+
await page.keyboard.press('Backspace');
661+
await editor.fill(`insomnia.INVALID_FIELD.set('', '')`);
679662

680-
await page.getByRole('tab', { name: 'Body' }).click();
663+
await page.getByRole('tab', { name: 'Body' }).click();
681664

682-
// send
683-
await page.getByTestId('request-pane').getByRole('button', { name: 'Send' }).click();
665+
// send
666+
await page.getByTestId('request-pane').getByRole('button', { name: 'Send' }).click();
684667

685-
// verify
686-
await expect.soft(responsePane).toContainText(tc.expectedResult.message);
687-
});
688-
}
668+
// verify
669+
await expect
670+
.soft(page.getByTestId('response-pane'))
671+
.toContainText(`Cannot read properties of undefined (reading 'set')`);
672+
});
689673
});

0 commit comments

Comments
 (0)