Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
testsuite/playwright-ui: added bucket and object browser tests for V2…
… app Added tests for bucket and object related functionality. Issue: #6598 Change-Id: I8cc9dfd8c82af12402af5a438e61fe9491d85e6b
- Loading branch information
1 parent
14def22
commit 9648e03
Showing
25 changed files
with
388 additions
and
14 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
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
21 changes: 21 additions & 0 deletions
21
testsuite/playwright-ui/pageFactory/objectRepository/ObjectBrowserPageObjects.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (C) 2024 Storj Labs, Inc. | ||
// See LICENSE for copying information. | ||
|
||
export class ObjectBrowserPageObjects { | ||
static DOWNLOAD_BUTTON_XPATH = `//button[@id='Download']`; | ||
static DISTRIBUTION_BUTTON_XPATH = `//button[@id='Distribution']`; | ||
static SHARE_BUTTON_XPATH = `//button[@id='Share']`; | ||
static COPY_LINK_BUTTON_XPATH = `//button[span[text()='Copy Link']]`; | ||
static COPIED_TEXT = `Copied`; | ||
static SHARE_MODAL_LOADER_CLASS = `.share-dialog__content--loading`; | ||
static OBJECT_MAP_IMAGE_XPATH = `//img[@id='Map']`; | ||
static OBJECT_ROW_MORE_BUTTON_XPATH = `//button[@title='More Actions']`; | ||
static DELETE_ROW_ACTION_BUTTON_XPATH = `//div[div[div[text()=' Delete ']]]`; | ||
static CONFIRM_DELETE_BUTTON_XPATH = `//button[span[text()=' Delete ']]`; | ||
static FILE_INPUT_XPATH = `//input[@id='File Input']`; | ||
static FOLDER_INPUT_XPATH = `//input[@id='Folder Input']`; | ||
static LOADING_ITEMS_LABEL_XPATH = `//td[text()='Loading items...']`; | ||
static CREATE_FOLDER_BUTTON_XPATH = `//button[span[text()=' New Folder ']]`; | ||
static FOLDER_NAME_INPUT_XPATH = `//input[@id='Folder Name']`; | ||
static CONFIRM_CREATE_FOLDER_BUTTON_XPATH = `//button[span[text()=' Create Folder ']]`; | ||
} |
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
87 changes: 87 additions & 0 deletions
87
testsuite/playwright-ui/pageFactory/pageRepository/ObjectBrowserPage.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// Copyright (C) 2024 Storj Labs, Inc. | ||
// See LICENSE for copying information. | ||
|
||
import type { Page } from '@playwright/test'; | ||
import { expect } from '@playwright/test'; | ||
import { ObjectBrowserPageObjects } from '@objects/ObjectBrowserPageObjects'; | ||
import { CommonObjectsV2 } from '@objects/CommonObjects'; | ||
|
||
export class ObjectBrowserPage { | ||
constructor(readonly page: Page) {} | ||
|
||
async waitLoading(): Promise<void> { | ||
const loader = this.page.locator(ObjectBrowserPageObjects.LOADING_ITEMS_LABEL_XPATH); | ||
await expect(loader).toBeHidden(); | ||
} | ||
|
||
async uploadFile(name: string, format: string): Promise<void> { | ||
await this.page.setInputFiles(ObjectBrowserPageObjects.FILE_INPUT_XPATH, { | ||
name: name, | ||
mimeType: format, | ||
buffer: Buffer.from('Test,T'), | ||
}, { strict: true }); | ||
} | ||
|
||
async uploadFolder(folder: string, filename: string, format: string): Promise<void> { | ||
await this.page.setInputFiles(ObjectBrowserPageObjects.FOLDER_INPUT_XPATH, { | ||
name: folder + '/' + filename, | ||
mimeType: format, | ||
buffer: Buffer.from('Test,T'), | ||
}); | ||
await expect(this.page.getByRole('button', { name: `Foldericon ${folder}` })).toBeVisible(); | ||
} | ||
|
||
async openObjectPreview(name: string, type: string): Promise<void> { | ||
const uiTestFile = this.page.getByRole('button', { name: `${type}icon ${name}` }); | ||
await expect(uiTestFile).toBeVisible(); | ||
await uiTestFile.click(); | ||
} | ||
|
||
async closePreview(name: string): Promise<void> { | ||
await this.page.locator('header').filter({ hasText: name }).locator('#Close').click(); | ||
} | ||
|
||
async downloadFromPreview(): Promise<void> { | ||
await Promise.all([ | ||
this.page.waitForEvent('download'), | ||
this.page.locator(ObjectBrowserPageObjects.DOWNLOAD_BUTTON_XPATH).click(), | ||
]); | ||
await expect(this.page.getByText('Keep this download link private.')).toBeVisible(); | ||
} | ||
|
||
async verifyObjectMapIsVisible(): Promise<void> { | ||
await this.page.locator(ObjectBrowserPageObjects.DISTRIBUTION_BUTTON_XPATH).click(); | ||
await this.page.locator(ObjectBrowserPageObjects.OBJECT_MAP_IMAGE_XPATH).isVisible(); | ||
await this.page.locator(CommonObjectsV2.CLOSE_MODAL_BUTTON_XPATH).nth(1).click(); | ||
} | ||
|
||
async verifyShareLink(): Promise<void> { | ||
await this.page.locator(ObjectBrowserPageObjects.SHARE_BUTTON_XPATH).click(); | ||
const loader = this.page.locator(ObjectBrowserPageObjects.SHARE_MODAL_LOADER_CLASS); | ||
await expect(loader).toBeHidden(); | ||
await this.page.locator(ObjectBrowserPageObjects.COPY_LINK_BUTTON_XPATH).click(); | ||
await this.page.locator('span').filter({ hasText: ObjectBrowserPageObjects.COPIED_TEXT }).isVisible(); | ||
await this.page.locator(CommonObjectsV2.CLOSE_MODAL_BUTTON_XPATH).nth(1).click(); | ||
} | ||
|
||
async deleteSingleObject(): Promise<void> { | ||
await this.page.locator(ObjectBrowserPageObjects.OBJECT_ROW_MORE_BUTTON_XPATH).click(); | ||
await this.page.locator(ObjectBrowserPageObjects.DELETE_ROW_ACTION_BUTTON_XPATH).click(); | ||
await this.page.locator(ObjectBrowserPageObjects.CONFIRM_DELETE_BUTTON_XPATH).click(); | ||
} | ||
|
||
async deleteObjectByName(name: string, type: string): Promise<void> { | ||
await this.deleteSingleObject(); | ||
await this.page.getByRole('button', { name: `${type}icon ${name}` }).waitFor({ state: 'hidden' }); | ||
} | ||
|
||
async createFolder(folderName: string): Promise<void> { | ||
await this.page.locator(ObjectBrowserPageObjects.CREATE_FOLDER_BUTTON_XPATH).click(); | ||
await this.page.locator(ObjectBrowserPageObjects.FOLDER_NAME_INPUT_XPATH).fill(folderName); | ||
await this.page.locator(ObjectBrowserPageObjects.CONFIRM_CREATE_FOLDER_BUTTON_XPATH).click(); | ||
} | ||
|
||
async verifyImagePreviewIsVisible(): Promise<void> { | ||
await this.page.getByRole('img', { name: 'preview' }).isVisible(); | ||
} | ||
} |
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
Oops, something went wrong.