Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
748be3e6
Unverified
Commit
748be3e6
authored
Aug 11, 2024
by
Timothy Jaeryang Baek
Committed by
GitHub
Aug 11, 2024
Browse files
Merge pull request #4529 from cheahjs/fix/integration-tests
ci: fix cypress integration tests
parents
1b2ae7bb
153ba168
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
13 deletions
+25
-13
.github/workflows/integration-test.yml
.github/workflows/integration-test.yml
+7
-0
cypress/e2e/chat.cy.ts
cypress/e2e/chat.cy.ts
+18
-13
No files found.
.github/workflows/integration-test.yml
View file @
748be3e6
...
@@ -15,6 +15,13 @@ jobs:
...
@@ -15,6 +15,13 @@ jobs:
name
:
Run Cypress Integration Tests
name
:
Run Cypress Integration Tests
runs-on
:
ubuntu-latest
runs-on
:
ubuntu-latest
steps
:
steps
:
-
name
:
Maximize build space
uses
:
AdityaGarg8/remove-unwanted-software@v4.1
with
:
remove-android
:
'
true'
remove-haskell
:
'
true'
remove-codeql
:
'
true'
-
name
:
Checkout Repository
-
name
:
Checkout Repository
uses
:
actions/checkout@v4
uses
:
actions/checkout@v4
...
...
cypress/e2e/chat.cy.ts
View file @
748be3e6
...
@@ -38,9 +38,10 @@ describe('Settings', () => {
...
@@ -38,9 +38,10 @@ describe('Settings', () => {
// User's message should be visible
// User's message should be visible
cy
.
get
(
'
.chat-user
'
).
should
(
'
exist
'
);
cy
.
get
(
'
.chat-user
'
).
should
(
'
exist
'
);
// Wait for the response
// Wait for the response
cy
.
get
(
'
.chat-assistant
'
,
{
timeout
:
120
_000
})
// .chat-assistant is created after the first token is received
// .chat-assistant is created after the first token is received
.
find
(
'
div[aria-label="Generation Info"]
'
,
{
timeout
:
120
_000
})
// Generation Info is created after the stop token is received
cy
.
get
(
'
.chat-assistant
'
,
{
timeout
:
10
_000
}).
should
(
'
exist
'
);
.
should
(
'
exist
'
);
// Generation Info is created after the stop token is received
cy
.
get
(
'
div[aria-label="Generation Info"]
'
,
{
timeout
:
120
_000
}).
should
(
'
exist
'
);
});
});
it
(
'
user can share chat
'
,
()
=>
{
it
(
'
user can share chat
'
,
()
=>
{
...
@@ -57,21 +58,24 @@ describe('Settings', () => {
...
@@ -57,21 +58,24 @@ describe('Settings', () => {
// User's message should be visible
// User's message should be visible
cy
.
get
(
'
.chat-user
'
).
should
(
'
exist
'
);
cy
.
get
(
'
.chat-user
'
).
should
(
'
exist
'
);
// Wait for the response
// Wait for the response
cy
.
get
(
'
.chat-assistant
'
,
{
timeout
:
120
_000
})
// .chat-assistant is created after the first token is received
// .chat-assistant is created after the first token is received
.
find
(
'
div[aria-label="Generation Info"]
'
,
{
timeout
:
120
_000
})
// Generation Info is created after the stop token is received
cy
.
get
(
'
.chat-assistant
'
,
{
timeout
:
10
_000
}).
should
(
'
exist
'
);
.
should
(
'
exist
'
);
// Generation Info is created after the stop token is received
cy
.
get
(
'
div[aria-label="Generation Info"]
'
,
{
timeout
:
120
_000
}).
should
(
'
exist
'
);
// spy on requests
// spy on requests
const
spy
=
cy
.
spy
();
const
spy
=
cy
.
spy
();
cy
.
intercept
(
'
GE
T
'
,
'
/api/v1/chats/*
'
,
spy
);
cy
.
intercept
(
'
POS
T
'
,
'
/api/v1/chats/*
*/share
'
,
spy
);
// Open context menu
// Open context menu
cy
.
get
(
'
#chat-context-menu-button
'
).
click
();
cy
.
get
(
'
#chat-context-menu-button
'
).
click
();
// Click share button
// Click share button
cy
.
get
(
'
#chat-share-button
'
).
click
();
cy
.
get
(
'
#chat-share-button
'
).
click
();
// Check if the share dialog is visible
// Check if the share dialog is visible
cy
.
get
(
'
#copy-and-share-chat-button
'
).
should
(
'
exist
'
);
cy
.
get
(
'
#copy-and-share-chat-button
'
).
should
(
'
exist
'
);
cy
.
wrap
({},
{
timeout
:
5000
}).
should
(()
=>
{
// Click the copy button
// Check if the request was made twice (once for to replace chat object and once more due to change event)
cy
.
get
(
'
#copy-and-share-chat-button
'
).
click
();
expect
(
spy
).
to
.
be
.
callCount
(
2
);
cy
.
wrap
({},
{
timeout
:
5
_000
}).
should
(()
=>
{
// Check if the share request was made
expect
(
spy
).
to
.
be
.
callCount
(
1
);
});
});
});
});
...
@@ -89,9 +93,10 @@ describe('Settings', () => {
...
@@ -89,9 +93,10 @@ describe('Settings', () => {
// User's message should be visible
// User's message should be visible
cy
.
get
(
'
.chat-user
'
).
should
(
'
exist
'
);
cy
.
get
(
'
.chat-user
'
).
should
(
'
exist
'
);
// Wait for the response
// Wait for the response
cy
.
get
(
'
.chat-assistant
'
,
{
timeout
:
120
_000
})
// .chat-assistant is created after the first token is received
// .chat-assistant is created after the first token is received
.
find
(
'
div[aria-label="Generation Info"]
'
,
{
timeout
:
120
_000
})
// Generation Info is created after the stop token is received
cy
.
get
(
'
.chat-assistant
'
,
{
timeout
:
10
_000
}).
should
(
'
exist
'
);
.
should
(
'
exist
'
);
// Generation Info is created after the stop token is received
cy
.
get
(
'
div[aria-label="Generation Info"]
'
,
{
timeout
:
120
_000
}).
should
(
'
exist
'
);
// Click on the generate image button
// Click on the generate image button
cy
.
get
(
'
[aria-label="Generate Image"]
'
).
click
();
cy
.
get
(
'
[aria-label="Generate Image"]
'
).
click
();
// Wait for image to be visible
// Wait for image to be visible
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment