Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
verona-modules-aspect
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IQB
verona-modules-aspect
Commits
caea6568
Commit
caea6568
authored
1 year ago
by
rhenck
Browse files
Options
Downloads
Patches
Plain Diff
[e2e] Add Dropdown tests
parent
c5edf6d9
No related branches found
No related tags found
No related merge requests found
Pipeline
#55807
passed
1 year ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
e2e/tests/e2e/dropdown.spec.cy.ts
+72
-0
72 additions, 0 deletions
e2e/tests/e2e/dropdown.spec.cy.ts
e2e/tests/helper-functions.ts
+22
-0
22 additions, 0 deletions
e2e/tests/helper-functions.ts
with
94 additions
and
0 deletions
e2e/tests/e2e/dropdown.spec.cy.ts
0 → 100644
+
72
−
0
View file @
caea6568
import
{
addOption
,
addPostMessageStub
,
assertValueChanged
,
setCheckbox
,
setLabelText
}
from
'
../helper-functions
'
;
describe
(
'
Dropdown element
'
,
{
testIsolation
:
false
},
()
=>
{
it
(
'
creates basic dropdown with 2 options
'
,
()
=>
{
cy
.
openEditor
();
cy
.
contains
(
'
Klappliste
'
).
click
();
setLabelText
(
'
Klappliste mit Optionen
'
);
addOption
(
'
AAA
'
);
addOption
(
'
BBB
'
);
});
it
(
'
creates dropdown with preset value and allowed deselection
'
,
()
=>
{
cy
.
contains
(
'
Klappliste
'
).
click
();
setLabelText
(
'
Klappliste-deselection
'
);
addOption
(
'
AAA
'
);
addOption
(
'
BBB
'
);
cy
.
get
(
'
aspect-element-properties
'
).
contains
(
'
mat-form-field
'
,
'
Vorbelegung
'
)
.
find
(
'
mat-select
'
).
click
();
cy
.
get
(
'
.cdk-overlay-container
'
).
contains
(
'
AAA
'
).
click
();
setCheckbox
(
'
Deselektion erlauben
'
);
});
it
(
'
saves unit definition
'
,
()
=>
{
cy
.
saveUnit
(
'
e2e/downloads/dropdown.json
'
);
});
// ### PLAYER ####
it
(
'
passes some basic checks
'
,
()
=>
{
cy
.
openPlayer
();
cy
.
loadUnit
(
'
../downloads/dropdown.json
'
);
cy
.
contains
(
'
Dropdown-not-existing
'
).
should
(
'
not.exist
'
);
cy
.
get
(
'
aspect-dropdown
'
).
should
(
'
have.length
'
,
2
);
cy
.
contains
(
'
aspect-dropdown
'
,
'
Klappliste mit Optionen
'
).
should
(
'
exist
'
);
});
it
(
'
selects an option
'
,
()
=>
{
addPostMessageStub
();
cy
.
contains
(
'
aspect-dropdown
'
,
'
Klappliste mit Optionen
'
).
should
(
'
exist
'
);
cy
.
contains
(
'
div
'
,
'
Klappliste mit Optionen
'
).
find
(
'
mat-select
'
).
click
();
cy
.
get
(
'
.cdk-overlay-container
'
).
contains
(
'
BBB
'
).
click
();
cy
.
contains
(
'
aspect-dropdown
'
,
'
Klappliste mit Optionen
'
)
.
find
(
'
mat-select
'
)
.
find
(
'
mat-select-trigger
'
)
.
should
(
'
have.text
'
,
'
BBB
'
);
assertValueChanged
(
'
dropdown_1
'
,
2
);
});
it
(
'
deselects a preset option
'
,
()
=>
{
cy
.
contains
(
'
aspect-dropdown
'
,
'
Klappliste-deselection
'
)
.
find
(
'
mat-select
'
)
.
find
(
'
mat-select-trigger
'
)
.
should
(
'
have.text
'
,
'
AAA
'
);
cy
.
contains
(
'
div
'
,
'
Klappliste-deselection
'
).
find
(
'
mat-select
'
).
click
();
cy
.
get
(
'
.cdk-overlay-container
'
)
.
find
(
'
mat-option
'
)
.
first
()
.
click
();
cy
.
contains
(
'
aspect-dropdown
'
,
'
Klappliste-deselection
'
)
.
find
(
'
mat-select
'
)
.
find
(
'
mat-select-trigger
'
)
.
should
(
'
not.exist
'
);
});
});
This diff is collapsed.
Click to expand it.
e2e/tests/helper-functions.ts
+
22
−
0
View file @
caea6568
...
...
@@ -11,6 +11,28 @@ export function selectFromDropdown(dropdownName: string, optionName: string) {
cy
.
get
(
'
.cdk-overlay-container
'
).
contains
(
optionName
).
click
();
}
export
function
addOption
(
optionName
:
string
):
void
{
cy
.
contains
(
'
fieldset
'
,
'
Optionen
'
)
.
contains
(
'
mat-form-field
'
,
'
Neue Option
'
)
.
find
(
'
input
'
)
.
clear
()
.
type
(
`
${
optionName
}
{enter}`
);
}
export
function
setLabelText
(
labelText
:
string
):
void
{
cy
.
contains
(
'
fieldset
'
,
'
Eingabeelement
'
)
.
contains
(
'
div
'
,
'
Beschriftung
'
).
find
(
'
input
'
)
.
clear
()
.
type
(
labelText
);
}
export
function
setCheckbox
(
labelText
:
string
):
void
{
cy
.
get
(
'
aspect-element-model-properties-component
'
)
.
contains
(
'
mat-checkbox
'
,
labelText
)
.
find
(
'
[type="checkbox"]
'
)
.
click
();
}
export
function
addButton
()
{
// Check if expansion panel is already open; this is important for non-isolated tests
cy
.
get
(
'
mat-expansion-panel
'
).
contains
(
'
Sonstige
'
).
then
(
expansionPanel
=>
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment