Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
ce-ui-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
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
Code review analytics
Issue analytics
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
ccce
dev
ce-ui-common
Commits
8bc4eee7
Commit
8bc4eee7
authored
1 month ago
by
Johanna Szepanski
Browse files
Options
Downloads
Patches
Plain Diff
migrated dialog test
parent
68477fd2
No related branches found
No related tags found
1 merge request
!217
CE-3633: Migrate dialogs
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
cypress.d.ts
+10
-0
10 additions, 0 deletions
cypress.d.ts
src/components/common/Dialog/Dialog.cy.tsx
+7
-6
7 additions, 6 deletions
src/components/common/Dialog/Dialog.cy.tsx
src/hooks/useTypingTimer.ts
+2
-1
2 additions, 1 deletion
src/hooks/useTypingTimer.ts
tsconfig.json
+4
-3
4 additions, 3 deletions
tsconfig.json
with
23 additions
and
10 deletions
cypress.d.ts
0 → 100644
+
10
−
0
View file @
8bc4eee7
import
{
mount
}
from
"
cypress/react
"
;
declare
global
{
namespace
Cypress
{
interface
Chainable
{
mount
:
typeof
mount
;
login
():
Chainable
<
void
>
;
}
}
}
This diff is collapsed.
Click to expand it.
src/components/common/Dialog/Dialog.cy.
j
sx
→
src/components/common/Dialog/Dialog.cy.
t
sx
+
7
−
6
View file @
8bc4eee7
import
{
composeStories
}
from
"
@storybook/react
"
;
import
{
composeStories
}
from
"
@storybook/react
"
;
import
{
mount
}
from
"
cypress/react
"
;
import
*
as
stories
from
"
../../../stories/common/Dialog/Dialog.stories
"
;
import
*
as
stories
from
"
../../../stories/common/Dialog/Dialog.stories
"
;
const
{
BasicDialog
,
Confirmation
,
DangerActionDialog
}
=
const
{
BasicDialog
,
Confirmation
,
DangerActionDialog
}
=
...
@@ -6,14 +7,14 @@ const { BasicDialog, Confirmation, DangerActionDialog } =
...
@@ -6,14 +7,14 @@ const { BasicDialog, Confirmation, DangerActionDialog } =
describe
(
"
SimpleDialog
"
,
()
=>
{
describe
(
"
SimpleDialog
"
,
()
=>
{
it
(
"
should close on clicking close
"
,
()
=>
{
it
(
"
should close on clicking close
"
,
()
=>
{
cy
.
mount
(<
BasicDialog
/>);
mount
(<
BasicDialog
/>);
cy
.
findByText
(
/some title/i
).
should
(
"
exist
"
);
cy
.
findByText
(
/some title/i
).
should
(
"
exist
"
);
cy
.
findByRole
(
"
button
"
,
{
name
:
/close/i
}).
click
();
cy
.
findByRole
(
"
button
"
,
{
name
:
/close/i
}).
click
();
cy
.
findByText
(
/some title/i
).
should
(
"
not.exist
"
);
cy
.
findByText
(
/some title/i
).
should
(
"
not.exist
"
);
});
});
it
(
"
should close on escape
"
,
()
=>
{
it
(
"
should close on escape
"
,
()
=>
{
cy
.
mount
(<
BasicDialog
/>);
mount
(<
BasicDialog
/>);
cy
.
findByText
(
/some title/i
)
cy
.
findByText
(
/some title/i
)
.
should
(
"
exist
"
)
.
should
(
"
exist
"
)
...
@@ -26,7 +27,7 @@ const closedText = "You closed the dialog!";
...
@@ -26,7 +27,7 @@ const closedText = "You closed the dialog!";
describe
(
"
ConfirmationDialog
"
,
()
=>
{
describe
(
"
ConfirmationDialog
"
,
()
=>
{
it
(
"
should close on clicking close icon
"
,
()
=>
{
it
(
"
should close on clicking close icon
"
,
()
=>
{
cy
.
mount
(<
Confirmation
/>);
mount
(<
Confirmation
/>);
cy
.
findByText
(
/some title/i
).
should
(
"
exist
"
);
cy
.
findByText
(
/some title/i
).
should
(
"
exist
"
);
cy
.
findByRole
(
"
button
"
,
{
name
:
/close/i
}).
click
();
cy
.
findByRole
(
"
button
"
,
{
name
:
/close/i
}).
click
();
...
@@ -34,7 +35,7 @@ describe("ConfirmationDialog", () => {
...
@@ -34,7 +35,7 @@ describe("ConfirmationDialog", () => {
cy
.
findByText
(
closedText
).
should
(
"
exist
"
);
cy
.
findByText
(
closedText
).
should
(
"
exist
"
);
});
});
it
(
"
should close on escape
"
,
()
=>
{
it
(
"
should close on escape
"
,
()
=>
{
cy
.
mount
(<
Confirmation
/>);
mount
(<
Confirmation
/>);
cy
.
findByText
(
/some title/i
)
cy
.
findByText
(
/some title/i
)
.
should
(
"
exist
"
)
.
should
(
"
exist
"
)
...
@@ -43,7 +44,7 @@ describe("ConfirmationDialog", () => {
...
@@ -43,7 +44,7 @@ describe("ConfirmationDialog", () => {
cy
.
findByText
(
closedText
).
should
(
"
exist
"
);
cy
.
findByText
(
closedText
).
should
(
"
exist
"
);
});
});
it
(
"
should close and when clicking cancel
"
,
()
=>
{
it
(
"
should close and when clicking cancel
"
,
()
=>
{
cy
.
mount
(<
Confirmation
/>);
mount
(<
Confirmation
/>);
cy
.
findByText
(
/some title/i
).
should
(
"
exist
"
);
cy
.
findByText
(
/some title/i
).
should
(
"
exist
"
);
cy
.
findByRole
(
"
button
"
,
{
name
:
/cancel/i
}).
click
();
cy
.
findByRole
(
"
button
"
,
{
name
:
/cancel/i
}).
click
();
...
@@ -54,7 +55,7 @@ describe("ConfirmationDialog", () => {
...
@@ -54,7 +55,7 @@ describe("ConfirmationDialog", () => {
describe
(
"
DangerActionDialog
"
,
()
=>
{
describe
(
"
DangerActionDialog
"
,
()
=>
{
const
mountDangerActionDialog
=
()
=>
{
const
mountDangerActionDialog
=
()
=>
{
cy
.
mount
(<
DangerActionDialog
/>);
mount
(<
DangerActionDialog
/>);
cy
.
contains
(
"
Open Danger Action Dialog
"
).
click
();
cy
.
contains
(
"
Open Danger Action Dialog
"
).
click
();
};
};
...
...
This diff is collapsed.
Click to expand it.
src/hooks/useTypingTimer.ts
+
2
−
1
View file @
8bc4eee7
import
{
KeyboardEvent
,
useState
}
from
"
react
"
;
import
{
KeyboardEvent
,
useState
}
from
"
react
"
;
export
const
useTypingTimer
=
({
init
=
""
,
interval
=
750
}
=
{})
=>
{
export
const
useTypingTimer
=
({
init
=
""
,
interval
=
750
}
=
{})
=>
{
const
[
typingTimer
,
setTypingTimer
]
=
useState
<
NodeJS
.
Timeout
>
();
const
[
typingTimer
,
setTypingTimer
]
=
useState
<
ReturnType
<
typeof
setTimeout
>>
();
const
[
value
,
setValue
]
=
useState
(
init
);
const
[
value
,
setValue
]
=
useState
(
init
);
const
doneTypingInterval
=
interval
;
// ms
const
doneTypingInterval
=
interval
;
// ms
...
...
This diff is collapsed.
Click to expand it.
tsconfig.json
+
4
−
3
View file @
8bc4eee7
...
@@ -12,13 +12,14 @@
...
@@ -12,13 +12,14 @@
"noEmit"
:
true
,
"noEmit"
:
true
,
"declaration"
:
true
,
"declaration"
:
true
,
"jsx"
:
"react-jsx"
,
"jsx"
:
"react-jsx"
,
"typeRoots"
:
[
"./dist/index.d.ts"
,
"node_modules/@types"
],
"typeRoots"
:
[
"./dist/index.d.ts"
,
"node_modules/@types"
,
"node_modules"
],
/*
Linting
*/
/*
Linting
*/
"strict"
:
true
,
"strict"
:
true
,
"noUnusedLocals"
:
true
,
"noUnusedLocals"
:
true
,
"noUnusedParameters"
:
true
,
"noUnusedParameters"
:
true
,
"noFallthroughCasesInSwitch"
:
true
,
"noFallthroughCasesInSwitch"
:
true
,
"allowSyntheticDefaultImports"
:
true
"allowSyntheticDefaultImports"
:
true
,
"types"
:
[
"cypress"
,
"@testing-library/cypress"
]
},
},
"include"
:
[
"src"
]
"include"
:
[
"src"
,
"cypress.d.ts"
]
}
}
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