Fix CI ? + Skip in LoginWithOIDC

fflorent 3 months ago
parent 63f05e5fd0
commit 1dedcc16fd

@ -97,12 +97,12 @@ jobs:
uses: carlosthe19916/keycloak-action@0.4
if: contains(matrix.tests, ':keycloak:')
with:
server: http://localhost:8080/auth
server: http://keycloak:8080/auth
username: admin
password: admin
kcadm: |
create realms -f ${{ github.workspace }}/.github/workflows/import_keycloak/grist-realms.json
create users -f ${{ github.workspace }}/.github/workflows/import_keycloak/grist-users-0.json
create realms -f .github/workflows/import_keycloak/grist-realm.json
create users -f .github/workflows/import_keycloak/grist-users-0.json
- name: Run server tests with minio and redis
if: contains(matrix.tests, ':server-')
@ -186,14 +186,17 @@ jobs:
--health-timeout 5s
--health-retries 5
keycloak:
# image: fflorent/keycloak-with-import-realm:latest # Image with overridden entrypoint.
image: quay.io/keycloak/keycloak
ports:
- 8080:8080
env:
KEYCLOAK_ADMIN: admin
KEYCLOAK_ADMIN_PASSWORD: admin
options: >-
--health-cmd "curl --fail http://localhost:8080/auth || exit 1"
--health-interval 10s
--health-timeout 5s
--health-retries 5
candidate:
needs: build_and_test
if: ${{ success() && github.event_name == 'push' }}

@ -3,38 +3,40 @@ import { driver } from 'mocha-webdriver';
import * as gu from 'test/nbrowser/gristUtils';
import { server, setupTestSuite } from 'test/nbrowser/testUtils';
describe('LoginWithOIDC', function() {
describe('IntegrationWithKeycloak', function() {
before(function() {
if (!process.env.GRIST_OIDC_SP_HOST) {
return this.skip();
}
});
this.timeout(60000);
setupTestSuite();
gu.withEnvironmentSnapshot({
get 'GRIST_OIDC_SP_HOST'() { return server.getHost(); },
'GRIST_TEST_LOGIN': 0,
});
describe('LoginWithOIDC', function() {
this.timeout(60000);
setupTestSuite();
gu.withEnvironmentSnapshot({
get 'GRIST_OIDC_SP_HOST'() { return server.getHost(); },
'GRIST_TEST_LOGIN': 0,
});
it('should login using OIDC', async () => {
await driver.get(`${server.getHost()}/o/docs/login`);
await driver.findWait('#kc-form-login', 10_000);
await driver.find('#username').sendKeys('keycloakuser');
await driver.find('#password').sendKeys('keycloakpassword');
await driver.find('#kc-login').click();
it('should login using OIDC', async () => {
await driver.get(`${server.getHost()}/o/docs/login`);
await driver.findWait('#kc-form-login', 10_000);
await driver.find('#username').sendKeys('keycloakuser');
await driver.find('#password').sendKeys('keycloakpassword');
await driver.find('#kc-login').click();
await driver.wait(
async () => {
const url = await driver.getCurrentUrl();
return url.startsWith(server.getHost());
},
20_000
);
await gu.openAccountMenu();
assert.equal(await driver.find('.test-usermenu-name').getText(), 'Keycloak User');
assert.equal(await driver.find('.test-usermenu-email').getText(), 'keycloakuser@example.com');
await driver.find('.test-dm-log-out').click();
await driver.findContentWait('.test-error-header', /Signed out/, 20_000, 'Should be signed out');
await driver.wait(
async () => {
const url = await driver.getCurrentUrl();
return url.startsWith(server.getHost());
},
20_000
);
await gu.openAccountMenu();
assert.equal(await driver.find('.test-usermenu-name').getText(), 'Keycloak User');
assert.equal(await driver.find('.test-usermenu-email').getText(), 'keycloakuser@example.com');
await driver.find('.test-dm-log-out').click();
await driver.findContentWait('.test-error-header', /Signed out/, 20_000, 'Should be signed out');
});
});
});

Loading…
Cancel
Save