-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #834 from research-software-directory/e2e-improve
Improve e2e tests stability
- Loading branch information
Showing
96 changed files
with
979 additions
and
304 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,14 +50,16 @@ RSD_AUTH_URL=http://auth:7000 | |
# Allowed values are: SURFCONEXT, HELMHOLTZAAI, ORCID or LOCAL | ||
# if env value is not provided default provider is set to be SURFCONEXT | ||
# if you add the value "LOCAL", then local accounts are enabled, USE THIS FOR TESTING PURPOSES ONLY | ||
# NOTE! in e2e ONLY LOCAL provider works because it does not requires secrets/tokens | ||
# in e2e we use LOCAL but we list other 2 providers to test selection modal which otherwise will not be shown. | ||
RSD_AUTH_PROVIDERS=SURFCONEXT;ORCID;LOCAL | ||
|
||
# Define a semicolon-separated list of user email addresses (exact match incl. the letter casing) of RSD admins. | ||
# When someome authenticates with an email address in this list, | ||
# they will get a token with as role rsd_admin, meaning they | ||
# have admin rights for all the tables. | ||
# consumed by: authentication | ||
RSD_ADMIN_EMAIL_LIST=[email protected];[email protected] | ||
[email protected] | ||
|
||
# Define a semicolon-separated list of user email addresses which are allowed to | ||
# login to the RSD. If the variable is left empty, or is not defined, all users | ||
|
@@ -77,21 +79,6 @@ SURFCONEXT_SCOPES=openid | |
# consumed by: frontend/utils/loginHelpers | ||
SURFCONEXT_RESPONSE_MODE=form_post | ||
|
||
# Helmholtz AAI | ||
# consumed by: authentication, frontend/utils/loginHelpers | ||
HELMHOLTZAAI_CLIENT_ID=rsd-dev | ||
# consumed by: authentication, frontend/utils/loginHelpers | ||
HELMHOLTZAAI_REDIRECT=http://localhost/auth/login/helmholtzaai | ||
# consumed by: authentication, frontend/utils/loginHelpers | ||
HELMHOLTZAAI_WELL_KNOWN_URL=https://login-dev.helmholtz.de/oauth2/.well-known/openid-configuration | ||
# consumed by: authentication, frontend/utils/loginHelpers | ||
HELMHOLTZAAI_SCOPES=openid+profile+email+eduperson_principal_name | ||
# consumed by: frontend/utils/loginHelpers | ||
HELMHOLTZAAI_RESPONSE_MODE=query | ||
# consumed by: authentication | ||
# uncomment if you want to allow users from non-Helmholtz centres or social IdPs: | ||
HELMHOLTZAAI_ALLOW_EXTERNAL_USERS=true | ||
|
||
# ORCID | ||
# consumed by: authentication, frontend/utils/loginHelpers | ||
ORCID_CLIENT_ID=APP-4D4D69ASWTYOI9QI | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
// SPDX-FileCopyrightText: 2023 Dusan Mijatovic (dv4all) | ||
// SPDX-FileCopyrightText: 2023 Dusan Mijatovic (dv4all) (dv4all) | ||
// SPDX-FileCopyrightText: 2023 dv4all | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import {test, expect} from '@playwright/test' | ||
import {mockProject} from '../mocks/mockProject' | ||
import {createProject} from '../helpers/project' | ||
import {mockCitations} from '../mocks/mockCitations' | ||
import {openEditPage, openEditSection} from '../helpers/utils' | ||
import {saveCitation} from '../helpers/citations' | ||
|
||
// run tests in serial mode | ||
// we first need first to create software | ||
test.describe.serial('Project', async () => { | ||
test('Create project', async ({page}) => { | ||
// we use chrome project mocks by default | ||
const proj = mockProject['chrome'] | ||
// start from homepage | ||
await page.goto('/') | ||
// create project | ||
const slug = await createProject({ | ||
page, | ||
title: proj.title, | ||
desc: proj.desc, | ||
slug: proj.slug | ||
}) | ||
// expect slug | ||
expect(slug).toEqual(proj.slug) | ||
}) | ||
|
||
test('Add impact', async ({page}) => { | ||
// https://playwright.dev/docs/test-timeouts#test-timeout | ||
// this test need to be marked as slow because it saves all data per DOI | ||
test.slow() | ||
// get mock software for the browser | ||
const project = mockProject['chrome'] | ||
|
||
// directly open edit software page | ||
const url = `/projects/${project.slug}` | ||
await openEditPage(page, url, project.title) | ||
|
||
// navigate to organisations sectiont | ||
await openEditSection(page, 'Impact') | ||
|
||
// save all impact requests | ||
const keys = Object.keys(mockCitations) | ||
for (const key of keys) { | ||
const citations = mockCitations[key] | ||
// add citations using doi | ||
for (const item of citations.dois.impact) { | ||
await saveCitation(page, item, 'impact_for_project') | ||
} | ||
} | ||
}) | ||
|
||
test('Add output', async ({page}) => { | ||
// https://playwright.dev/docs/test-timeouts#test-timeout | ||
// this test need to be marked as slow because it saves all data per DOI | ||
test.slow() | ||
// get mock software for the browser | ||
const project = mockProject['chrome'] | ||
|
||
// directly open edit software page | ||
const url = `/projects/${project.slug}` | ||
await openEditPage(page, url, project.title) | ||
|
||
// navigate to organisations sectiont | ||
await openEditSection(page, 'Output') | ||
|
||
// save all impact requests | ||
const keys = Object.keys(mockCitations) | ||
for (const key of keys) { | ||
const citations = mockCitations[key] | ||
// add citations using doi | ||
for (const item of citations.dois.output) { | ||
await saveCitation(page, item, 'output_for_project') | ||
} | ||
} | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// SPDX-FileCopyrightText: 2023 Dusan Mijatovic (dv4all) | ||
// SPDX-FileCopyrightText: 2023 Dusan Mijatovic (dv4all) (dv4all) | ||
// SPDX-FileCopyrightText: 2023 dv4all | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import {test, expect} from '@playwright/test' | ||
import {mockSoftware} from '../mocks/mockSoftware' | ||
import {createSoftware} from '../helpers/software' | ||
import {mockCitations} from '../mocks/mockCitations' | ||
import {openEditPage, openEditSection} from '../helpers/utils' | ||
import {saveCitation} from '../helpers/citations' | ||
|
||
// run tests in serial mode | ||
// we first need first to create software | ||
test.describe.serial('Software', async () => { | ||
|
||
test('Create software', async ({page}) => { | ||
// get mock software for the browser | ||
const software = mockSoftware['chrome'] | ||
// start from homepage | ||
await page.goto('/') | ||
// create software | ||
const slug = await createSoftware({ | ||
page, | ||
title: software.title, | ||
desc: software.desc, | ||
slug: software.slug | ||
}) | ||
// expect slug | ||
expect(slug).toEqual(software.slug) | ||
}) | ||
|
||
test('Generate mentions using DOI', async ({page}) => { | ||
// https://playwright.dev/docs/test-timeouts#test-timeout | ||
// this test need to be marked as slow because it saves all data per DOI | ||
test.slow() | ||
// get mock software for the browser | ||
const software = mockSoftware['chrome'] | ||
|
||
// directly open edit software page | ||
const url = `/software/${software.slug}` | ||
await openEditPage(page, url, software.title) | ||
|
||
// navigate to organisations sectiont | ||
await openEditSection(page, 'Mentions') | ||
|
||
const keys = Object.keys(mockCitations) | ||
for (const key of keys) { | ||
const citations = mockCitations[key] | ||
// add mentions using doi | ||
for (const item of citations.dois.mention) { | ||
await saveCitation(page, item, 'mention_for_software') | ||
} | ||
} | ||
}) | ||
}) | ||
|
Oops, something went wrong.