Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nomad-FAIR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
nomad-lab
nomad-FAIR
Commits
cfa6e5a3
Commit
cfa6e5a3
authored
3 years ago
by
Markus Scheidgen
Browse files
Options
Downloads
Plain Diff
Merge branch 'Jest_UploadPage' into 'v1.1.1'
GUI tests for uploadPage See merge request
!672
parents
84fe5b65
87c21aa7
Branches
Branches containing commit
No related tags found
1 merge request
!672
GUI tests for uploadPage
Pipeline
#132510
passed
3 years ago
Stage: build
Stage: test
Stage: release
Changes
1
Pipelines
4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gui/src/components/uploads/UploadPage.spec.js
+42
-12
42 additions, 12 deletions
gui/src/components/uploads/UploadPage.spec.js
with
42 additions
and
12 deletions
gui/src/components/uploads/UploadPage.spec.js
+
42
−
12
View file @
cfa6e5a3
...
@@ -24,10 +24,37 @@ import {
...
@@ -24,10 +24,37 @@ import {
startAPI
,
startAPI
,
closeAPI
closeAPI
}
from
'
../conftest.spec
'
}
from
'
../conftest.spec
'
import
{
within
,
waitFor
}
from
'
@testing-library/dom
'
import
UploadPage
from
'
./UploadPage
'
import
UploadPage
from
'
./UploadPage
'
import
{
fireEvent
,
waitFor
,
within
,
act
}
from
'
@testing-library/react
'
import
userEvent
from
'
@testing-library/user-event
'
import
userEvent
from
'
@testing-library/user-event
'
const
testShownColumnsAction
=
async
()
=>
{
await
screen
.
findByTitle
(
'
Change the shown columns.
'
)
expect
(
screen
.
queryByText
(
'
Parser name
'
)).
not
.
toBeInTheDocument
()
expect
(
screen
.
queryByText
(
'
Comment
'
)).
not
.
toBeInTheDocument
()
expect
(
screen
.
queryByText
(
'
References
'
)).
not
.
toBeInTheDocument
()
expect
(
screen
.
queryByText
(
'
Datasets
'
)).
not
.
toBeInTheDocument
()
let
uploadPageRows
=
screen
.
queryAllByTestId
(
'
datatable-row
'
)
expect
(
uploadPageRows
.
length
).
toBe
(
1
)
expect
(
within
(
uploadPageRows
[
0
]).
queryByText
(
'
Mocked
'
)).
not
.
toBeInTheDocument
()
expect
(
within
(
uploadPageRows
[
0
]).
queryByText
(
'
doi
'
)).
not
.
toBeInTheDocument
()
expect
(
within
(
uploadPageRows
[
0
]).
queryByText
(
'
no datasets
'
)).
not
.
toBeInTheDocument
()
act
(()
=>
{
fireEvent
.
click
(
screen
.
getByTitle
(
'
Change the shown columns.
'
))
})
await
waitFor
(()
=>
expect
(
screen
.
queryByText
(
'
Datasets
'
)).
toBeInTheDocument
())
await
waitFor
(()
=>
expect
(
screen
.
queryByText
(
'
Comment
'
)).
toBeInTheDocument
())
await
waitFor
(()
=>
expect
(
screen
.
queryByText
(
'
References
'
)).
toBeInTheDocument
())
await
waitFor
(()
=>
expect
(
screen
.
queryByText
(
'
Parser name
'
)).
toBeInTheDocument
())
act
(()
=>
{
fireEvent
.
click
(
screen
.
getByText
(
'
Comment
'
))
})
act
(()
=>
{
fireEvent
.
click
(
screen
.
getByText
(
'
References
'
))
})
act
(()
=>
{
fireEvent
.
click
(
screen
.
getByText
(
'
Datasets
'
))
})
await
waitFor
(()
=>
expect
(
within
(
uploadPageRows
[
0
]).
queryByText
(
'
Mocked
'
)).
toBeInTheDocument
())
await
waitFor
(()
=>
expect
(
within
(
uploadPageRows
[
0
]).
queryByText
(
'
doi
'
)).
toBeInTheDocument
())
await
waitFor
(()
=>
expect
(
within
(
uploadPageRows
[
0
]).
queryByText
(
'
no datasets
'
)).
toBeInTheDocument
())
}
const
testPublishedWritePermissions
=
async
()
=>
{
const
testPublishedWritePermissions
=
async
()
=>
{
// Wait to load the page, i.e. wait for some text to appear
// Wait to load the page, i.e. wait for some text to appear
await
screen
.
findByText
(
'
unnamed upload
'
)
await
screen
.
findByText
(
'
unnamed upload
'
)
...
@@ -125,6 +152,7 @@ test.each([
...
@@ -125,6 +152,7 @@ test.each([
await
startAPI
(
state
,
snapshot
,
username
,
password
)
await
startAPI
(
state
,
snapshot
,
username
,
password
)
render
(
<
UploadPage
uploadId
=
{
uploadId
}
/>
)
render
(
<
UploadPage
uploadId
=
{
uploadId
}
/>
)
await
testPublishedWritePermissions
()
await
testPublishedWritePermissions
()
await
testShownColumnsAction
()
closeAPI
()
closeAPI
()
})
})
...
@@ -169,6 +197,7 @@ test.each([
...
@@ -169,6 +197,7 @@ test.each([
await
startAPI
(
state
,
snapshot
,
username
,
password
)
await
startAPI
(
state
,
snapshot
,
username
,
password
)
render
(
<
UploadPage
uploadId
=
{
uploadId
}
/>
)
render
(
<
UploadPage
uploadId
=
{
uploadId
}
/>
)
await
testReadOnlyPermissions
()
await
testReadOnlyPermissions
()
await
testShownColumnsAction
()
closeAPI
()
closeAPI
()
})
})
...
@@ -192,11 +221,12 @@ test.each([
...
@@ -192,11 +221,12 @@ test.each([
await
startAPI
(
state
,
snapshot
,
username
,
password
)
await
startAPI
(
state
,
snapshot
,
username
,
password
)
render
(
<
UploadPage
uploadId
=
{
uploadId
}
/>
)
render
(
<
UploadPage
uploadId
=
{
uploadId
}
/>
)
await
testUnpublishedWritePermissions
()
await
testUnpublishedWritePermissions
()
await
testShownColumnsAction
()
closeAPI
()
closeAPI
()
})
})
test
(
'
Render upload page: multiple entries
'
,
async
()
=>
{
test
(
'
Render upload page: multiple entries
'
,
async
()
=>
{
await
startAPI
(
'
tests.states.uploads.multiple_entries
'
,
'
tests/data/uploads/multiple_entries
'
,
'
test
'
,
'
password
'
)
await
startAPI
(
'
tests.states.uploads.multiple_entries
'
,
'
tests/data/uploads/multiple_entries
'
)
render
(
<
UploadPage
uploadId
=
"
dft_upload_1
"
/>
)
render
(
<
UploadPage
uploadId
=
"
dft_upload_1
"
/>
)
// Wait to load the page, i.e. wait for some text to appear
// Wait to load the page, i.e. wait for some text to appear
...
@@ -307,8 +337,7 @@ test.each([
...
@@ -307,8 +337,7 @@ test.each([
'
dft_upload
'
,
'
dft_upload
'
,
'
test
'
,
'
test
'
,
'
password
'
'
password
'
],
],
[
[
'
Published with embargo and logged in as coauthor
'
,
'
Published with embargo and logged in as coauthor
'
,
'
tests.states.uploads.published_with_embargo
'
,
'
tests.states.uploads.published_with_embargo
'
,
'
tests/data/uploads/uploadpage-published-with-embargo-coauthor
'
,
'
tests/data/uploads/uploadpage-published-with-embargo-coauthor
'
,
...
@@ -320,26 +349,27 @@ test.each([
...
@@ -320,26 +349,27 @@ test.each([
await
startAPI
(
state
,
snapshot
,
username
,
password
)
await
startAPI
(
state
,
snapshot
,
username
,
password
)
render
(
<
UploadPage
uploadId
=
{
uploadId
}
/>
)
render
(
<
UploadPage
uploadId
=
{
uploadId
}
/>
)
await
testEmbargoedPublishesWritePermissions
()
await
testEmbargoedPublishesWritePermissions
()
await
testShownColumnsAction
()
closeAPI
()
closeAPI
()
})
})
test
.
each
([
test
.
each
([
[
[
'
unpublished,
logged in as neither reviewer nor coauthor or main author
'
,
'
unpublished,
not authenticated
'
,
'
tests.states.uploads.unpublished
'
,
'
tests.states.uploads.unpublished
'
,
'
tests/data/uploads/uploadpage-unpublished-
external
'
,
'
tests/data/uploads/uploadpage-unpublished-
noauth
'
,
'
dft_upload
'
,
'
dft_upload
'
,
'
admin
'
,
''
,
'
password
'
,
''
,
'
You do not have access to the specified upload - not published yet.
'
'
You do not have access to the specified upload - not published yet.
'
],
],
[
[
'
unpublished,
not authenticated
'
,
'
unpublished,
logged in as neither reviewer nor coauthor or main author
'
,
'
tests.states.uploads.unpublished
'
,
'
tests.states.uploads.unpublished
'
,
'
tests/data/uploads/uploadpage-unpublished-
noauth
'
,
'
tests/data/uploads/uploadpage-unpublished-
external
'
,
'
dft_upload
'
,
'
dft_upload
'
,
''
,
'
admin
'
,
''
,
'
password
'
,
'
You do not have access to the specified upload - not published yet.
'
'
You do not have access to the specified upload - not published yet.
'
],
],
[
[
...
...
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