Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E2E: fix test for WSL integration #5832

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,7 @@ tencenttke
termch
testbuild
testfilethatdoesntexist
testid
testreleasedate
testurl
tgz
Expand Down
12 changes: 12 additions & 0 deletions e2e/pages/preferences/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,16 @@ export class PreferencesPage {
this.kubernetes = new KubernetesNav(page);
this.wsl = new WslNav(page);
}

get alert() {
return this.page.getByTestId('preferences-alert');
}

apply() {
return this.page.getByTestId('preferences-apply').click();
}

cancel() {
return this.page.getByTestId('preferences-cancel').click();
}
}
15 changes: 15 additions & 0 deletions e2e/pages/preferences/wsl.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import type { Page, Locator } from '@playwright/test';

const checkboxProps = {
checkbox: 'input[type="checkbox"]',
container: '.checkbox-container',
name: '.checkbox-label',
error: '.checkbox-outer-container-description',
} as const;

export class WslNav {
readonly page: Page;
readonly nav: Locator;
Expand All @@ -20,4 +27,12 @@ export class WslNav {
this.wslIntegrations = page.locator('[data-test="wslIntegrations"]');
this.addressTitle = page.locator('[data-test="addressTitle"]');
}

getIntegration(distro: string) : Locator & { [p in keyof typeof checkboxProps]: Locator } {
const locator = this.wslIntegrations.getByTestId(`item-${ distro }`).locator('.checkbox-outer-container');
const origProps = Object.entries(checkboxProps);
const mappedProps = origProps.map(([k, v]) => [k, { value: locator.locator(v) }]);

return Object.create(locator, Object.fromEntries(mappedProps));
}
}
2 changes: 2 additions & 0 deletions e2e/utils/TestUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ import plist from 'plist';
import { defaultSettings, LockedSettingsType, Settings } from '@pkg/config/settings';
import { PathManagementStrategy } from '@pkg/integrations/pathManager';
import * as childProcess from '@pkg/utils/childProcess';
import { Log } from '@pkg/utils/logging' ;
import paths from '@pkg/utils/paths';
import { RecursivePartial, RecursiveTypes } from '@pkg/utils/typeUtils';

const console = new Log(path.basename(__filename, '.ts'), reportAsset(__filename, 'log'));
let testInfo: undefined | {
testPath: string;
startTime: number;
Expand Down
Loading
Loading