Skip to content

Commit

Permalink
fixup! Fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
mykolaharmash committed Jan 6, 2025
1 parent 53b9f23 commit 4a2ea2c
Show file tree
Hide file tree
Showing 4 changed files with 247 additions and 216 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ Then you can run the tests in another terminal:

```bash
// ESS
npx playwright test --config x-pack/platform/plugins/private/discover_enhanced/ui_tests/playwright.config.ts --grep @ess
npx playwright test --config x-pack/solutions/observability/plugins/observability_onboarding/ui_tests/playwright.config.ts --grep @ess

// Serverless
npx playwright test --config x-pack/platform/plugins/private/discover_enhanced/ui_tests/playwright.config.ts --grep @svlOblt
npx playwright test --config x-pack/solutions/observability/plugins/observability_onboarding/ui_tests/playwright.config.ts --grep @svlOblt
```

Test results are available in `x-pack/platform/plugins/private/discover_enhanced/ui_tests/output`
Test results are available in `x-pack/solutions/observability/plugins/observability_onboarding/ui_tests/output`
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,119 @@
import { ScoutPage, KibanaUrl, KbnClient } from '@kbn/scout';

export class CustomLogsPage {
static readonly ASSERTION_MESSAGES = {
INTEGRATION_NAME_CASE_ERROR: 'An integration name should be lowercase.',
DATASET_NAME_CASE_ERROR: 'A dataset name should be lowercase.',
EXISTING_INTEGRATION_ERROR: (name: string) =>
`Failed to create the integration as an installation with the name ${name} already exists.`,

DOWNLOADING_AGENT_STATUS: 'Downloading Elastic Agent',
DOWNLOADED_AGENT_STATUS: 'Elastic Agent downloaded',
DOWNLOAD_AGENT_DANGER_CALLOUT: 'Download Elastic Agent',
EXTRACTING_AGENT_STATUS: 'Extracting Elastic Agent',
EXTRACTED_AGENT_STATUS: 'Elastic Agent extracted',
EXTRACT_AGENT_DANGER_CALLOUT: 'Extract Elastic Agent',
INSTALLING_AGENT_STATUS: 'Installing Elastic Agent',
INSTALLED_AGENT_STATUS: 'Elastic Agent installed',
INSTALL_AGENT_DANGER_CALLOUT: 'Install Elastic Agent',
CONNECTING_TO_AGENT_STATUS: 'Connecting to Elastic Agent',
CONNECTED_TO_AGENT_STATUS: 'Connected to Elastic Agent',
CONNECT_AGENT_WARNING_CALLOUT: 'Connect to the Elastic Agent',
DOWNLOAD_AGENT_CONFIG_STATUS: 'Downloading Elastic Agent config',
CONFIGURE_AGENT_WARNING_CALLOUT: 'Configure the agent',
DOWNLOADING_AGENT_CONFIG_STATUS: 'Downloading Elastic Agent config',
AGENT_CONFIGURATION_SUCCESS_CALLOUT_MACOS:
'Elastic Agent config written to /Library/Elastic/Agent/elastic-agent.yml',
AGENT_CONFIGURATION_SUCCESS_CALLOUT_LINUX:
'Elastic Agent config written to /opt/Elastic/Agent/elastic-agent.yml',
INSTALLATION_STEP_2_DISABLED: 'Step 2 is disabled',
};

public readonly advancedSettingsContent;
public readonly logFilePathList;
public readonly continueButton;
public readonly addLogFilePathButton;
public readonly integrationNameInput;
public readonly datasetNameInput;
public readonly serviceNameInput;
public readonly namespaceInput;
public readonly customConfigInput;
public readonly customIntegrationSuccessCallout;
public readonly customIntegrationErrorCallout;
public readonly apiKeyCreateSuccessCallout;
public readonly apiKeyPrivilegesErrorCallout;
public readonly apiKeyCreateErrorCallout;
public readonly linuxCodeSnippetButton;
public readonly macOSCodeSnippetButton;
public readonly windowsCodeSnippetButton;
public readonly autoDownloadConfigurationToggle;
public readonly autoDownloadConfigurationCallout;
public readonly installCodeSnippet;
public readonly windowsInstallElasticAgentDocLink;
public readonly configureElasticAgentStep;
public readonly downloadConfigurationButton;
public readonly stepStatusLoading;
public readonly stepStatusComplete;
public readonly stepStatusDanger;
public readonly stepStatusWarning;

constructor(
private readonly page: ScoutPage,
private readonly kbnUrl: KibanaUrl,
private readonly kbnClient: KbnClient
) {}
) {
this.advancedSettingsContent = this.page.testSubj
.locator('obltOnboardingCustomLogsAdvancedSettings')
.getByRole('group');
this.logFilePathList = this.page.locator(`[data-test-subj^=obltOnboardingLogFilePath-]`);
this.continueButton = this.page.testSubj.locator('obltOnboardingCustomLogsContinue');
this.addLogFilePathButton = this.page.testSubj.locator('obltOnboardingCustomLogsAddFilePath');
this.integrationNameInput = this.page.testSubj.locator(
'obltOnboardingCustomLogsIntegrationsName'
);
this.datasetNameInput = this.page.testSubj.locator('obltOnboardingCustomLogsDatasetName');
this.serviceNameInput = this.page.testSubj.locator('obltOnboardingCustomLogsServiceName');
this.namespaceInput = this.page.testSubj.locator('obltOnboardingCustomLogsNamespace');
this.customConfigInput = this.page.testSubj.locator('obltOnboardingCustomLogsCustomConfig');
this.customIntegrationSuccessCallout = this.page.testSubj.locator(
'obltOnboardingCustomIntegrationInstalled'
);
this.customIntegrationErrorCallout = this.page.testSubj.locator(
'obltOnboardingCustomIntegrationErrorCallout'
);
this.apiKeyCreateSuccessCallout = this.page.testSubj.locator('obltOnboardingLogsApiKeyCreated');
this.apiKeyPrivilegesErrorCallout = this.page.testSubj.locator(
'obltOnboardingLogsApiKeyCreationNoPrivileges'
);
this.apiKeyCreateErrorCallout = this.page.testSubj.locator(
'obltOnboardingLogsApiKeyCreationFailed'
);
this.linuxCodeSnippetButton = this.page.testSubj.locator('linux-tar');
this.macOSCodeSnippetButton = this.page.testSubj.locator('macos');
this.windowsCodeSnippetButton = this.page.testSubj.locator('windows');
this.autoDownloadConfigurationToggle = this.page.testSubj.locator(
'obltOnboardingInstallElasticAgentAutoDownloadConfig'
);
this.autoDownloadConfigurationCallout = this.page.testSubj.locator(
'obltOnboardingInstallElasticAgentAutoDownloadConfigCallout'
);
this.installCodeSnippet = this.page.testSubj
.locator('obltOnboardingInstallElasticAgentStep')
.getByRole('code');
this.windowsInstallElasticAgentDocLink = this.page.testSubj.locator(
'obltOnboardingInstallElasticAgentWindowsDocsLink'
);
this.configureElasticAgentStep = this.page.testSubj.locator(
'obltOnboardingConfigureElasticAgentStep'
);
this.downloadConfigurationButton = this.page.testSubj.locator(
'obltOnboardingConfigureElasticAgentStepDownloadConfig'
);
this.stepStatusLoading = this.page.testSubj.locator('obltOnboardingStepStatus-loading');
this.stepStatusComplete = this.page.testSubj.locator('obltOnboardingStepStatus-complete');
this.stepStatusDanger = this.page.testSubj.locator('obltOnboardingStepStatus-danger');
this.stepStatusWarning = this.page.testSubj.locator('obltOnboardingStepStatus-warning');
}

async goto() {
this.page.goto(`${this.kbnUrl.app('observabilityOnboarding')}/customLogs`);
Expand All @@ -22,38 +130,14 @@ export class CustomLogsPage {
await this.page.testSubj.click('observabilityOnboardingFlowBackToSelectionButton');
}

logFilePathList() {
return this.page.locator(`[data-test-subj^=obltOnboardingLogFilePath-]`);
}

logFilePathInput(index: number) {
return this.page.testSubj.locator(`obltOnboardingLogFilePath-${index}`).getByRole('textbox');
}

continueButton() {
return this.page.testSubj.locator('obltOnboardingCustomLogsContinue');
}

addLogFilePathButton() {
return this.page.testSubj.locator('obltOnboardingCustomLogsAddFilePath');
}

logFilePathDeleteButton(index: number) {
return this.page.testSubj.locator(`obltOnboardingLogFilePathDelete-${index}`);
}

integrationNameInput() {
return this.page.testSubj.locator('obltOnboardingCustomLogsIntegrationsName');
}

datasetNameInput() {
return this.page.testSubj.locator('obltOnboardingCustomLogsDatasetName');
}

serviceNameInput() {
return this.page.testSubj.locator('obltOnboardingCustomLogsServiceName');
}

async clickAdvancedSettingsButton() {
return this.page.testSubj
.locator('obltOnboardingCustomLogsAdvancedSettings')
Expand All @@ -62,14 +146,6 @@ export class CustomLogsPage {
.click();
}

namespaceInput() {
return this.page.testSubj.locator('obltOnboardingCustomLogsNamespace');
}

customConfigInput() {
return this.page.testSubj.locator('obltOnboardingCustomLogsCustomConfig');
}

async installCustomIntegration(name: string) {
await this.kbnClient.request({
method: 'POST',
Expand Down Expand Up @@ -116,76 +192,4 @@ export class CustomLogsPage {
},
});
}

customIntegrationSuccessCallout() {
return this.page.testSubj.locator('obltOnboardingCustomIntegrationInstalled');
}

customIntegrationErrorCallout() {
return this.page.testSubj.locator('obltOnboardingCustomIntegrationErrorCallout');
}

apiKeyCreateSuccessCallout() {
return this.page.testSubj.locator('obltOnboardingLogsApiKeyCreated');
}

apiKeyPrivilegesErrorCallout() {
return this.page.testSubj.locator('obltOnboardingLogsApiKeyCreationNoPrivileges');
}

apiKeyCreateErrorCallout() {
return this.page.testSubj.locator('obltOnboardingLogsApiKeyCreationFailed');
}

linuxCodeSnippetButton() {
return this.page.testSubj.locator('linux-tar');
}

macOSCodeSnippetButton() {
return this.page.testSubj.locator('macos');
}

windowsCodeSnippetButton() {
return this.page.testSubj.locator('windows');
}

autoDownloadConfigurationToggle() {
return this.page.testSubj.locator('obltOnboardingInstallElasticAgentAutoDownloadConfig');
}

autoDownloadConfigurationCallout() {
return this.page.testSubj.locator('obltOnboardingInstallElasticAgentAutoDownloadConfigCallout');
}

installCodeSnippet() {
return this.page.testSubj.locator('obltOnboardingInstallElasticAgentStep').getByRole('code');
}

windowsInstallElasticAgentDocLink() {
return this.page.testSubj.locator('obltOnboardingInstallElasticAgentWindowsDocsLink');
}

configureElasticAgentStep() {
return this.page.testSubj.locator('obltOnboardingConfigureElasticAgentStep');
}

downloadConfigurationButton() {
return this.page.testSubj.locator('obltOnboardingConfigureElasticAgentStepDownloadConfig');
}

stepStatusLoading() {
return this.page.testSubj.locator('obltOnboardingStepStatus-loading');
}

stepStatusComplete() {
return this.page.testSubj.locator('obltOnboardingStepStatus-complete');
}

stepStatusDanger() {
return this.page.testSubj.locator('obltOnboardingStepStatus-danger');
}

stepStatusWarning() {
return this.page.testSubj.locator('obltOnboardingStepStatus-warning');
}
}
Loading

0 comments on commit 4a2ea2c

Please sign in to comment.