Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"allure-commandline": "^2.38.1",
"cloudinary": "^2.9.0",
"expect-webdriverio": "^5.6.5",
"wdio-video-reporter": "^6.2.0",
"wdio-vscode-service": "^6.1.4",
"webdriverio": "^9.27.0"
},
Expand Down
164 changes: 164 additions & 0 deletions test/e2e/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions test/e2e/specs/searchAssetFromSideBar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ describe('Search asset from side bar', () => {
it('should find the uploaded asset via sidebar search', async () => {
await activityBarUtils.openView('Cloudinary');
await sideBarViewUtils.homeScreenViewPage.clickBrowseLibraryButton();
await sideBarViewUtils.waitContentToLoad();

await sideBarViewUtils.clickAction(SideBarViewActions.SEARCH);

Expand Down
4 changes: 3 additions & 1 deletion test/e2e/specs/uploadFromSideBarView.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ describe('Upload asset from side bar Upload button', () => {
await uploadToCloudinaryTab.switchBack();

await activityBarUtils.openView('Cloudinary');


await cloudinarySDK.waitUntilAssetIsUploaded(firstAssetPublicID);

await sideBarViewUtils.clickAction(SideBarViewActions.REFRESH);

await sideBarViewUtils.validateContentItemsExist([newFileName.replace('.png', '')]);
Expand Down
11 changes: 11 additions & 0 deletions test/e2e/src/sdks/cloudinarySDK.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { browser } from '@wdio/globals';
import * as cloudinary from 'cloudinary';

/** Optional overrides; values fall back to `E2E_*` environment variables. */
Expand Down Expand Up @@ -36,4 +37,14 @@ export class CloudinarySDK {
get V2(): typeof cloudinary.v2 {
return cloudinary.v2;
}

/**
* Waits until the asset is uploaded and the display name is the expected one.
*/
public async waitUntilAssetIsUploaded(publicId: string) {
await browser.waitUntil(async () => {
const byPublicId = await this.V2.api.resource(publicId);
return byPublicId.public_id === publicId;
}, { timeout: 15000, timeoutMsg: 'Asset not uploaded in time' });
}
}
20 changes: 14 additions & 6 deletions test/e2e/src/vscodeComponentsUtils/SideBarViewUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,20 @@ class SideBarViewUtils {
public async validateContentItemsExist(expectedItems: string[]) {
await allureReporter.addStep(`Validate content items exist: [${expectedItems.join(', ')}]`);
await this.waitContentToLoad();
const content = await this.getSideBarViewContent();
const sections = await content.getSections();
const visibleItems = await sections[0].getVisibleItems() as TreeItem[];
const itemLabels = await Promise.all(
visibleItems.map(item => item.getLabel())
);
let itemLabels: string[] = [];
await browser.waitUntil(async () => {
try {
const content = await this.getSideBarViewContent();
const sections = await content.getSections();
const visibleItems = await sections[0].getVisibleItems() as TreeItem[];
itemLabels = await Promise.all(
visibleItems.map(item => item.getLabel())
);
return itemLabels.includes(expectedItems[0]);
} catch {
return false;
}
}, { timeout: 15000, timeoutMsg: 'Timed out waiting for content items to be available' });

for (const expected of expectedItems) {
expect(itemLabels).toContain(expected);
Expand Down
Loading
Loading