-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
484b192
commit 6e31579
Showing
12 changed files
with
194 additions
and
63 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
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
10 changes: 5 additions & 5 deletions
10
.../[organism]/group/[groupName]/index.astro → ...e/src/pages/group/[groupName]/index.astro
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
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,80 @@ | ||
import type { Page } from '@playwright/test'; | ||
|
||
import { routes } from '../../../../src/routes.ts'; | ||
import { baseUrl, dummyOrganism, expect } from '../../../e2e.fixture'; | ||
|
||
export class GroupPage { | ||
constructor(public readonly page: Page) {} | ||
|
||
public async goToUserPage() { | ||
await this.page.goto(`${baseUrl}${routes.userOverviewPage()}`, { waitUntil: 'networkidle' }); | ||
await this.page.waitForURL(`${baseUrl}${routes.userOverviewPage()}`); | ||
} | ||
|
||
public async goToGroupPage(groupName: string) { | ||
await this.page.goto(`${baseUrl}${routes.groupOverviewPage(groupName)}`, { | ||
waitUntil: 'networkidle', | ||
}); | ||
await this.page.waitForURL(`${baseUrl}${routes.groupOverviewPage(groupName)}`); | ||
} | ||
|
||
public async createGroup(uniqueGroupName: string) { | ||
const newGroupField = this.page.getByRole('textbox', { name: 'new group name' }); | ||
await newGroupField.fill(uniqueGroupName); | ||
const createGroupButton = this.page.getByRole('button', { name: 'Create group' }); | ||
await createGroupButton.click(); | ||
} | ||
|
||
public getLocatorForButtonToLeaveGroup(groupName: string) { | ||
return this.page.locator('li').filter({ hasText: groupName }).getByRole('button'); | ||
} | ||
|
||
public async leaveGroup(uniqueGroupName: string) { | ||
const buttonToLeaveGroup = this.getLocatorForButtonToLeaveGroup(uniqueGroupName); | ||
await buttonToLeaveGroup.waitFor({ state: 'visible' }); | ||
await buttonToLeaveGroup.click(); | ||
|
||
const confirmButton = this.page.getByRole('button', { name: 'Confirm' }); | ||
await confirmButton.click(); | ||
} | ||
|
||
public async verifyGroupIsPresent(groupName: string) { | ||
const linkToNewGroup = this.page.getByRole('link', { name: groupName }); | ||
await expect(linkToNewGroup).toBeVisible(); | ||
|
||
expect(await linkToNewGroup.getAttribute('href')).toBe(`/group/${groupName}`); | ||
|
||
return linkToNewGroup; | ||
} | ||
|
||
public getLocatorForButtonToRemoveUser(userName: string) { | ||
return this.page.getByLabel(`Remove User ${userName}`, { exact: true }); | ||
} | ||
|
||
public async verifyUserIsPresent(userName: string) { | ||
const userLocator = this.page.locator('ul').getByText(userName, { exact: true }); | ||
await expect(userLocator).toBeVisible(); | ||
return userLocator; | ||
} | ||
|
||
public async addNewUserToGroup(uniqueUserName: string) { | ||
const buttonToAddUserToGroup = this.page.getByRole('button', { name: 'Add user' }); | ||
const fieldToAddUserToGroup = this.page.getByRole('textbox', { name: 'new user name' }); | ||
await expect(buttonToAddUserToGroup).toBeVisible(); | ||
await expect(fieldToAddUserToGroup).toBeVisible(); | ||
await fieldToAddUserToGroup.fill(uniqueUserName); | ||
|
||
await buttonToAddUserToGroup.click(); | ||
|
||
await this.verifyUserIsPresent(uniqueUserName); | ||
} | ||
|
||
public async removeUserFromGroup(uniqueUserName: string) { | ||
const buttonToRemoveUserFromGroup = this.getLocatorForButtonToRemoveUser(uniqueUserName); | ||
await buttonToRemoveUserFromGroup.waitFor({ state: 'visible' }); | ||
await buttonToRemoveUserFromGroup.click(); | ||
|
||
const confirmButton = this.page.getByRole('button', { name: 'Confirm' }); | ||
await confirmButton.click(); | ||
} | ||
} |
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,26 @@ | ||
import { v4 } from 'uuid'; | ||
|
||
import { expect, test } from '../../../e2e.fixture'; | ||
import { DEFAULT_GROUP_NAME } from '../../../playwrightSetup.ts'; | ||
|
||
test.describe('The group page', () => { | ||
test('should see all users of the group, add a user and remove it afterwards', async ({ | ||
groupPage, | ||
loginAsTestUser, | ||
}) => { | ||
const { username } = await loginAsTestUser(); | ||
|
||
await groupPage.goToGroupPage(DEFAULT_GROUP_NAME); | ||
|
||
await groupPage.verifyUserIsPresent(username); | ||
|
||
const uniqueUserName = v4(); | ||
await groupPage.addNewUserToGroup(uniqueUserName); | ||
|
||
await groupPage.verifyUserIsPresent(uniqueUserName); | ||
|
||
await groupPage.removeUserFromGroup(uniqueUserName); | ||
|
||
await expect(groupPage.getLocatorForButtonToRemoveUser(uniqueUserName)).not.toBeVisible(); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1,45 +1,23 @@ | ||
import { v4 } from 'uuid'; | ||
|
||
import { expect, test } from '../../e2e.fixture'; | ||
import { submitRevisedDataViaApi } from '../../util/backendCalls.ts'; | ||
import { prepareDataToBe } from '../../util/prepareDataToBe.ts'; | ||
import { DEFAULT_GROUP_NAME } from '../../playwrightSetup.ts'; | ||
|
||
test.describe('The user page', () => { | ||
test('should show sequence entries, their status and a link to the editPage', async ({ | ||
userPage, | ||
test('should see the groups the user is member of, create a group and leave it afterwards', async ({ | ||
groupPage, | ||
loginAsTestUser, | ||
}) => { | ||
const { token } = await loginAsTestUser(); | ||
|
||
const [sequenceEntryAwaitingApproval] = await prepareDataToBe('awaitingApproval', token); | ||
const [sequenceEntryWithErrors] = await prepareDataToBe('erroneous', token); | ||
const [sequenceEntryReleasable] = await prepareDataToBe('approvedForRelease', token); | ||
const [sequenceEntryToBeRevised] = await prepareDataToBe('approvedForRelease', token); | ||
await submitRevisedDataViaApi([sequenceEntryToBeRevised.accession], token); | ||
await loginAsTestUser(); | ||
|
||
await userPage.gotoUserSequencePage(); | ||
await groupPage.goToUserPage(); | ||
await groupPage.verifyGroupIsPresent(DEFAULT_GROUP_NAME); | ||
|
||
const sequencesArePresent = await userPage.verifyTableEntries([ | ||
{ | ||
...sequenceEntryWithErrors, | ||
status: 'HAS_ERRORS', | ||
isRevocation: false, | ||
}, | ||
{ | ||
...sequenceEntryAwaitingApproval, | ||
status: 'AWAITING_APPROVAL', | ||
isRevocation: false, | ||
}, | ||
{ | ||
...sequenceEntryReleasable, | ||
status: 'APPROVED_FOR_RELEASE', | ||
isRevocation: false, | ||
}, | ||
{ | ||
...sequenceEntryToBeRevised, | ||
status: 'APPROVED_FOR_RELEASE', | ||
isRevocation: false, | ||
}, | ||
]); | ||
const uniqueGroupName = v4(); | ||
await groupPage.createGroup(uniqueGroupName); | ||
const linkToNewGroup = await groupPage.verifyGroupIsPresent(uniqueGroupName); | ||
|
||
expect(sequencesArePresent).toBe(true); | ||
await groupPage.leaveGroup(uniqueGroupName); | ||
await expect(linkToNewGroup).not.toBeVisible(); | ||
}); | ||
}); |
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,45 @@ | ||
import { expect, test } from '../../../e2e.fixture'; | ||
import { submitRevisedDataViaApi } from '../../../util/backendCalls.ts'; | ||
import { prepareDataToBe } from '../../../util/prepareDataToBe.ts'; | ||
|
||
test.describe('The user sequence page', () => { | ||
test('should show sequence entries, their status and a link to the editPage', async ({ | ||
userPage, | ||
loginAsTestUser, | ||
}) => { | ||
const { token } = await loginAsTestUser(); | ||
|
||
const [sequenceEntryAwaitingApproval] = await prepareDataToBe('awaitingApproval', token); | ||
const [sequenceEntryWithErrors] = await prepareDataToBe('erroneous', token); | ||
const [sequenceEntryReleasable] = await prepareDataToBe('approvedForRelease', token); | ||
const [sequenceEntryToBeRevised] = await prepareDataToBe('approvedForRelease', token); | ||
await submitRevisedDataViaApi([sequenceEntryToBeRevised.accession], token); | ||
|
||
await userPage.gotoUserSequencePage(); | ||
|
||
const sequencesArePresent = await userPage.verifyTableEntries([ | ||
{ | ||
...sequenceEntryWithErrors, | ||
status: 'HAS_ERRORS', | ||
isRevocation: false, | ||
}, | ||
{ | ||
...sequenceEntryAwaitingApproval, | ||
status: 'AWAITING_APPROVAL', | ||
isRevocation: false, | ||
}, | ||
{ | ||
...sequenceEntryReleasable, | ||
status: 'APPROVED_FOR_RELEASE', | ||
isRevocation: false, | ||
}, | ||
{ | ||
...sequenceEntryToBeRevised, | ||
status: 'APPROVED_FOR_RELEASE', | ||
isRevocation: false, | ||
}, | ||
]); | ||
|
||
expect(sequencesArePresent).toBe(true); | ||
}); | ||
}); |
10 changes: 5 additions & 5 deletions
10
website/tests/pages/user/user.page.ts → ...user/userSequencePage/userSequencePage.ts
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