Skip to content

Commit

Permalink
Fix repository tests (#46)
Browse files Browse the repository at this point in the history
* Initial commit

* Removed Windows and Mac tests

* Fix oidc test

* Fix SAML test
  • Loading branch information
Tostti authored and yenienserrano committed Jun 18, 2024
1 parent d354689 commit 0ff8ba2
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 18 deletions.
41 changes: 29 additions & 12 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest , windows-latest ]
os: [ubuntu-latest] # Removed windows-latest
runs-on: ${{ matrix.os }}

steps:
- name: Checkout Branch
uses: actions/checkout@v3

- name: Set up JDK
uses: actions/setup-java@v1
with:
Expand All @@ -34,7 +34,25 @@ jobs:
echo "PLUGIN_VERSION=$plugin_version" >> $GITHUB_ENV
shell: bash

- name: Download security plugin and create setup scripts for remote cluster
- uses: browser-actions/[email protected]
- run: geckodriver --version

- name: Set up Firefox browser
if: ${{ runner.os == 'Linux' }}
uses: browser-actions/setup-firefox@v1

- run: firefox --version
if: ${{ runner.os == 'Linux' }}

# Browser-action version does not work on Windows
# - name: Set up Firefox browser for Windows
# if: ${{ runner.os == 'Windows' }}
# uses: RyanL1997/setup-browser@main
# with:
# browser: firefox
# version: latest

- name: Download security plugin and create setup scripts
uses: ./.github/actions/download-plugin
with:
opensearch-version: ${{ env.OPENSEARCH_VERSION }}
Expand Down Expand Up @@ -69,7 +87,7 @@ jobs:
uses: derek-ho/start-opensearch@v2
with:
opensearch-version: ${{ env.OPENSEARCH_VERSION }}
plugins: "file:$(pwd)/${{ env.PLUGIN_NAME }}.zip"
plugins: 'file:$(pwd)/${{ env.PLUGIN_NAME }}.zip'
security-enabled: true
admin-password: ${{ env.OPENSEARCH_INITIAL_ADMIN_PASSWORD }}

Expand Down Expand Up @@ -102,11 +120,10 @@ jobs:
shell: bash
working-directory: ${{ steps.install-dashboards.outputs.plugin-directory }}

- name: Run integration tests on Windows
if: ${{ runner.os == 'Windows' }}
run: |
echo "check if opensearch is ready"
curl -XGET https://localhost:9200 -u 'admin:${{ env.OPENSEARCH_INITIAL_ADMIN_PASSWORD }}' -k
export ADMIN_PASSWORD=${{ env.OPENSEARCH_INITIAL_ADMIN_PASSWORD }} && node ./test/run_jest_tests.js --runInBand --detectOpenHandles --forceExit --config ./test/jest.config.server.js
shell: bash
working-directory: ${{ steps.install-dashboards.outputs.plugin-directory }}
# - name: Run integration tests on Windows
# if: ${{ runner.os == 'Windows' }}
# run: |
# echo "check if opensearch is ready"
# curl -XGET https://localhost:9200 -u 'admin:${{ env.OPENSEARCH_INITIAL_ADMIN_PASSWORD }}' -k
# node .\test\run_jest_tests.js --runInBand --detectOpenHandles --forceExit --config .\test\jest.config.server.js
# working-directory: ${{ steps.install-dashboards.outputs.plugin-directory }}
10 changes: 5 additions & 5 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
name: Unit Tests

on: [ push, pull_request ]
on: [push, pull_request]

jobs:
unit-tests:
name: Run unit tests
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest] # Removed windows-latest, macos-latest
runs-on: ${{ matrix.os }}

steps:
- name: Enable longer filenames
if: ${{ matrix.os == 'windows-latest' }}
run: git config --system core.longpaths true
# - name: Enable longer filenames
# if: ${{ matrix.os == 'windows-latest' }}
# run: git config --system core.longpaths true

- name: Checkout Branch
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@
"glob-parent": "^5.1.2",
"debug": "^4.3.4"
}
}
}
3 changes: 3 additions & 0 deletions test/cypress/e2e/oidc/oidc_auth_test.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ describe('Log in via OIDC', () => {
});

localStorage.setItem('home:newThemeModal:show', 'false');
cy.get('#user-icon-btn').should('be.visible');
cy.get('#user-icon-btn').click();
cy.get('button[data-test-subj^="switch-tenants"]').click();

cy.get('#private').should('be.enabled');
cy.get('#private').click({ force: true });

Check warning on line 113 in test/cypress/e2e/oidc/oidc_auth_test.spec.js

View workflow job for this annotation

GitHub Actions / Run unit tests (ubuntu-latest)

Do not use force on click and type calls

Check warning on line 113 in test/cypress/e2e/oidc/oidc_auth_test.spec.js

View workflow job for this annotation

GitHub Actions / Run unit tests (ubuntu-latest)

Do not use force on click and type calls
Expand Down
3 changes: 3 additions & 0 deletions test/cypress/e2e/saml/saml_auth_test.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ describe('Log in via SAML', () => {
});

samlLogin();
cy.get('#user-icon-btn').should('be.visible');
cy.get('#user-icon-btn').click();
cy.get('button[data-test-subj^="switch-tenants"]').click();

cy.get('#private').should('be.enabled');
cy.get('#private').click({ force: true });

Check warning on line 108 in test/cypress/e2e/saml/saml_auth_test.spec.js

View workflow job for this annotation

GitHub Actions / Run unit tests (ubuntu-latest)

Do not use force on click and type calls

Check warning on line 108 in test/cypress/e2e/saml/saml_auth_test.spec.js

View workflow job for this annotation

GitHub Actions / Run unit tests (ubuntu-latest)

Do not use force on click and type calls
Expand Down

0 comments on commit 0ff8ba2

Please sign in to comment.