Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
sam committed Feb 25, 2024
1 parent caa87ed commit 6aad498
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 15 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/ci-test4.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Integration and Functional tests

on:
pull_request:
branches:
- master
- staging
- dev

jobs:
setup:
runs-on: ubuntu-22.04
strategy:
fail-fast: true
matrix:
php-versions: ['7.4']
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Cypress dependencies
run: sudo apt update && sudo apt-get install -y xvfb libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libnss3 libxss1 libasound2 libxtst6 xauth

# RUN CYPRESS TESTS ----------------
- name: Run Cypress keycloak tests
uses: cypress-io/github-action@v6
with:
start: npx http-server -p 8000 -c-1
command: npm run cy:test:oidc
env:
CYPRESS_BASE_URL: http://localhost:8000
CYPRESS_KEYCLOAK_URL: http://localhost:8080


33 changes: 20 additions & 13 deletions cypress/e2e/keycloak/admin/admin1_can_login.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,26 @@ Cypress.on('uncaught:exception', (err, runnable) => {
describe('admin1 can login', function () {
it('admin story', function () {

login(keycloakUrl, "admin1", "password")

cy.log('home page banner contains "admin"')
cy.get('[data-cy=home_welcome_message]').contains('admin')

cy.log('go to settings page')
cy.get('[data-cy=settings_link]').click()

cy.log('display informations')
cy.get('[data-cy=open_my_informations]').click()

cy.log('check if role_admin in the page')
cy.get('[data-cy=user_roles_container]').contains('ROLE_ADMIN', {timeout: 2000})
cy.visit("/")
cy.get('#login').click()

cy.origin(keycloakUrl, () => {
cy.get('#username').type('test', {force: true})
})

// login(keycloakUrl, "admin1", "password")
//
// cy.log('home page banner contains "admin"')
// cy.get('[data-cy=home_welcome_message]').contains('admin')
//
// cy.log('go to settings page')
// cy.get('[data-cy=settings_link]').click()
//
// cy.log('display informations')
// cy.get('[data-cy=open_my_informations]').click()
//
// cy.log('check if role_admin in the page')
// cy.get('[data-cy=user_roles_container]').contains('ROLE_ADMIN', {timeout: 2000})

})
})
3 changes: 1 addition & 2 deletions cypress/e2e/keycloak/keycloak_reusables.cytools.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ export function login(keycloakUrl, username, password) {

cy.visit("/")
cy.get('#login').click()
console.log(Cypress.config());
console.log(Cypress.env());

cy.origin(keycloakUrl, { args : { username, password }}, ({ username, password }) => {
cy.log("fill in the login form")
cy.get('#username').type(username, {force: true})
Expand Down

0 comments on commit 6aad498

Please sign in to comment.