Skip to content

Commit

Permalink
e2e test: Duplicate variables entries (#6022)
Browse files Browse the repository at this point in the history
### Intent 

To help test #5887 these new tests ensure that after an interpreter env is restarted, it doens't create a duplicate entry in variables pane.

### Approach

* Restarts interpreter and checks that only 1 still exists
* R & Python.. I thought adding a notebook version would be unnecessary, but can if needed.

### QA Notes

Tests are skipped now due to the issue. But you can check the tests by removing the skip and it will fail with

```
    Error: expect(received).toBe(expected) // Object.is equality

    Expected: 1
    Received: 2

```
All other variable tests should still pass 
@:variables

<!--
  Add additional information for QA on how to validate the change,
  paying special attention to the level of risk, adjacent areas that
  could be affected by the change, and any important contextual
  information not present in the linked issues.
-->
  • Loading branch information
jonvanausdeln authored Jan 17, 2025
1 parent 2ed1117 commit 68aa099
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/e2e/pages/variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ export class Variables {
await this.code.driver.page.locator('a.action-menu-item', { hasText: name }).first().click();
}

async getVariablesGroupList() {
await this.code.driver.page.locator(VARIABLES_GROUP_SELECTOR).click();
const groupList = await this.code.driver.page.locator('a.action-menu-item').all();
const groupNames = await Promise.all(groupList.map(async (group) => group.innerText()));
return groupNames;
}

async clickDatabaseIconForVariableRow(rowName: string) {
const DATABASE_ICON = '.codicon-database';
await this.code.driver.page.locator(VARIABLE_ITEMS).filter({ hasText: rowName }).locator(DATABASE_ICON).click();
Expand Down
25 changes: 25 additions & 0 deletions test/e2e/tests/variables/variables-pane.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ test.describe('Variables Pane', {

});

test.skip('Python - Verifies only 1 entery per environment', {
annotation: [{ type: 'issue', description: 'https://github.com/posit-dev/positron/issues/5887' }],
}, async function ({ app, logger, python }) {
await app.workbench.console.barClearButton.click();
await app.workbench.console.barRestartButton.click();
await app.workbench.console.waitForReady('>>>');
await app.workbench.console.waitForConsoleContents('restarted');
const groupList = app.workbench.variables.getVariablesGroupList();
expect((await groupList).length).toBe(1);
});

test('R - Verifies Variables pane basic function [C628635]', async function ({ app, logger, r }) {
const executeCode = async (code: string) => {
await app.workbench.console.executeCode('R', code, '>');
Expand All @@ -54,4 +65,18 @@ test.describe('Variables Pane', {
expect(variablesMap.get('y')).toStrictEqual({ value: '10', type: 'dbl' });
expect(variablesMap.get('z')).toStrictEqual({ value: '100', type: 'dbl' });
});


test.skip('R - Verifies only 1 entery per environment', {
annotation: [{ type: 'issue', description: 'https://github.com/posit-dev/positron/issues/5887' }],
}, async function ({ app, logger, r }) {
await app.workbench.console.barClearButton.click();
await app.workbench.console.barRestartButton.click();
await app.workbench.console.waitForReady('>');
await app.workbench.console.waitForConsoleContents('restarted');
const groupList = app.workbench.variables.getVariablesGroupList();
expect((await groupList).length).toBe(1);
});
});


0 comments on commit 68aa099

Please sign in to comment.