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

[CI/CD] Refactor Cypress Workflow #1290

Merged
merged 13 commits into from
Dec 11, 2023
2 changes: 1 addition & 1 deletion .cypress/integration/9_integrations.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe('Basic sanity test for integrations plugin', () => {
moveToAvailableNginxIntegration();
cy.get('.euiFilterGroup').trigger('mouseover').click();
cy.get('.euiFilterSelectItem').contains('visualization').click();
cy.get('.euiTableRow').should('have.length', 4);//Filters correctly to visualization types
cy.get('.euiTableRow').should('have.length', 6);//Filters correctly to visualization types
})
});

Expand Down
41 changes: 23 additions & 18 deletions .github/workflows/integration-tests-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,29 @@ jobs:
- name: Run OpenSearch Dashboards server
run: |
cd OpenSearch-Dashboards
yarn start --no-base-path --no-watch &
sleep 200
nohup yarn start --no-base-path --no-watch | tee dashboard.log &

- name : Check If OpenSearch Dashboards Is Ready
if: ${{ runner.os == 'Linux' }}
run: |
cd ./OpenSearch-Dashboards
echo "Start checking OpenSearch Dashboards."
for i in {1..60}; do
if grep -q "bundles compiled successfully after" "dashboard.log"; then
echo "OpenSearch Dashboards compiled successfully."
break
fi
if [ $i -eq 60 ]; then
echo "Timeout for 600 seconds reached. OpenSearch Dashboards did not finish compiling."
exit 1
fi
sleep 10
done

- name: Install Cypress
run: |
cd ./OpenSearch-Dashboards/plugins/dashboards-observability
npx cypress install
npm install cypress --save-dev
shell: bash

- name: Get Cypress version
Expand All @@ -129,26 +145,15 @@ jobs:
cd ./OpenSearch-Dashboards/plugins/dashboards-observability
echo "::set-output name=cypress_version::$(cat ./package.json | jq '.dependencies.cypress' | tr -d '"')"

- name: Cache Cypress
id: cache-cypress
uses: actions/cache@v2
with:
path: ${{ matrix.cypress_cache_folder }}
key: cypress-cache-v2-${{ runner.os }}-${{ hashFiles('OpenSearch-Dashboards/plugins/dashboards-observability/package.json') }}

- name: Reset npm's script shell
if: ${{ matrix.os == 'windows-latest' }}
run: |
npm config delete script-shell

- name: Cypress tests
uses: cypress-io/github-action@v2
with:
working-directory: OpenSearch-Dashboards/plugins/dashboards-observability
command: yarn cypress:parallel --browser chrome
wait-on: 'http://localhost:5601'
env:
CYPRESS_CACHE_FOLDER: ${{ matrix.cypress_cache_folder }}
- name: Run Cypress tests
run: |
cd ./OpenSearch-Dashboards/plugins/dashboards-observability
yarn cypress:parallel --browser chrome

- name: Capture failure screenshots
uses: actions/upload-artifact@v1
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"@types/react-test-renderer": "^16.9.1",
"@types/sanitize-filename": "^1.6.3",
"antlr4ts-cli": "^0.5.0-alpha.4",
"cypress": "^12.8.1",
"cypress": "^13.6.1",
"cypress-watch-and-reload": "^1.10.6",
"eslint": "^6.8.0",
"husky": "6.0.0",
Expand Down Expand Up @@ -82,4 +82,4 @@
"node_modules/*",
"target/*"
]
}
}
29 changes: 18 additions & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.6.0.tgz#ec6cd237440700bc23ca23087f513c75508958b0"
integrity sha512-Ir+AOibqzrIsL6ajt3Rz3LskB7OiMVHqltZmspbW/TJuTVuyOMirVqAkjfY6JISiLHgyNqicAC8AyHHGzNd/dA==

"@cypress/request@2.88.12", "@cypress/request@^3.0.0":
"@cypress/request@^3.0.0":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@cypress/request/-/request-3.0.1.tgz#72d7d5425236a2413bd3d8bb66d02d9dc3168960"
integrity sha512-TWivJlJi8ZDx2wGOw1dbLuHJKUYX7bWySw377nlnGOW3hP9/MUKIsEdXT/YngWxVdgNCHRBmFlBipE+5/2ZZlQ==
Expand Down Expand Up @@ -298,10 +298,12 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.5.9.tgz#a70ec9d8fa0180a314c3ede0e20ea56ff71aed9a"
integrity sha512-PcGNd//40kHAS3sTlzKB9C9XL4K0sTup8nbG5lC14kzEteTNuAFh9u5nA0o5TWnSG2r/JNPRXFVcHJIIeRlmqQ==

"@types/node@^16.18.39":
version "16.18.48"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.18.48.tgz#3bc872236cdb31cb51024d8875d655e25db489a4"
integrity sha512-mlaecDKQ7rIZrYD7iiKNdzFb6e/qD5I9U1rAhq+Fd+DWvYVs+G2kv74UFHmSOlg5+i/vF3XxuR522V4u8BqO+Q==
"@types/node@^18.17.5":
version "18.19.2"
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.2.tgz#865107157bda220eef9fa8c2173152d6559a41ae"
integrity sha512-6wzfBdbWpe8QykUkXBjtmO3zITA0A3FIjoy+in0Y2K4KrCiRhNYJIdwAPDffZ3G6GnaKaSLSEa9ZuORLfEoiwg==
dependencies:
undici-types "~5.26.4"

"@types/plotly.js@*":
version "2.12.26"
Expand Down Expand Up @@ -982,14 +984,14 @@ cypress-watch-and-reload@^1.10.6:
chokidar "3.5.3"
ws "8.13.0"

cypress@^12.8.1:
version "12.17.4"
resolved "https://registry.yarnpkg.com/cypress/-/cypress-12.17.4.tgz#b4dadf41673058493fa0d2362faa3da1f6ae2e6c"
integrity sha512-gAN8Pmns9MA5eCDFSDJXWKUpaL3IDd89N9TtIupjYnzLSmlpVr+ZR+vb4U/qaMp+lB6tBvAmt7504c3Z4RU5KQ==
cypress@^13.6.1:
version "13.6.1"
resolved "https://registry.yarnpkg.com/cypress/-/cypress-13.6.1.tgz#c5f714f08551666ed3ac1fa95718eabb23a416df"
integrity sha512-k1Wl5PQcA/4UoTffYKKaxA0FJKwg8yenYNYRzLt11CUR0Kln+h7Udne6mdU1cUIdXBDTVZWtmiUjzqGs7/pEpw==
dependencies:
"@cypress/request" "2.88.12"
"@cypress/request" "^3.0.0"
"@cypress/xvfb" "^1.2.4"
"@types/node" "^16.18.39"
"@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 @@ -3402,6 +3404,11 @@ typed-styles@^0.0.7:
resolved "https://registry.yarnpkg.com/typed-styles/-/typed-styles-0.0.7.tgz#93392a008794c4595119ff62dde6809dbc40a3d9"
integrity sha512-pzP0PWoZUhsECYjABgCGQlRGL1n7tOHsgwYv3oIiEpJwGhFTuty/YNeduxQYzXXa3Ge5BdT6sHYIQYpl4uJ+5Q==

undici-types@~5.26.4:
version "5.26.5"
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617"
integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==

unherit@^1.0.4:
version "1.1.3"
resolved "https://registry.yarnpkg.com/unherit/-/unherit-1.1.3.tgz#6c9b503f2b41b262330c80e91c8614abdaa69c22"
Expand Down