Skip to content

Commit

Permalink
before week 3 add rooms app
Browse files Browse the repository at this point in the history
  • Loading branch information
Dierk Koenig committed Oct 2, 2024
1 parent d2cd65e commit 3d2da70
Show file tree
Hide file tree
Showing 104 changed files with 43,444 additions and 9 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
# Upload entire repository
path: './docs'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Thumbs.db
.DS_Store
.gradle
build/
target/
out/
.idea
*.iml
*.ipr
*.iws
.project
.settings
.classpath
.factorypath
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
# webec_hs24
## Grails 6.2.0 Documentation

- [User Guide](https://docs.grails.org/6.2.0/guide/index.html)
- [API Reference](https://docs.grails.org/6.2.0/api/index.html)
- [Grails Guides](https://guides.grails.org/index.html)
---

## Feature asset-pipeline-grails documentation

- [Grails Asset Pipeline Core documentation](https://www.asset-pipeline.com/manual/)

## Feature scaffolding documentation

- [Grails Scaffolding Plugin documentation](https://grails.github.io/scaffolding/latest/groovydoc/)

- [https://grails-fields-plugin.github.io/grails-fields/latest/guide/index.html](https://grails-fields-plugin.github.io/grails-fields/latest/guide/index.html)

## Feature geb documentation

- [Grails Geb Functional Testing for Grails documentation](https://github.com/grails3-plugins/geb#readme)

- [https://www.gebish.org/manual/current/](https://www.gebish.org/manual/current/)

95 changes: 95 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
plugins {
id "groovy"
id "org.grails.grails-web"
id "org.grails.grails-gsp"
id "com.github.erdi.webdriver-binaries"
id "war"
id "idea"
id "com.bertramlabs.asset-pipeline"
id "application"
id "eclipse"
}

group = "rooms"

repositories {
mavenCentral()
maven { url "https://repo.grails.org/grails/core/" }
}

configurations {
all {
resolutionStrategy.eachDependency { DependencyResolveDetails details->
if (details.requested.group == 'org.seleniumhq.selenium') {
details.useVersion('4.19.1')
}
}
}
}

dependencies {
implementation("org.grails:grails-core")
implementation("org.grails:grails-logging")
implementation("org.grails:grails-plugin-databinding")
implementation("org.grails:grails-plugin-i18n")
implementation("org.grails:grails-plugin-interceptors")
implementation("org.grails:grails-plugin-rest")
implementation("org.grails:grails-plugin-services")
implementation("org.grails:grails-plugin-url-mappings")
implementation("org.grails:grails-web-boot")
implementation("org.grails.plugins:gsp")
implementation("org.grails.plugins:hibernate5")
implementation("org.grails.plugins:scaffolding")
implementation("org.springframework.boot:spring-boot-autoconfigure")
implementation("org.springframework.boot:spring-boot-starter")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-logging")
implementation("org.springframework.boot:spring-boot-starter-tomcat")
implementation("org.springframework.boot:spring-boot-starter-validation")
compileOnly("io.micronaut:micronaut-inject-groovy")
console("org.grails:grails-console")
runtimeOnly("com.bertramlabs.plugins:asset-pipeline-grails:4.3.0")
runtimeOnly("com.h2database:h2")
runtimeOnly("org.apache.tomcat:tomcat-jdbc")
runtimeOnly("org.fusesource.jansi:jansi:1.18")
testImplementation("io.micronaut:micronaut-inject-groovy")
testImplementation("org.grails:grails-gorm-testing-support")
testImplementation("org.grails:grails-web-testing-support")
testImplementation("org.grails.plugins:geb")
// next line added
implementation group: 'org.seleniumhq.selenium', name: 'selenium-safari-driver', version: '4.25.0'
testImplementation("org.seleniumhq.selenium:selenium-api:4.19.1")
testImplementation("org.seleniumhq.selenium:selenium-remote-driver:4.19.1")
testImplementation("org.seleniumhq.selenium:selenium-support:4.19.1")
testImplementation("org.spockframework:spock-core")
testRuntimeOnly("org.seleniumhq.selenium:selenium-chrome-driver:4.19.1")
testRuntimeOnly("org.seleniumhq.selenium:selenium-firefox-driver:4.19.1")
testRuntimeOnly("org.seleniumhq.selenium:selenium-safari-driver:4.19.1")
testImplementation("io.micronaut:micronaut-http-client")

}

application {
mainClass.set("rooms.Application")
}

java {
sourceCompatibility = JavaVersion.toVersion("11")
}

tasks.withType(Test) {
useJUnitPlatform()
systemProperty "geb.env", System.getProperty('geb.env')
systemProperty "geb.build.reportsDir", reporting.file("geb/integrationTest")
systemProperty 'webdriver.chrome.driver', "${System.getenv('CHROMEWEBDRIVER')}/chromedriver"
systemProperty 'webdriver.gecko.driver', "${System.getenv('GECKOWEBDRIVER')}/geckodriver"
}
webdriverBinaries {
chromedriver '122.0.6260.0'
geckodriver '0.33.0'
edgedriver '110.0.1587.57'
}
assets {
minifyJs = true
minifyCss = true
}
9 changes: 9 additions & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
repositories {
mavenCentral()
maven { url "https://repo.grails.org/grails/core/" }
}
dependencies {
implementation("com.bertramlabs.plugins:asset-pipeline-gradle:4.3.0")
implementation("org.grails:grails-gradle-plugin:6.1.2")
implementation("org.grails.plugins:hibernate5:8.1.0")
}
20 changes: 12 additions & 8 deletions docs/week03/README-3-MVC.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,29 @@
## Assignment 1

Make sure that you have a Java JDK 17 installed and `JAVA_HOME`
set appropriately. Check by running
set appropriately. (Tested with 17.0.6-tem)
Check by running

java -version

Run the tests
Run the tests in _one_ of the following ways:

grailsw test-app
gradlew check -Dgeb.env=chrome
gradlew check -Dgeb.env=firefox
gradlew check -Dgeb.env=safari

_this will take a while to download the first time_
_this will take a while to download the first time_ and some tests might fail.
That is ok for the moment.

Run the application

grailsw run-app
gradlew bootRun

Browse to http://localhost:8080/static/Home.html .

## Assignment 2

Have a look at rooms/src/integration-test/groovy/rooms/HomeSecondSpec.groovy .
Have a look at /src/integration-test/groovy/rooms/HomeSecondSpec.groovy .

Write a test, that goes to http://www.fhnw.ch/de/
and clicks on a link with text "Standorte und Kontakt".
Expand All @@ -47,13 +51,13 @@ Validate the page title.

Have a look at
- http://localhost:8080/static/GradeCalculator.html
- /src/integration-test/groovy/rooms/CalculatorSpec.groovy (note the commented line 26)
- /src/integration-test/groovy/rooms/CalculatorSpec.groovy (note the commented line 28)
- /src/main/resources/public/GradeCalculator.html
- /grails-app/controllers/rooms/CalculatorController.groovy
- /views/calculator/CalculatorOutput.gsp (note the output placeholder)
- /src/test/groovy/rooms/CalculatorControllerSpec.groovy

Uncomment line 26 in the integration test and run `grailsw test-app`.
Uncomment line 28 in the integration test and run the tests again.

Open `/build/reports/tests/index.html` (or look at the internal test runner)
to see which test failed and why.
Expand Down
7 changes: 7 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
grailsVersion=6.2.0
grailsGradlePluginVersion=6.1.2
version=0.1
org.gradle.caching=true
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx1024M
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 3d2da70

Please sign in to comment.