Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

240 azure oauth2 #254

Open
wants to merge 35 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
2157721
#240 use azure AD
Jul 4, 2023
793e7d2
#240 working state but some bugs
Jul 4, 2023
4d7595f
#240 bugfixes
Jul 7, 2023
07045d4
#240 csrf fix
Jul 8, 2023
8e9dd1c
#240 clean up
Jul 8, 2023
5d9a51a
#240 profile
Jul 11, 2023
7e3abae
#240 disable csrf
Jul 11, 2023
ebc0f7e
#240 spring to 2.7.4
Jul 13, 2023
1d309a9
#240 fixing redirect to login
Jul 25, 2023
55114b0
#240 fixing Circular viewpath exception
Aug 31, 2023
cc2db17
#240 fix exclude
Aug 31, 2023
21db42e
#240 fix auth user at session scope
Sep 25, 2023
6719de9
#240 logging
Sep 28, 2023
5621d90
#240 error-handling & Save icon
Sep 28, 2023
bf34fbd
#240 error-handling
Sep 28, 2023
a1d77a2
Add or update the App Service deployment workflow configuration from …
youseeus Sep 28, 2023
db22554
#240 try to get a CI-Pipeline
Sep 28, 2023
56a2f22
#240 fix save report
Sep 28, 2023
e348b48
#240 fix save report
Sep 28, 2023
e1729e1
#240 try to get a CI-Pipeline
Sep 28, 2023
9ee6276
#240 try to get a CI-Pipeline
Sep 28, 2023
2c5986d
#240 remove Password-change
Nov 1, 2023
6088fe3
e2e-tests
Nov 1, 2023
3146afb
e2e-tests
Nov 3, 2023
559df91
e2e-tests
Nov 3, 2023
a97862f
e2e-tests
Nov 3, 2023
4900250
e2e-tests
Nov 4, 2023
2f9c908
e2e-tests
Nov 4, 2023
d548cbb
e2e-tests
Nov 6, 2023
379a6b6
e2e-tests playwright java
Nov 6, 2023
41a1111
#240 change to Spring-oauth2
Nov 9, 2023
e167203
#240 fix save part 1
Nov 10, 2023
4aa5f0a
#240 Workaround for the inability of struts to take 'form' attributes
Nov 14, 2023
c1b66cc
#240 e2eTest-Configuration
Nov 20, 2023
acc9c62
#240 cors
Nov 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/build-war-and-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,8 @@ jobs:
src: ghcr.io/hbtgmbh/salat:ci
dst: |
${{ steps.meta.outputs.tags }}

# - name: 'Run Azure webapp deploy action using publish profile credentials'
# uses: azure/webapps-deploy@v2
# with:
# app-name: salat-test
# publish-profile: ${{ secrets.azureWebAppPublishProfile }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@
/tb/target/
/.java-version
/.jpb/
/src/e2e/**/node_modules/
/src/e2e/cypress/node_modules/
13 changes: 13 additions & 0 deletions .run/SalatApplication test.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="SalatApplication test" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<option name="ACTIVE_PROFILES" value="e2etest" />
<module name="tb" />
<selectedOptions>
<option name="environmentVariables" />
</selectedOptions>
<option name="SPRING_BOOT_MAIN_CLASS" value="org.tb.SalatApplication" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
20 changes: 20 additions & 0 deletions docker-compose.e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: "3.9" # optional since v1.27.0
services:
salat:
image: docker.io/hbt/salat:latest
ports:
- "8080:8080"
- "8000:8000"
environment:
SPRING_DATASOURCE_USERNAME: salattest
SPRING_DATASOURCE_PASSWORD: salattest
SPRING_DATASOURCE_URL: jdbc:mysql://db:3306/salat?useUnicode=true&useJDBCCompliantTimezoneShift=true&serverTimezone=Europe/Berlin&useLegacyDatetimeCode=false
JPDA_ADDRESS: "*:8000"
depends_on:
- db

db:
build: ./testdb
ports:
- "3306:3306" # not necessary, only so we can access the db from host computer.
command: --lower_case_table_names=1
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ version: "3.9" # optional since v1.27.0
services:
salat:
image: docker.io/hbt/salat:latest
build: src/main/
ports:
- "8080:8080"
- "8000:8000"
Expand Down
44 changes: 35 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.4</version>
<version>2.7.8</version>

<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>de.hbt.salat</groupId>
Expand All @@ -27,12 +28,21 @@
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<artifactId>spring-boot-starter-oauth2-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.azure.spring</groupId>-->
<!-- <artifactId>spring-cloud-azure-starter-active-directory</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
Expand All @@ -48,11 +58,6 @@
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
Expand Down Expand Up @@ -82,6 +87,11 @@
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
Expand Down Expand Up @@ -195,6 +205,12 @@
<version>2.11.0</version>
</dependency>

<dependency>
<groupId>com.microsoft.playwright</groupId>
<artifactId>playwright</artifactId>
<version>1.39.0</version>
</dependency>

<!-- web jars -->
<dependency>
<groupId>org.webjars</groupId>
Expand All @@ -219,7 +235,7 @@
<dependency>
<groupId>org.webjars.npm</groupId>
<artifactId>bootstrap-icons</artifactId>
<version>1.10.3</version>
<version>1.11.1</version>
</dependency>

</dependencies>
Expand Down Expand Up @@ -270,6 +286,16 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<!-- References to interface static methods are allowed only at source level 1.8 or above -->
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
16 changes: 16 additions & 0 deletions src/e2e/cypress/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# e2e-Test
## Vorbereitung
* `$ npm install`
* DB Starten: `$ docker-compose -f .\docker-compose-infra.yml up` (im Project root)
* Salat mit Profil 'test' starten (die Authentifizierung wird deaktiviert)
* [runConfiguration](../../.run/SalatApplication test.run.xml)

## Ausführung
* `$ cypress run`

## Entwicklung von Tests
* `$ cypress open`
* -> E2E Testing
* -> Browser auswählen
* -> spec auswählen

11 changes: 11 additions & 0 deletions src/e2e/cypress/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {defineConfig} from "cypress";

export default defineConfig({
e2e: {
baseUrl: 'http://localhost:8080',
experimentalModifyObstructiveThirdPartyCode: true,
env: {
},
},
chromeWebSecurity: false,
});
54 changes: 54 additions & 0 deletions src/e2e/cypress/cypress/e2e/basic.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
describe('template spec', () => {
// beforeEach(() => {
// cy.origin(`https://login.microsoftonline.com/`, () => {
// cy.visit('/');
// cy.get('[type="email"]').type(`${Cypress.env('aad_username')}{enter}`);
// cy.get('[type="password"]').type(`${Cypress.env('aad_password')}{enter}`);
// cy.get('[type="submit"]').type('{enter}');
// });
// })

it('call ', () => {
Cypress.on('uncaught:exception', (err, runnable) => {
// returning false here prevents Cypress from
// failing the test
return false
})
cy.visit(
{
method: 'GET',
url: '/do/ShowDailyReport',
headers: {
'user': 'tt'
}
})
})
})

it('create report ', () => {
Cypress.on('uncaught:exception', (err, runnable) => {
// returning false here prevents Cypress from
// failing the test
return false
})
cy.visit(
{
method: 'GET',
url: '/do/ShowDailyReport',
headers: {
'user': 'tt'
}
})
const timestamp = Date.now();
cy.get('.createnewreport').click();
cy.url().should('contains', '/do/CreateDailyReport');
cy.get('tr:nth-child(6) select:nth-child(1)').select('01');
cy.url().should('contains', '/do/StoreDailyReport');
cy.get('textarea').click();
cy.get('textarea').type('test:'+timestamp);
cy.get('[name="save"]').click();
cy.get('[name="comment"]').last().should('have.text', 'test:'+timestamp);
cy.get('.timereports tr.timereport .function-delete').last().click();
cy.get('[name="comment"]').last().should('not.have.text', 'test:'+timestamp);

})
5 changes: 5 additions & 0 deletions src/e2e/cypress/cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "[email protected]",
"body": "Fixtures are a great way to mock data for responses to routes"
}
27 changes: 27 additions & 0 deletions src/e2e/cypress/cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/// <reference types="cypress" />
// ***********************************************
// This example commands.ts shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
//
21 changes: 21 additions & 0 deletions src/e2e/cypress/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// ***********************************************************
// This example support/e2e.ts is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')

Loading
Loading