diff --git a/tests/e2e/runtime/apis.spec.ts b/tests/e2e/runtime/apis.spec.ts index 8654ac6f5..f03b8c381 100644 --- a/tests/e2e/runtime/apis.spec.ts +++ b/tests/e2e/runtime/apis.spec.ts @@ -23,7 +23,8 @@ describe("Apis page", async () => { it("User can see apis on the page", async () => { var apis = new Apis(); - apis.addApi(Api.getEchoApi()); + apis.addApi(Api.getRandomApi()); + apis.addApi(Api.getRandomApi()); server = await Utils.createMockServer([apis.getApisListResponse()]); const page = await browser.newPage(); diff --git a/tests/mocks/collection/api.ts b/tests/mocks/collection/api.ts index a69df70d8..9789f6039 100644 --- a/tests/mocks/collection/api.ts +++ b/tests/mocks/collection/api.ts @@ -1,3 +1,5 @@ +import { Utils } from "../../utils"; + export class Api{ public apiId: string; public apiName: string; @@ -49,4 +51,8 @@ export class Api{ public static getEchoApi(){ return new Api("echo-api", "Echo api"); } + + public static getRandomApi(){ + return new Api(Utils.randomIdentifier(), Utils.randomIdentifier()); + } } diff --git a/tests/utils.ts b/tests/utils.ts index 593654bb5..358b5553e 100644 --- a/tests/utils.ts +++ b/tests/utils.ts @@ -26,6 +26,18 @@ export class Utils { return sasToken; } + public static randomIdentifier(length: number = 8): string { + let result = ""; + const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + const charactersLength = characters.length; + + for (let i = 0; i < length; i++) { + result += characters.charAt(Math.floor(Math.random() * charactersLength)); + } + + return result; + } + public static async createMockServer(responses?: Object[]) { var obj = {}; if (responses?.length){