Adds test to check whether anonymous auth login button is displayed c… #90
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Cypress Tests | |
on: [ push, pull_request ] | |
env: | |
TEST_BROWSER_HEADLESS: 1 | |
CI: 1 | |
FTR_PATH: 'ftr' | |
START_CMD: 'node ../scripts/opensearch_dashboards --dev --no-base-path --no-watch --opensearch_security.multitenancy.enable_aggregation_view=true' | |
OPENSEARCH_SNAPSHOT_CMD: 'node ../scripts/opensearch snapshot' | |
SPEC: 'cypress/integration/plugins/security-dashboards-plugin/aggregation_view.js,' | |
PLUGIN_NAME: opensearch-security | |
OPENSEARCH_INITIAL_ADMIN_PASSWORD: myStrongPassword123! | |
jobs: | |
cypress-tests: | |
name: Run Cypress tests | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Set up JDK | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Checkout Branch | |
uses: actions/checkout@v3 | |
- name: Set env | |
run: | | |
opensearch_version=$(node -p "require('./package.json').opensearchDashboards.version") | |
plugin_version=$(node -p "require('./package.json').version") | |
echo "OPENSEARCH_VERSION=$opensearch_version" >> $GITHUB_ENV | |
echo "PLUGIN_VERSION=$plugin_version" >> $GITHUB_ENV | |
shell: bash | |
- name: Download security plugin and create setup scripts | |
uses: ./.github/actions/download-plugin | |
with: | |
opensearch-version: ${{ env.OPENSEARCH_VERSION }} | |
plugin-name: ${{ env.PLUGIN_NAME }} | |
plugin-version: ${{ env.PLUGIN_VERSION }} | |
- name: Run Opensearch with security | |
uses: derek-ho/start-opensearch@v2 | |
with: | |
opensearch-version: ${{ env.OPENSEARCH_VERSION }} | |
plugins: "file:$(pwd)/${{ env.PLUGIN_NAME }}.zip" | |
security-enabled: true | |
admin-password: ${{ env.OPENSEARCH_INITIAL_ADMIN_PASSWORD }} | |
# Configure the Dashboard | |
- name: Configure OpenSearch Dashboards for cypress | |
run: | | |
cat << 'EOT' > cypress-opensearch-dashboards-config.yml | |
server.host: "0.0.0.0" | |
opensearch.hosts: ["https://localhost:9200"] | |
opensearch.ssl.verificationMode: none | |
opensearch.username: "kibanaserver" | |
opensearch.password: "kibanaserver" | |
opensearch.requestHeadersWhitelist: [ authorization,securitytenant ] | |
opensearch_security.multitenancy.enabled: true | |
opensearch_security.multitenancy.tenants.preferred: ["Private", "Global"] | |
opensearch_security.readonly_mode.roles: ["kibana_read_only"] | |
opensearch_security.cookie.secure: false | |
opensearch_security.multitenancy.enable_aggregation_view: true | |
EOT | |
- name: Run Dashboard with Security Dashboards Plugin | |
uses: derek-ho/setup-opensearch-dashboards@v1 | |
with: | |
plugin_name: security-dashboards-plugin | |
opensearch_dashboards_yml: cypress-opensearch-dashboards-config.yml | |
- name: Configure and Run OpenSearch Dashboards with Cypress Test Cases | |
run: | | |
cd ./OpenSearch-Dashboards | |
nohup yarn start --no-base-path --no-watch & | |
sleep 500 | |
git clone https://github.com/opensearch-project/opensearch-dashboards-functional-test.git | |
cd opensearch-dashboards-functional-test | |
npm install cypress --save-dev | |
yarn cypress:run-with-security-and-aggregation-view --browser chrome --spec "cypress/integration/plugins/security-dashboards-plugin/aggregation_view.js" | |
yarn cypress:run-with-security --browser chrome --spec "cypress/integration/plugins/security-dashboards-plugin/multi_tenancy.js" | |
yarn cypress:run-with-security --browser chrome --spec "cypress/integration/plugins/security-dashboards-plugin/default_tenant.js" |