Skip to content

Commit

Permalink
Fix condition to determine if the date field's value is an array (#299)…
Browse files Browse the repository at this point in the history
… (#305)

* Change cypress version



* Fix condition to check if date field



* Fix cypress test



* update cypress e2e workflow



* Revert "update cypress e2e workflow"

This reverts commit 0db4d73.



* Fix cypress error



* Try cypress CI without --spec



* Revert cypress to v13.6.0



---------


(cherry picked from commit 2d39d24)

Signed-off-by: Rupal Mahajan <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent b2cac29 commit 128d67d
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 35 deletions.
25 changes: 13 additions & 12 deletions .cypress/integration/04-download.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,12 @@ describe('Cypress', () => {
);

cy.wait(12500);
cy.get('#landingPageOnDemandDownload').click({ force: true });
cy.get('body').then($body => {
if ($body.find('#downloadInProgressLoadingModal').length > 0) {
return;
}
else {
assert(false);
}
})
cy.get('[id="landingPageOnDemandDownload"]')
.contains('CSV')
.click({ force: true });
cy.get('.euiToastHeader__title')
.contains('Successfully downloaded report')
.should('exist');
});

it('Download pdf from in-context menu', () => {
Expand Down Expand Up @@ -85,10 +82,14 @@ describe('Cypress', () => {

cy.url().should('include', 'report_definition_details');

cy.get('#generateReportFromDetailsButton').should('exist');
cy.wait(5000);

cy.get('#generateReportFromDetailsFileFormat').should('exist');

cy.get('#generateReportFromDetailsButton').click({ force: true });
cy.get('#generateReportFromDetailsFileFormat').click({ force: true });

cy.get('#downloadInProgressLoadingModal');
cy.get('.euiToastHeader__title')
.contains('Successfully generated report')
.should('exist');
});
});
2 changes: 1 addition & 1 deletion .github/workflows/cypress-e2e-reporting-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ jobs:

- name: Run Cypress tests
run: |
yarn cypress:run --browser chrome --headless --spec '.cypress/integration/*'
yarn cypress:run --browser chrome --headless
working-directory: OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }}

- name: Capture failure screenshots
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
cd ./OpenSearch-Dashboards/
su `id -un 1000` -c "source $NVM_DIR/nvm.sh && nvm use && node -v && yarn -v &&
cd ./plugins/${{ env.PLUGIN_NAME }} &&
whoami && yarn osd bootstrap && yarn test --coverage"
whoami && yarn osd bootstrap --single-version=loose && yarn test --coverage"
- name: Upload coverage
uses: codecov/codecov-action@v1
Expand Down Expand Up @@ -113,7 +113,7 @@ jobs:
with:
timeout_minutes: 30
max_attempts: 3
command: yarn osd bootstrap
command: yarn osd bootstrap --single-version=loose

- name: Test
uses: nick-fields/retry@v1
Expand Down Expand Up @@ -170,7 +170,7 @@ jobs:
with:
timeout_minutes: 30
max_attempts: 3
command: yarn osd bootstrap
command: yarn osd bootstrap --single-version=loose

- name: Test
uses: nick-fields/retry@v1
Expand Down
2 changes: 1 addition & 1 deletion DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ another JDK installation, e.g. `RUNTIME_JAVA_HOME=/usr/lib/jvm/jdk-8`.
cd plugins
git clone https://github.com/opensearch-project/dashboards-reporting.git
```
1. Run `yarn osd bootstrap` inside `OpenSearch-Dashboards/plugins/dashboards-reporting`.
1. Run `yarn osd bootstrap --single-version=loose` inside `OpenSearch-Dashboards/plugins/dashboards-reporting`.

Ultimately, your directory structure should look like this:

Expand Down
8 changes: 4 additions & 4 deletions server/routes/utils/dataReportHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ export const getOpenSearchData = (
if (typeof dateValue === 'string') {
data._source[keys] = moment.utc(dateValue).tz(timezone).format(dateFormat);
} else if (
fieldDateValue.length !== 0 &&
fieldDateValue instanceof Array
dateValue.length !== 0 &&
dateValue instanceof Array
) {
fieldDateValue.forEach((element, index) => {
data._source[keys][index] = moment.utc(element).tz(timezone).format(dateFormat);
Expand All @@ -161,8 +161,8 @@ export const getOpenSearchData = (
if (typeof fieldDateValue === 'string') {
keys.push(moment.utc(fieldDateValue).tz(timezone).format(dateFormat));
} else if (
fieldDateValue.length !== 0 &&
fieldDateValue instanceof Array
dateValue.length !== 0 &&
dateValue instanceof Array
) {
let tempArray: string[] = [];
fieldDateValue.forEach((index) => {
Expand Down
20 changes: 6 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -757,13 +757,6 @@
dependencies:
undici-types "~5.26.4"

"@types/node@^18.17.5":
version "18.19.6"
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.6.tgz#537beece2c8ad4d9abdaa3b0f428e601eb57dac8"
integrity sha512-X36s5CXMrrJOs2lQCdDF68apW4Rfx9ixYMawlepwmE4Anezv/AV2LSpKD1Ub8DAc+urp5bk0BGZ6NtmBitfnsg==
dependencies:
undici-types "~5.26.4"

"@types/parse-json@^4.0.0":
version "4.0.2"
resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.2.tgz#5950e50960793055845e956c427fc2b0d70c5239"
Expand Down Expand Up @@ -2195,13 +2188,12 @@ cyclist@^1.0.1:
integrity sha512-0sVXIohTfLqVIW3kb/0n6IiWF3Ifj5nm2XaSrLq2DI6fKIGa2fYAZdk917rUneaeLVpYfFcyXE2ft0fe3remsA==

cypress@^13.6.0:
version "13.6.2"
resolved "https://registry.yarnpkg.com/cypress/-/cypress-13.6.2.tgz#c70df09db0a45063298b3cecba2fa21109768e08"
integrity sha512-TW3bGdPU4BrfvMQYv1z3oMqj71YI4AlgJgnrycicmPZAXtvywVFZW9DAToshO65D97rCWfG/kqMFsYB6Kp91gQ==
version "13.6.4"
resolved "https://registry.yarnpkg.com/cypress/-/cypress-13.6.4.tgz#42c88d3ee0342f1681abfacabf9c1f082676bc53"
integrity sha512-pYJjCfDYB+hoOoZuhysbbYhEmNW7DEDsqn+ToCLwuVowxUXppIWRr7qk4TVRIU471ksfzyZcH+mkoF0CQUKnpw==
dependencies:
"@cypress/request" "^3.0.0"
"@cypress/xvfb" "^1.2.4"
"@types/node" "^18.17.5"
"@types/sinonjs__fake-timers" "8.1.1"
"@types/sizzle" "^2.3.2"
arch "^2.2.0"
Expand Down Expand Up @@ -5343,9 +5335,9 @@ ret@~0.1.10:
integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==

rfdc@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/rfdc/-/rfdc-1.3.0.tgz#d0b7c441ab2720d05dc4cf26e01c89631d9da08b"
integrity sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==
version "1.3.1"
resolved "https://registry.yarnpkg.com/rfdc/-/rfdc-1.3.1.tgz#2b6d4df52dffe8bb346992a10ea9451f24373a8f"
integrity sha512-r5a3l5HzYlIC68TpmYKlxWjmOP6wiPJ1vWv2HeLhNsRZMrCkxeqxiHlQ21oXmQ4F3SiryXBHhAD7JZqvOJjFmg==

rgbcolor@^1.0.1:
version "1.0.1"
Expand Down

0 comments on commit 128d67d

Please sign in to comment.