Skip to content

Commit

Permalink
addressed review
Browse files Browse the repository at this point in the history
  • Loading branch information
sushmita56 committed Aug 25, 2022
1 parent 9dce327 commit 38177e3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,22 @@ Feature: spaces public link
| Brian | editor |
| Carol | viewer |
| Marie | manager |
When "Brian" logs in
And "Alice" logs out
And "Brian" logs in
And "Brian" navigates to the projects space page
And "Brian" navigates to the project space "team.1"
Then public link named "spaceLink" should be visible to "Brian"
But "Brian" 'should not' be able to edit the public link named "spaceLink"
But "Brian" should not be able to edit the public link named "spaceLink"
And "Brian" logs out
When "Marie" logs in
And "Marie" navigates to the projects space page
And "Marie" navigates to the project space "team.1"
Then public link named "spaceLink" should be visible to "Marie"
And "Marie" 'should' be able to edit the public link named "spaceLink"
When "Marie" changes the permission of the public link named "spaceLink" to "editor"
Then public link named "folderLink" of the resource "spaceFolder" should be visible to "Marie"
And "Marie" 'should' be able to edit the public link named "folderLink"
And "Marie" should be able to edit the public link named "spaceLink"
When "Marie" edits the public link named "spaceLink" of the space changing role to "editor"
Then public link named "folderLink" of the resource "spaceFolder" should be visible to "Marie"
And "Marie" should be able to edit the public link named "folderLink"
When "Marie" edits the public link named "folderLink" of resource "spaceFolder" changing role to "editor"
And "Marie" logs out
When "Carol" logs in
And "Carol" navigates to the projects space page
Expand Down
13 changes: 7 additions & 6 deletions tests/e2e/cucumber/steps/app-files/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ When(
async function (
this: World,
stepUser: string,
name: any,
linkName: any,
resource: string,
role: string
): Promise<void> {
const { page } = this.actorsEnvironment.getActor({ key: stepUser })
const linkObject = new objects.applicationFiles.Link({ page })
const actualRole = await linkObject.changeRole({ name, resource, role })
const actualRole = await linkObject.changeRole({ linkName, resource, role })
expect(role).toBe(actualRole.toLowerCase())
}
)
Expand Down Expand Up @@ -120,7 +120,7 @@ Then(
)

Then(
'{string} {string} be able to edit the public link named {string}',
/^"([^"]*)" (should|should not) be able to edit the public link named "([^"]*)"$/,
async function (
this: World,
stepUser: any,
Expand All @@ -135,10 +135,11 @@ Then(
)

When(
'{string} changes the permission of the public link named {string} to {string}',
async function (this: World, stepUser: string, name: string, role: any): Promise<void> {
'{string} edits the public link named {string} of the space changing role to {string}',
async function (this: World, stepUser: string, linkName: string, role: any): Promise<void> {
const { page } = this.actorsEnvironment.getActor({ key: stepUser })
const linkObject = new objects.applicationFiles.Link({ page })
const newPermission = await linkObject.changeRole({ name, role, space: true })
const newPermission = await linkObject.changeRole({ linkName, role, space: true })
expect(role).toBe(newPermission.toLowerCase())
}
)
12 changes: 6 additions & 6 deletions tests/e2e/support/objects/app-files/link/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export type addPasswordArgs = {
export type changeRoleArgs = {
page: Page
resource?: string
name: string
linkName: string
role: string
space?: boolean
}
Expand All @@ -47,7 +47,7 @@ export type deleteLinkArgs = {
name: string
}

export type PublicLinkAndItsEditButtonVisibilityArgs = {
export type publicLinkAndItsEditButtonVisibilityArgs = {
page: Page
linkName: string
resource?: string
Expand Down Expand Up @@ -102,7 +102,7 @@ export const waitForPopupNotPresent = async (page): Promise<void> => {
}

export const changeRole = async (args: changeRoleArgs): Promise<string> => {
const { page, resource, name, role, space } = args
const { page, resource, linkName, role, space } = args
if (!space) {
const resourcePaths = resource.split('/')
const resourceName = resourcePaths.pop()
Expand All @@ -112,7 +112,7 @@ export const changeRole = async (args: changeRoleArgs): Promise<string> => {
await sidebar.open({ page: page, resource: resourceName })
await sidebar.openPanel({ page: page, name: 'sharing' })
}
await page.locator(util.format(publicLinkEditRoleButton, name)).click()
await page.locator(util.format(publicLinkEditRoleButton, linkName)).click()
await page.locator(util.format(publicLinkSetRoleButton, role.toLowerCase())).click()
const message = await page.locator(linkUpdateDialog).textContent()
expect(message.trim()).toBe('Link was updated successfully')
Expand Down Expand Up @@ -193,7 +193,7 @@ export const deleteLink = async (args: deleteLinkArgs): Promise<void> => {
}

export const getPublicLinkVisibility = async (
args: PublicLinkAndItsEditButtonVisibilityArgs
args: publicLinkAndItsEditButtonVisibilityArgs
): Promise<string> => {
const { page, linkName, resource, space } = args
if (!space) {
Expand All @@ -212,7 +212,7 @@ export const getPublicLinkVisibility = async (
}

export const getLinkEditButtonVisibility = async (
args: PublicLinkAndItsEditButtonVisibilityArgs
args: publicLinkAndItsEditButtonVisibilityArgs
): Promise<boolean> => {
const { page, linkName } = args
return await page.locator(util.format(editPublicLinkButton, linkName)).isVisible()
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/support/objects/app-files/link/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
deleteLinkArgs,
getLinkEditButtonVisibility,
getPublicLinkVisibility,
PublicLinkAndItsEditButtonVisibilityArgs
publicLinkAndItsEditButtonVisibilityArgs
} from './actions'
import { LinksEnvironment } from '../../../environment'

Expand Down Expand Up @@ -84,7 +84,7 @@ export class Link {
}

async getPublicLinkUrl(
args: Omit<PublicLinkAndItsEditButtonVisibilityArgs, 'page'>
args: Omit<publicLinkAndItsEditButtonVisibilityArgs, 'page'>
): Promise<string[]> {
const linkUrl = this.#linksEnvironment.getLink({ name: args.linkName })
const publicLink = await getPublicLinkVisibility({
Expand Down

0 comments on commit 38177e3

Please sign in to comment.