Skip to content

Commit

Permalink
E2E tests: deprecate positron base element (#5790)
Browse files Browse the repository at this point in the history
Deprecate the PositronBaseElement as it relied on MS functions.

### QA Notes

All tests should pass.

---------

Co-authored-by: Marie Idleman <[email protected]>
  • Loading branch information
testlabauto and midleman authored Dec 18, 2024
1 parent dba8a8c commit f7a30ec
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 80 deletions.
1 change: 0 additions & 1 deletion test/automation/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export * from './positron/positronPlots';
export * from './positron/fixtures/positronPythonFixtures';
export * from './positron/fixtures/positronRFixtures';
export * from './positron/fixtures/positronUserSettingsFixtures';
export * from './positron/positronBaseElement';
export * from './positron/positronNotebooks';
export * from './positron/positronNewProjectWizard';
export * from './positron/positronConnections';
Expand Down
57 changes: 0 additions & 57 deletions test/automation/src/positron/positronBaseElement.ts

This file was deleted.

7 changes: 3 additions & 4 deletions test/automation/src/positron/positronDataExplorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
*--------------------------------------------------------------------------------------------*/


import { expect } from '@playwright/test';
import { expect, Locator } from '@playwright/test';
import { Code } from '../code';
import { PositronBaseElement } from './positronBaseElement';
import { Workbench } from '../workbench';

const COLUMN_HEADERS = '.data-explorer-panel .right-column .data-grid-column-headers';
Expand Down Expand Up @@ -48,10 +47,10 @@ export interface ColumnProfile {
*/
export class PositronDataExplorer {

clearSortingButton: PositronBaseElement;
clearSortingButton: Locator;

constructor(private code: Code, private workbench: Workbench) {
this.clearSortingButton = new PositronBaseElement(CLEAR_SORTING_BUTTON, this.code);
this.clearSortingButton = this.code.driver.page.locator(CLEAR_SORTING_BUTTON);
}

/*
Expand Down
10 changes: 3 additions & 7 deletions test/automation/src/positron/positronExplorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
*--------------------------------------------------------------------------------------------*/


import { expect } from '@playwright/test';
import { expect, Locator } from '@playwright/test';
import { Code } from '../code';
// import { QuickAccess } from '../quickaccess';
import { PositronTextElement } from './positronBaseElement';

const POSITRON_EXPLORER_PROJECT_TITLE = 'div[id="workbench.view.explorer"] h3.title';
const POSITRON_EXPLORER_PROJECT_FILES = 'div[id="workbench.view.explorer"] span[class="monaco-highlighted-label"]';
Expand All @@ -17,12 +15,10 @@ const POSITRON_EXPLORER_PROJECT_FILES = 'div[id="workbench.view.explorer"] span[
* Reuseable Positron explorer functionality for tests to leverage.
*/
export class PositronExplorer {
explorerProjectTitle: PositronTextElement;
explorerProjectTitle: Locator = this.code.driver.page.locator(POSITRON_EXPLORER_PROJECT_TITLE);
explorerProjectTitleLocator = this.code.driver.page.locator(POSITRON_EXPLORER_PROJECT_TITLE);

constructor(protected code: Code) {
this.explorerProjectTitle = new PositronTextElement(POSITRON_EXPLORER_PROJECT_TITLE, this.code);
}
constructor(protected code: Code) { }

/**
* Constructs a string array of the top-level project files/directories in the explorer.
Expand Down
14 changes: 7 additions & 7 deletions test/automation/src/positron/positronTopActionBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*--------------------------------------------------------------------------------------------*/


import { Locator } from '@playwright/test';
import { Code } from '../code';
import { PositronBaseElement } from './positronBaseElement';

const POSITRON_TOP_ACTION_BAR = 'div[id="workbench.parts.positron-top-action-bar"]';
const POSITRON_TOP_ACTION_SAVE_BUTTON = 'div[id="workbench.parts.positron-top-action-bar"] .action-bar-region-left .action-bar-button[aria-label="Save"]';
Expand All @@ -15,13 +15,13 @@ const POSITRON_TOP_ACTION_SAVE_ALL_BUTTON = 'div[id="workbench.parts.positron-to
* Reuseable Positron top action bar functionality for tests to leverage.
*/
export class PositronTopActionBar {
topActionBar: PositronBaseElement;
saveButton: PositronBaseElement;
saveAllButton: PositronBaseElement;
topActionBar: Locator;
saveButton: Locator;
saveAllButton: Locator;

constructor(private code: Code) {
this.topActionBar = new PositronBaseElement(POSITRON_TOP_ACTION_BAR, this.code);
this.saveButton = new PositronBaseElement(POSITRON_TOP_ACTION_SAVE_BUTTON, this.code);
this.saveAllButton = new PositronBaseElement(POSITRON_TOP_ACTION_SAVE_ALL_BUTTON, this.code);
this.topActionBar = this.code.driver.page.locator(POSITRON_TOP_ACTION_BAR);
this.saveButton = this.code.driver.page.locator(POSITRON_TOP_ACTION_SAVE_BUTTON);
this.saveAllButton = this.code.driver.page.locator(POSITRON_TOP_ACTION_SAVE_ALL_BUTTON);
}
}
7 changes: 4 additions & 3 deletions test/automation/src/positron/positronVariables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ interface FlatVariables {
const VARIABLE_ITEMS = '.variable-item';
const VARIABLE_NAMES = 'name-column';
const VARIABLE_DETAILS = 'details-column';
const VARIABLES_NAME_COLUMN = '.variables-instance[style*="z-index: 1"] .variable-item .name-column';
const CURRENT_VARIABLES_GROUP = '.variables-instance[style*="z-index: 1"]';
const VARIABLES_NAME_COLUMN = `${CURRENT_VARIABLES_GROUP} .variable-item .name-column`;
const VARIABLES_INTERPRETER = '.positron-variables-container .action-bar-button-text';
const VARIABLE_CHEVRON_ICON = '.gutter .expand-collapse-icon';
const VARIABLE_INDENTED = '.name-column-indenter[style*="margin-left: 40px"]';
Expand Down Expand Up @@ -70,7 +71,7 @@ export class PositronVariables {

async toggleVariable({ variableName, action }: { variableName: string; action: 'expand' | 'collapse' }) {
await this.waitForVariableRow(variableName);
const variable = this.code.driver.page.locator('.name-value', { hasText: variableName });
const variable = this.code.driver.page.locator(`${CURRENT_VARIABLES_GROUP} .name-value`, { hasText: variableName });

const chevronIcon = variable.locator('..').locator(VARIABLE_CHEVRON_ICON);
const isExpanded = await chevronIcon.evaluate((el) => el.classList.contains('codicon-chevron-down'));
Expand Down Expand Up @@ -107,7 +108,7 @@ export class PositronVariables {
*/
async getVariableChildren(parentVariable: string, collapseParent = true): Promise<{ [key: string]: { value: string; type: string } }> {
await this.expandVariable(parentVariable);
const variable = this.code.driver.page.locator(`.name-value:text-is("${parentVariable}")`);
const variable = this.code.driver.page.locator(`${CURRENT_VARIABLES_GROUP} .name-value:text-is("${parentVariable}")`);

// get the children of the parent variable, which are indented
const children = await variable.locator('..').locator('..').locator('..').locator('..').locator(VARIABLE_ITEMS)
Expand Down
1 change: 0 additions & 1 deletion test/e2e/areas/variables/variables-expanded.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ test.describe('Variables - Expanded View', { tag: [tags.WEB, tags.VARIABLES] },

test.afterEach(async function ({ app }) {
await app.workbench.positronLayouts.enterLayout('stacked');
await app.workbench.positronConsole.barRestartButton.click();
});

test('Python - should display children values and types when variable is expanded [C1078836]', async function ({ app, python }) {
Expand Down

0 comments on commit f7a30ec

Please sign in to comment.