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

Feature/cypress refactor and example usertask #1731

Merged
merged 28 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5f53fd3
digiwf-cypress update README.md
simonhir May 28, 2024
d0b849a
digiwf-cypress add cypress-keycloak dependency
simonhir May 28, 2024
d89e7b1
digiwf-cypress rm old tests
simonhir May 28, 2024
90239e6
digiwf-cypress refactor pages structure
simonhir May 28, 2024
211cba5
digiwf-cypress init example usertask test
simonhir May 28, 2024
0042673
digiwf-cypress refactor methods name english
simonhir May 28, 2024
ecc215b
digiwf-cypress update config and add dotenv
simonhir May 29, 2024
cce337a
digiwf-cypress dotenv fix existing var not overwritten
simonhir May 29, 2024
a3dc262
digiwf-cypress upgrade dependencies
simonhir May 29, 2024
b3c153f
Merge branch 'refs/heads/dev' into feature/cypress-refactor-and-examp…
simonhir May 29, 2024
25ad701
digiwf-cypress make cypress-keycloak prod dependency
simonhir May 29, 2024
35e3afb
digiwf-cypress workaround compliance ci mv all deps to dev
simonhir May 29, 2024
535ae22
digiwf-cypress revert dependencies to old state
simonhir May 29, 2024
c9274ae
digiwf-cypress workaround compliance ci mv all deps to dev
simonhir May 29, 2024
fd1e859
digiwf-cypress mv login logic to new cmd
simonhir May 29, 2024
7e40e92
digiwf-cypress use global interceptor configs
simonhir May 29, 2024
6883ca8
digiwf-cypress update README.md
simonhir May 31, 2024
4a535a9
fix local tasklist behind gateway
simonhir May 31, 2024
6711415
digiwf-cypress cleanup selectors
simonhir May 31, 2024
550cf12
digiwf-cypress update README.md
simonhir Jun 3, 2024
47a919c
digiwf-cypress improve structure and selectors
simonhir Jun 3, 2024
f85f767
digiwf-cypress refactor wait no uncompleted tasks
simonhir Jun 3, 2024
b8131ae
digiwf-cypress fix naming
simonhir Jun 3, 2024
fce7ad8
digiwf-cypress nav use custom selectors
simonhir Jun 3, 2024
9d27bd3
digiwf-cypress refactor wait no uncompleted tasks
simonhir Jun 3, 2024
2f0f2f8
digiwf-cypress refactor my tasks to v-list
simonhir Jun 3, 2024
2dfb229
digiwf-cypress update README.md
simonhir Jun 3, 2024
f46d21c
digiwf-cypress load .env.local by default
simonhir Jun 3, 2024
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
1 change: 1 addition & 0 deletions digiwf-apps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"serve": "npm run build && lerna run dev --stream --parallel",
"serve:forms": "lerna run dev --stream --scope=@muenchen/digiwf-forms-example",
"serve:tasklist": "lerna run dev --stream --scope=@muenchen/digiwf-tasklist",
"preview:tasklist": "lerna run preview --stream --scope=@muenchen/digiwf-tasklist",
"serve:webcomponent": "lerna run dev --stream --scope=@muenchen/digiwf-webcomponent",
"serve:all": "lerna run dev --stream --parallel",
"test": "lerna run test",
Expand Down
1 change: 1 addition & 0 deletions digiwf-apps/packages/apps/digiwf-tasklist/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview --host",
"test": "jest src --coverage",
"prettier": "prettier src --write --ignore-path ./legacy-ignore.prettierignore"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
<template>
<v-row
class="ma-1 mt-3"
align="center"
class="ma-1 mt-3"
data-test="pagination-footer"
justify="center"
>
<span>Seitengröße</span>
<v-menu offset-y>
<v-menu
offset-y
>
<template #activator="{ on, attrs }">
<v-btn
text
outlined
color="primary"
class="ml-2 pa-1"
color="primary"
data-test="pagination-page-size-btn"
outlined
text
v-bind="attrs"
v-on="on"
>
<span class="mr-1">{{ size }}</span>
<v-icon>mdi-chevron-down</v-icon>
</v-btn>
</template>
<v-list>
<v-list data-test="pagination-page-select">
<v-list-item
v-for="(number, index) in itemsPerPageArray"
:key="index"
Expand All @@ -32,46 +36,54 @@
</v-list>
</v-menu>
<v-spacer />
<span class="mr-1">{{ totalNumberOfItems }} {{ foundDataText }} </span>
<span
class="mr-1"
data-test="pagination-item-count"
>{{ totalNumberOfItems }} {{ foundDataText }}</span>
<v-spacer />

<span class="mr-4"> Seite {{ page }} von {{ numberOfPages }} </span>
<span
class="mr-4"
data-test="pagination-page-index"
>Seite {{ page }} von {{ numberOfPages }}</span>
<v-tooltip
top
open-delay="700"
top
>
<template #activator="{ on, attrs }">
<v-btn
:disabled="lastPageButtonDisabled"
aria-label="Vorherige Seite"
class="mr-1"
color="primary"
data-test="pagination-previous-page"
small
text
color="primary"
class="mr-1"
v-bind="attrs"
v-on="on"
@click="lastPage"
v-on="on"
>
<v-icon>mdi-chevron-left</v-icon>
</v-btn>
</template>
<span>Vorherige Seite</span>
</v-tooltip>
<v-tooltip
top
open-delay="700"
top
>
<template #activator="{ on, attrs }">
<v-btn
small
text
:disabled="nextPageButtonDisabled"
aria-label="Nächste Seite"
color="primary"
class="ml-1"
color="primary"
data-test="pagination-next-page"
small
text
v-bind="attrs"
v-on="on"
@click="nextPage"
v-on="on"
>
<v-icon>mdi-chevron-right</v-icon>
</v-btn>
Expand All @@ -82,22 +94,22 @@
</template>

<script lang="ts">
import { defineComponent } from "vue";
import {defineComponent} from "vue";

export default defineComponent({
components: {},
props: {
numberOfPages: { type: Number, required: true },
totalNumberOfItems: { type: Number, required: true },
page: { type: Number, required: true },
size: { type: Number, required: true },
foundDataText: { type: String, required: true },
nextPageButtonDisabled: { type: Boolean, required: true },
lastPageButtonDisabled: { type: Boolean, required: true },
updateItemsPerPage: { type: Function, required: true },
nextPage: { type: Function, required: true },
lastPage: { type: Function, required: true },
numberOfPages: {type: Number, required: true},
totalNumberOfItems: {type: Number, required: true},
page: {type: Number, required: true},
size: {type: Number, required: true},
foundDataText: {type: String, required: true},
nextPageButtonDisabled: {type: Boolean, required: true},
lastPageButtonDisabled: {type: Boolean, required: true},
updateItemsPerPage: {type: Function, required: true},
nextPage: {type: Function, required: true},
lastPage: {type: Function, required: true},
},
components: {},
setup() {
return {
itemsPerPageArray: [5, 10, 20],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
<template>
<!-- input.native to prevent this issue: https://github.com/vuetifyjs/vuetify/issues/4679 -->
<v-combobox
id="suchfeld"
class="searchField"
:items="persistentFilters?.map((f) => f.filterString) || []"
:value="syncedFilter"
data-cy="search-field"
aria-label="Aufgaben durchsuchen"
class="searchField"
clearable
color="black"
flat
data-test="search-field"
dense
outlined
flat
hide-details
:items="persistentFilters?.map((f) => f.filterString) || []"
aria-label="Aufgaben durchsuchen"
label="Aufgaben durchsuchen"
clearable
outlined
style="max-width: 500px"
@change="changeFilter"
@input.native="(e) => changeFilter(e.target.value)"
Expand All @@ -22,42 +21,42 @@
<div class="v-input__icon">
<v-btn
v-if="isFilterPersistent()"
icon
aria-label="Filter löschen"
class="v-icon"
icon
@click="deletePersistentFilter()"
>
<v-icon
color="primary"
aria-hidden="false"
aria-label="Filter löschen"
color="primary"
role="img"
aria-hidden="false"
>
mdi-star
</v-icon>
</v-btn>
<v-btn
v-else-if="showSaveBtn()"
icon
aria-label="Filter speichern"
class="v-icon"
icon
@click="savePersistentFilter()"
>
<v-icon
color="primary"
aria-hidden="false"
aria-label="Filter speichern"
color="primary"
role="img"
aria-hidden="false"
>
mdi-star-outline
</v-icon>
</v-btn>
</div>
<v-icon
class="ml-2"
aria-hidden="false"
aria-label="Aufgaben durchsuchen"
class="ml-2"
role="img"
aria-hidden="false"
>
mdi-magnify
</v-icon>
Expand All @@ -66,13 +65,13 @@
</template>

<script lang="ts">
import { FilterTO, SaveFilterTO } from "@muenchen/digiwf-engine-api-internal";
import {FilterTO, SaveFilterTO} from "@muenchen/digiwf-engine-api-internal";
import debounce from "debounce";
import { defineComponent, ref } from "vue";
import {defineComponent, ref} from "vue";

import { SEARCH_DEBOUNCE_INTERVAL } from "../../constants";
import { usePageId } from "../../middleware/pageId";
import { useGetPaginationData } from "../../middleware/paginationData";
import {SEARCH_DEBOUNCE_INTERVAL} from "../../constants";
import {usePageId} from "../../middleware/pageId";
import {useGetPaginationData} from "../../middleware/paginationData";
import {
useDeletePersistentFilters,
useGetPersistentFilters,
Expand All @@ -87,7 +86,7 @@ export default defineComponent({
},
},
setup(props) {
const { getSearchQueryOfUrl } = useGetPaginationData();
const {getSearchQueryOfUrl} = useGetPaginationData();
const searchQuery = ref<string>(getSearchQueryOfUrl() || "");
const pageId = usePageId();

Expand Down
7 changes: 7 additions & 0 deletions digiwf-cypress/.env.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
BASE_URL="http://localhost:8083"
SSO_URL="http://keycloak:8080"
SSO_REALM="P82"
SSO_CLIENT="digitalwfv2"
SSO_USERNAME="johndoe"
SSO_PASSWORD="test"
USER_REALNAME="John Doe"
darenegade marked this conversation as resolved.
Show resolved Hide resolved
19 changes: 13 additions & 6 deletions digiwf-cypress/readme.md → digiwf-cypress/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,31 @@
## Getting started

Download and install run:

```BASH
cd digiwf-cypress
npm install
```

For further information see: https://docs.cypress.io/guides/getting-started/installing-cypress
It is important to use cypress in the digiwf-cypress folder.
It is important to use cypress in the `digiwf-cypress` folder.

## Run a cypress test

Navigate to the digiwf-cypress folder in the bash and run:
Navigate to the `digiwf-cypress` folder in the bash and run:

```bash
cd digiwf-cypress
# set proxy (remote env) or unset proxy (local) via env variables if needed
# setup .env file or needed env variables
simonhir marked this conversation as resolved.
Show resolved Hide resolved
npx cypress run # a) to run all the tests
npx cypress open # b) to open the cypress app and run each test separate
```
a) There will be a test summary in the end in the bash and the produced videos and test reports in the
digiwf-cypress/output folder.

b) The test with the test steps is shown in the Cypress App. The test will restart if elements
in the cypress test are changed and the results from the run before will be lost.
a) There will be a test summary in the end in the bash and the produced videos and test reports in the
digiwf-cypress/output folder.

b) The test with the test steps is shown in the Cypress App. The test will restart if elements
in the cypress test are changed and the results from the run before will be lost.
The test steps can be analysed by clicking in the corresponding line. The test flow is well comprehensible visible.

60 changes: 32 additions & 28 deletions digiwf-cypress/cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,36 @@
const { defineConfig } = require("cypress");
const {defineConfig} = require("cypress");

require('dotenv').config()

simonhir marked this conversation as resolved.
Show resolved Hide resolved
module.exports = defineConfig({
viewportHeight: 1200,
viewportWidth: 2000,
//pageLoadTimeout: 300000,
videosFolder: "output/videos",
reporter: "cypress-multi-reporters",
reporterOptions: {
reporterEnabled: "mochawesome",
mochawesomeReporterOptions: {
reportDir: "output/reports/mocha",
quite: true,
overwrite: false,
html: false,
json: true
}
},
env: {
username: "johndoe",
fullUsername: "John Doe",
password: "test",
home: "localhost:8083/",
groupName1: "group1"
},
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
viewportHeight: 1200,
viewportWidth: 2000,
defaultCommandTimeout: 10000,
videosFolder: "output/videos",
reporter: "cypress-multi-reporters",
reporterOptions: {
reporterEnabled: "mochawesome",
mochawesomeReporterOptions: {
reportDir: "output/reports/mocha",
quite: true,
overwrite: false,
html: false,
json: true
}
},
env: {
sso_url: process.env.SSO_URL,
sso_realm: process.env.SSO_REALM,
sso_client: process.env.SSO_CLIENT,
username: process.env.SSO_USERNAME,
password: process.env.SSO_PASSWORD,
realname: process.env.USER_REALNAME
},
e2e: {
baseUrl: process.env.BASE_URL,
setupNodeEvents(on, config) {
// implement node event listeners here
},
},
},
chromeWebSecurity:false
chromeWebSecurity: false
});
Loading
Loading