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 Apr 19, 2024
1 parent c736927 commit 1adeb67
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 22 deletions.
32 changes: 16 additions & 16 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest , windows-latest ]
os: [ubuntu-latest] # Removed windows-latest
runs-on: ${{ matrix.os }}
env:
OPENSEARCH_INITIAL_ADMIN_PASSWORD: admin

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

- name: Set up JDK
uses: actions/setup-java@v1
with:
Expand All @@ -47,12 +47,12 @@ jobs:
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: 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
Expand All @@ -65,7 +65,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 @@ -97,10 +97,10 @@ jobs:
yarn test:jest_server --coverage
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 }}
# - 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 @@ -50,4 +50,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

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

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 1adeb67

Please sign in to comment.