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

Remove waitForSelector for some dashboards page #10

Merged
merged 7 commits into from
Jan 21, 2023
Merged
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
2 changes: 2 additions & 0 deletions USER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ You can also find this information using help command.
opensearch-reporting-cli --help
```

NOTE: The tenant in the url has the higher priority than tenant value provided as command option. For example, if the command is `opensearch-reporting-cli -u http://localhost:5601/goto/069af6d6f3294421ec163b07fef91e5d?security_tenant=private -t global` then tenant value *private* will be used for generating report because url contains *security_tenant=private*.

## Environment Variable File

Reporting CLI also reads environment variables from .env file in the current directory.
Expand Down
3 changes: 3 additions & 0 deletions src/arguments.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ export async function getCommandArguments() {
.default(DEFAULT_EMAIL_SUBJECT)
.env(ENV_VAR.EMAIL_SUBJECT))

program.addHelpText('after', `
Note: The tenant in the url has the higher priority than tenant value provided as command option.`);

program.parse(process.argv);
const options = program.opts();
spinner.start('Fetching the arguments values');
Expand Down
6 changes: 3 additions & 3 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ export const AUTH = {
}

export const URL_SOURCE = {
DASHBOARDS: 'dashboards#',
VISUALIZE: "Visualize",
DISCOVER: "discover#",
DASHBOARDS: "/app/dashboards#",
VISUALIZE: "/app/visualize#",
DISCOVER: "/app/discover#",
NOTEBOOKS: "notebooks",
}

Expand Down
26 changes: 0 additions & 26 deletions src/download-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,32 +94,6 @@ export async function downloadReport(url, format, width, height, filename, authT

// force wait for any resize to load after the above DOM modification.
await new Promise(resolve => setTimeout(resolve, 1000));

switch (reportSource) {
case REPORT_TYPE.DASHBOARD:
await page.waitForSelector(SELECTOR.DASHBOARD, {
visible: true,
});
break;
case REPORT_TYPE.VISUALIZATION:
await page.waitForSelector(SELECTOR.VISUALIZATION, {
visible: true,
});
break;
case REPORT_TYPE.NOTEBOOK:
await page.waitForSelector(SELECTOR.NOTEBOOK, {
visible: true,
});
break;
case REPORT_TYPE.DISCOVER:
await page.waitForSelector(SELECTOR.DISCOVER, {
visible: true,
});
break;
default:
break;
}

await waitForDynamicContent(page);
let buffer;
spinner.text = `Downloading Report...`;
Expand Down
2 changes: 2 additions & 0 deletions test/help.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Options:
--smtppassword <password> smtp password (env: OPENSEARCH_SMTP_PASSWORD)
--subject <subject> email Subject (default: "This is an email containing your opensearch dashboard report", env: OPENSEARCH_EMAIL_SUBJECT)
-h, --help display help for command

Note: The tenant in the url has the higher priority than tenant value provided as command option.
`;
let result = await cli(['-h'], '.');
expect(result.code).toBe(0);
Expand Down