diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b3cbe13..762be08 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,25 +44,23 @@ jobs: run: pnpm eslint . # Ensure you have a lint script in your package.json - - name: Run Tests On Seplia + - name: Run Tests On Sepolia continue-on-error: true run: | echo "Load environment variables" - rm .env.sepolia && touch .env.sepolia - echo API_BASE_URL=${{ secrets.API_BASE_URL }} > .env.sepolia - echo API_PREFIX=${{ secrets.API_PREFIX_SEPOLIA }} >> .env.sepolia - echo API_KEY=${{ secrets.API_KEY }} >> .env.sepolia + rm .env && touch .env + echo API_BASE_URL=${{ secrets.API_BASE_URL }} > .env + echo API_KEY=${{ secrets.API_KEY }} >> .env test_env=sepolia npx playwright test - - name: Run Tests On Renaissance + - name: Run Tests On Story continue-on-error: true run: | echo "Load environment variables" - rm .env.renaissance && touch .env.renaissance - echo API_BASE_URL=${{ secrets.API_BASE_URL }} > .env.renaissance - echo API_PREFIX=${{ secrets.API_PREFIX_RENAISSANCE }} >> .env.renaissance - echo API_KEY=${{ secrets.API_KEY }} >> .env.renaissance - test_env=renaissance npx playwright test + rm .env && touch .env + echo API_BASE_URL=${{ secrets.API_BASE_URL }} > .env + echo API_KEY=${{ secrets.API_KEY }} >> .env + test_env=story npx playwright test - name: Push Slack Notification uses: slackapi/slack-github-action@v1.25.0 @@ -106,6 +104,6 @@ jobs: uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 # if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/main' with: - name: renaissance-test-reports + name: story-test-reports path: | - ./playwright-report-renaissance/index.html + ./playwright-report-story/index.html diff --git a/ci.env b/ci.env index c3e994c..c7710a0 100644 --- a/ci.env +++ b/ci.env @@ -1,3 +1,2 @@ -API_BASE_URL="https://edge.stg.storyprotocol.net" +API_BASE_URL = "https://edge.stg.storyprotocol.net/api/v1/" API_KEY=#API_KEY# -API_PREFIX="/api/sepolia/v1" diff --git a/global-setup.ts b/global-setup.ts deleted file mode 100644 index d8d71a6..0000000 --- a/global-setup.ts +++ /dev/null @@ -1,8 +0,0 @@ -import dotevn from "dotenv"; - -async function globalSetup() { - if (process.env.test_env) { - dotevn.config({ path: `.env.${process.env.test_env}`, override: true }); - } -} -export default globalSetup; diff --git a/playwright.config.ts b/playwright.config.ts index c0b6fd5..13faabf 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -7,7 +7,7 @@ import { defineConfig } from '@playwright/test'; import dotenv from 'dotenv'; dotenv.config(); -const EnvName = process.env.test_env || ''; +const EnvName = process.env.test_env || 'story'; /** * See https://playwright.dev/docs/test-configuration. @@ -15,7 +15,6 @@ const EnvName = process.env.test_env || ''; export default defineConfig({ testDir: './tests', /* Run tests in files in parallel */ - globalSetup: require.resolve('./global-setup'), fullyParallel: true, /* Fail the build on CI if you accidentally left test.only in the source code. */ forbidOnly: !!process.env.CI, @@ -49,6 +48,7 @@ export default defineConfig({ // Add authorization token to all requests. // Assuming personal access token available in the environment. 'X-API-Key': process.env.API_KEY || '', + 'X-CHAIN': `${EnvName}`, }, } }, diff --git a/tests/api/collections/collections.get.spec.ts b/tests/api/collections/collections.get.spec.ts index 8cc508b..6f96927 100644 --- a/tests/api/collections/collections.get.spec.ts +++ b/tests/api/collections/collections.get.spec.ts @@ -1,7 +1,6 @@ import { test, expect } from "../fixtures/base"; -import { ApiPrefix } from "../../constants"; -const endpoint = ApiPrefix + "/collections"; +const endpoint = "./collections"; test.describe("Get a Collection @Collections", async () => { test("Should return a Collection detail", async ({ diff --git a/tests/api/collections/collections.post.spec.ts b/tests/api/collections/collections.post.spec.ts index 40ee8e9..e3f2bfa 100644 --- a/tests/api/collections/collections.post.spec.ts +++ b/tests/api/collections/collections.post.spec.ts @@ -1,7 +1,6 @@ import { test, expect } from "@playwright/test"; -import { ApiPrefix } from "../../constants"; -const endpoint = ApiPrefix + "/collections"; +const endpoint = "./collections"; test.describe("List Collections @Collections", async () => { test("Should return default Collections list", async ({ request }) => { diff --git a/tests/api/disputes/disputes.get.spec.ts b/tests/api/disputes/disputes.get.spec.ts index 9503c1b..4cba0f2 100644 --- a/tests/api/disputes/disputes.get.spec.ts +++ b/tests/api/disputes/disputes.get.spec.ts @@ -1,7 +1,6 @@ import { test, expect } from "../fixtures/base"; -import { ApiPrefix } from "../../constants"; -const endpoint = ApiPrefix + "/disputes"; +const endpoint = "./disputes"; test.describe("Get a Dispute @Disputes", async () => { test("Should return the Dispute detail", async ({ request, disputes }) => { diff --git a/tests/api/disputes/disputes.post.spec.ts b/tests/api/disputes/disputes.post.spec.ts index 4919c90..2fd027e 100644 --- a/tests/api/disputes/disputes.post.spec.ts +++ b/tests/api/disputes/disputes.post.spec.ts @@ -1,7 +1,6 @@ import { test, expect } from "../fixtures/base"; -import { ApiPrefix } from "../../constants"; -const endpoint = ApiPrefix + "/disputes"; +const endpoint = "./disputes"; test.describe("List Disputes @Disputes", async () => { test("Should return default Disputes list", async ({ request }) => { @@ -32,7 +31,7 @@ test.describe("List Disputes @Disputes", async () => { for (const { pagination } of pageParams) { test(`Should return Disputes list with pagination ${JSON.stringify( pagination - )}`, async ({ request }) => { + )}`, async ({ request, disputes }) => { const payload = { options: { pagination: pagination }, }; @@ -49,8 +48,10 @@ test.describe("List Disputes @Disputes", async () => { const { errors, data } = await response.json(); expect(errors).toBeUndefined(); - expect(data.length).toBe(pagination.limit); - expect(data[0]).toMatchObject(firstItem); + expect(data.length).toBeLessThanOrEqual(pagination.limit); + if (pagination.offset < disputes.length) { + expect(data[0]).toMatchObject(firstItem); + } }); } @@ -118,7 +119,7 @@ test.describe("List Disputes @Disputes", async () => { for (const { pagination, orderBy, orderDirection } of pageAndOrderParams) { test(`Should return Disputes list with pagination ${JSON.stringify( pagination - )} ordered by ${orderBy} ${orderDirection}`, async ({ request }) => { + )} ordered by ${orderBy} ${orderDirection}`, async ({ request, disputes }) => { const payload = { options: { pagination, orderBy, orderDirection }, }; @@ -129,8 +130,10 @@ test.describe("List Disputes @Disputes", async () => { const { errors, data } = await response.json(); expect(errors).toBeUndefined(); - expect(data.length).toBeGreaterThan(0); - expect(data.length).toBe(pagination.limit); + if (pagination.offset < disputes.length) { + expect(data.length).toBeGreaterThan(0); + } + expect(data.length).toBeLessThanOrEqual(pagination.limit); for (let i = 0; i < data.length - 1; i++) { const item = data[i][orderBy].trim() || "\uFFFF"; const nextItem = data[i + 1][orderBy].trim() || "\uFFFF"; @@ -151,7 +154,7 @@ test.describe("List Disputes @Disputes", async () => { const whereParams = [ { where: { - targetTag: disputes[1].targetTag, + targetTag: disputes[0].targetTag, }, exists: true, }, @@ -186,7 +189,7 @@ test.describe("List Disputes @Disputes", async () => { exists: false, }, { - where: { initiator: disputes[1].initiator }, + where: { initiator: disputes[0].initiator }, exists: true, }, { @@ -195,8 +198,8 @@ test.describe("List Disputes @Disputes", async () => { }, { where: { - targetTag: disputes[1].targetTag, - targetIpId: disputes[1].targetIpId, + targetTag: disputes[0].targetTag, + targetIpId: disputes[0].targetIpId, }, exists: true, }, @@ -247,8 +250,8 @@ test.describe("List Disputes @Disputes", async () => { orderBy: "id", orderDirection: "desc", where: { - targetTag: disputes[1].targetTag, - initiator: disputes[1].initiator, + targetTag: disputes[0].targetTag, + initiator: disputes[0].initiator, }, }, { @@ -277,7 +280,9 @@ test.describe("List Disputes @Disputes", async () => { const { errors, data } = await response.json(); expect(errors).toBeUndefined(); - expect(data.length).toBeGreaterThan(0); + if (p.pagination.offset < disputes.length) { + expect(data.length).toBeGreaterThan(0); + } expect(data.length).toBeLessThanOrEqual(p.pagination.limit); for (let i = 0; i < data.length - 1; i++) { const item = data[i][p.orderBy].trim() || "\uFFFF"; diff --git a/tests/api/fixtures/base.ts b/tests/api/fixtures/base.ts index 0e4b21e..d78c3dc 100644 --- a/tests/api/fixtures/base.ts +++ b/tests/api/fixtures/base.ts @@ -1,5 +1,4 @@ import { test as base } from "@playwright/test"; -import { ApiPrefix } from "../../constants"; type TestOptions = { assets: Array<{ @@ -8,6 +7,9 @@ type TestOptions = { tokenId: string; metadataResolverAddress: string; tokenContract: string; + metadata: { + registrant: string; + } }>; disputes: Array<{ id: string; @@ -28,7 +30,7 @@ type TestOptions = { }>; licenses: Array<{ id: string; - policyId: string; + licenseTermsId: string; licensorIpId: string; transferable: boolean; }>; @@ -84,72 +86,72 @@ type TestOptions = { export const test = base.extend({ assets: async ({ request }, use) => { - const response = await request.post(ApiPrefix + "/assets"); + const response = await request.post("./assets"); const { data } = await response.json(); await use(data); }, disputes: async ({ request }, use) => { - const response = await request.post(ApiPrefix + "/disputes"); + const response = await request.post("./disputes"); const { data } = await response.json(); await use(data); }, collections: async ({ request }, use) => { - const response = await request.post(ApiPrefix + "/collections"); + const response = await request.post("./collections"); const { data } = await response.json(); await use(data); }, ipapolicies: async ({ request }, use) => { - const response = await request.post(ApiPrefix + "/ipapolicies"); + const response = await request.post("./ipapolicies"); const { data } = await response.json(); await use(data); }, licenses: async ({ request }, use) => { - const response = await request.post(ApiPrefix + "/licenses"); + const response = await request.post("./licenses"); const { data } = await response.json(); await use(data); }, licensesMintingfees: async ({ request }, use) => { - const response = await request.post(ApiPrefix + "/licenses/mintingfees"); + const response = await request.post("./licenses/mintingfees"); const { data } = await response.json(); await use(data); }, licensesOwners: async ({ request }, use) => { - const response = await request.post(ApiPrefix + "/licenses/owners"); + const response = await request.post("./licenses/owners"); const { data } = await response.json(); await use(data); }, modules: async ({ request }, use) => { - const response = await request.post(ApiPrefix + "/modules"); + const response = await request.post("./modules"); const { data } = await response.json(); await use(data); }, permissionsList: async ({ request }, use) => { - const response = await request.post(ApiPrefix + "/permissions"); + const response = await request.post("./permissions"); const { data } = await response.json(); await use(data); }, policies: async ({ request }, use) => { - const response = await request.post(ApiPrefix + "/policies"); + const response = await request.post("./policies"); const { data } = await response.json(); await use(data); }, policiesFrameworks: async ({ request }, use) => { - const response = await request.post(ApiPrefix + "/policies/frameworks"); + const response = await request.post("./policies/frameworks"); const { data } = await response.json(); await use(data); }, transactions: async ({ request }, use) => { - const response = await request.post(ApiPrefix + "/transactions"); + const response = await request.post("./transactions"); const { data } = await response.json(); await use(data); }, royaltiesPayments: async ({ request }, use) => { - const response = await request.post(ApiPrefix + "/royalties/payments"); + const response = await request.post("./royalties/payments"); const { data } = await response.json(); await use(data); }, royaltiesPolicies: async ({ request }, use) => { - const response = await request.post(ApiPrefix + "/royalties/policies"); + const response = await request.post("./royalties/policies"); const { data } = await response.json(); await use(data); }, diff --git a/tests/api/invalid-api-key-test.spec.ts b/tests/api/invalid-api-key-test.spec.ts index 071bfd6..ae86351 100644 --- a/tests/api/invalid-api-key-test.spec.ts +++ b/tests/api/invalid-api-key-test.spec.ts @@ -1,5 +1,4 @@ import { request, test, expect, APIRequestContext } from "@playwright/test"; -import { ApiPrefix } from "../constants"; import crypto from "crypto"; test.describe("Should return 401 for invalid api key @API-KEY", () => { @@ -16,147 +15,147 @@ test.describe("Should return 401 for invalid api key @API-KEY", () => { }); test("Post /assets", async () => { - const response = await context.post(ApiPrefix + "/assets"); + const response = await context.post("./assets"); expect(response.status()).toBe(401); }); test("Get /assets/{assetId}", async () => { - const response = await context.get(ApiPrefix + "/assets/1"); + const response = await context.get("./assets/1"); expect(response.status()).toBe(401); }); test("Post /collections", async () => { - const response = await context.post(ApiPrefix + "/collections"); + const response = await context.post("./collections"); expect(response.status()).toBe(401); }); test("Get /collections/{collectionId}", async () => { - const response = await context.get(ApiPrefix + "/collections/1"); + const response = await context.get("./collections/1"); expect(response.status()).toBe(401); }); test("Post /disputes", async () => { - const response = await context.post(ApiPrefix + "/disputes"); + const response = await context.post("./disputes"); expect(response.status()).toBe(401); }); test("Get /disputes/{disputeId}", async () => { - const response = await context.get(ApiPrefix + "/disputes/1"); + const response = await context.get("./disputes/1"); expect(response.status()).toBe(401); }); test("Post /ipapolicies", async () => { - const response = await context.post(ApiPrefix + "/ipapolicies"); + const response = await context.post("./ipapolicies"); expect(response.status()).toBe(401); }); test("Get /ipapolicies/{ipapolicyId}", async () => { - const response = await context.get(ApiPrefix + "/ipapolicies/1"); + const response = await context.get("./ipapolicies/1"); expect(response.status()).toBe(401); }); test("Post /licenses", async () => { - const response = await context.post(ApiPrefix + "/licenses"); + const response = await context.post("./licenses"); expect(response.status()).toBe(401); }); test("Get /licenses/{licenseId}", async () => { - const response = await context.get(ApiPrefix + "/licenses/1"); + const response = await context.get("./licenses/1"); expect(response.status()).toBe(401); }); test("Post /licenses/mintingfees", async () => { - const response = await context.post(ApiPrefix + "/licenses/mintingfees"); + const response = await context.post("./licenses/mintingfees"); expect(response.status()).toBe(401); }); test("Get /licenses/mintingfees/{mintingfeeId}", async () => { - const response = await context.get(ApiPrefix + "/licenses/mintingfees/1"); + const response = await context.get("./licenses/mintingfees/1"); expect(response.status()).toBe(401); }); test("Post /licenses/owners", async () => { - const response = await context.post(ApiPrefix + "/licenses/owners"); + const response = await context.post("./licenses/owners"); expect(response.status()).toBe(401); }); test("Get /licenses/owners/{ownerId}", async () => { - const response = await context.get(ApiPrefix + "/licenses/owners/1"); + const response = await context.get("./licenses/owners/1"); expect(response.status()).toBe(401); }); test("Post /modules", async () => { - const response = await context.post(ApiPrefix + "/modules"); + const response = await context.post("./modules"); expect(response.status()).toBe(401); }); test("Get /modules/{moduleId}", async () => { - const response = await context.get(ApiPrefix + "/modules/1"); + const response = await context.get("./modules/1"); expect(response.status()).toBe(401); }); test("Post /permissions", async () => { - const response = await context.post(ApiPrefix + "/permissions"); + const response = await context.post("./permissions"); expect(response.status()).toBe(401); }); test("Get /permissions/{permissionId}", async () => { - const response = await context.get(ApiPrefix + "/permissions/1"); + const response = await context.get("./permissions/1"); expect(response.status()).toBe(401); }); test("Post /policies", async () => { - const response = await context.post(ApiPrefix + "/policies"); + const response = await context.post("./policies"); expect(response.status()).toBe(401); }); test("Get /policies/{policyId}", async () => { - const response = await context.get(ApiPrefix + "/policies/1"); + const response = await context.get("./policies/1"); expect(response.status()).toBe(401); }); test("Post /policies/frameworks", async () => { - const response = await context.post(ApiPrefix + "/policies/frameworks"); + const response = await context.post("./policies/frameworks"); expect(response.status()).toBe(401); }); test("Get /policies/frameworks/{frameworkId}", async () => { - const response = await context.get(ApiPrefix + "/policies/frameworks/1"); + const response = await context.get("./policies/frameworks/1"); expect(response.status()).toBe(401); }); test("Post /royalties/payments", async () => { - const response = await context.post(ApiPrefix + "/royalties/payments"); + const response = await context.post("./royalties/payments"); expect(response.status()).toBe(401); }); test("Get /royalties/payments/{paymentId}", async () => { - const response = await context.get(ApiPrefix + "/royalties/payments/1"); + const response = await context.get("./royalties/payments/1"); expect(response.status()).toBe(401); }); test("Post /royalties/policies", async () => { - const response = await context.post(ApiPrefix + "/royalties/policies"); + const response = await context.post("./royalties/policies"); expect(response.status()).toBe(401); }); test("Get /royalties/policies/{policyId}", async () => { - const response = await context.get(ApiPrefix + "/royalties/policies/1"); + const response = await context.get("./royalties/policies/1"); expect(response.status()).toBe(401); }); test("Get /royalties/splits/{splitId}", async () => { - const response = await context.get(ApiPrefix + "/royalties/splits/1"); + const response = await context.get("./royalties/splits/1"); expect(response.status()).toBe(401); }); test("Post /transactions", async () => { - const response = await context.post(ApiPrefix + "/transactions"); + const response = await context.post("./transactions"); expect(response.status()).toBe(401); }); test("Get /transactions/{transactionId}", async () => { - const response = await context.get(ApiPrefix + "/transactions/1"); + const response = await context.get("./transactions/1"); expect(response.status()).toBe(401); }); }); diff --git a/tests/api/ipapolicies/ipapolicies.get.spec.ts b/tests/api/ipapolicies/ipapolicies.get.spec.ts index 4b7129b..49e632d 100644 --- a/tests/api/ipapolicies/ipapolicies.get.spec.ts +++ b/tests/api/ipapolicies/ipapolicies.get.spec.ts @@ -1,7 +1,6 @@ import { test, expect } from "../fixtures/base"; -import { ApiPrefix } from "../../constants"; -const endpoint = ApiPrefix + "/ipapolicies"; +const endpoint = "./ipapolicies"; test.describe("Get a IPAPolicy @IPAPolicies", async () => { test("Should return default IPAPolicy detail", async ({ diff --git a/tests/api/ipapolicies/ipapolicies.post.spec.ts b/tests/api/ipapolicies/ipapolicies.post.spec.ts index 4e859c0..9f25f07 100644 --- a/tests/api/ipapolicies/ipapolicies.post.spec.ts +++ b/tests/api/ipapolicies/ipapolicies.post.spec.ts @@ -1,7 +1,6 @@ import { test, expect } from "../fixtures/base"; -import { ApiPrefix } from "../../constants"; -const endpoint = ApiPrefix + "/ipapolicies"; +const endpoint = "./ipapolicies"; test.describe("List IPAPolicies @IPAPolicies", async () => { test("Should return default IPAPolicies list", async ({ request }) => { diff --git a/tests/api/ipassets/assets.get.spec.ts b/tests/api/ipassets/assets.get.spec.ts index abc1b63..960fc61 100644 --- a/tests/api/ipassets/assets.get.spec.ts +++ b/tests/api/ipassets/assets.get.spec.ts @@ -1,7 +1,6 @@ import { test, expect } from "../fixtures/base"; -import { ApiPrefix } from "../../constants"; -const endpoint = ApiPrefix + "/assets"; +const endpoint = "./assets"; test.describe("Get an IPAsset @IPAssets", () => { test("Should return the IPAsset detail", async ({ request, assets }) => { diff --git a/tests/api/ipassets/assets.post.spec.ts b/tests/api/ipassets/assets.post.spec.ts index 0fe1c82..726b22a 100644 --- a/tests/api/ipassets/assets.post.spec.ts +++ b/tests/api/ipassets/assets.post.spec.ts @@ -1,7 +1,6 @@ import { test, expect } from "../fixtures/base"; -import { ApiPrefix } from "../../constants"; -const endpoint = ApiPrefix + "/assets"; +const endpoint = "./assets"; test.describe("List IPAssets @IPAssets", async () => { test("Should return default IPAssets list", async ({ request }) => { @@ -90,8 +89,12 @@ test.describe("List IPAssets @IPAssets", async () => { expect(errors).toBeUndefined(); expect(data.length).toBeGreaterThan(0); for (let i = 0; i < data.length - 1; i++) { - const item = data[i][orderBy].trim() || "\uFFFF"; - const nextItem = data[i + 1][orderBy].trim() || "\uFFFF"; + let item = data[i][orderBy].trim() || "\uFFFF"; + let nextItem = data[i + 1][orderBy].trim() || "\uFFFF"; + if(orderBy === "tokenId"){ + item = parseInt(data[i][orderBy]); + nextItem = parseInt(data[i + 1][orderBy]); + } if (orderDirection === "asc") { expect(item <= nextItem).toBeTruthy(); } else { diff --git a/tests/api/licenses/licenses-mintingfees.get.spec.ts b/tests/api/licenses/licenses-mintingfees.get.spec.ts index b7a93d0..6a07994 100644 --- a/tests/api/licenses/licenses-mintingfees.get.spec.ts +++ b/tests/api/licenses/licenses-mintingfees.get.spec.ts @@ -1,7 +1,6 @@ import { test, expect } from "../fixtures/base"; -import { ApiPrefix } from "../../constants"; -const endpoint = ApiPrefix + "/licenses/mintingfees"; +const endpoint = "./licenses/mintingfees"; test.describe("Get a Minting Fee @Licenses Minting Fees", async () => { test("Should return Licenses Minting Fees detail", async ({ diff --git a/tests/api/licenses/licenses-mintingfees.post.spec.ts b/tests/api/licenses/licenses-mintingfees.post.spec.ts index 29d1dfd..9b52c1c 100644 --- a/tests/api/licenses/licenses-mintingfees.post.spec.ts +++ b/tests/api/licenses/licenses-mintingfees.post.spec.ts @@ -1,7 +1,6 @@ import { test, expect } from "../fixtures/base"; -import { ApiPrefix } from "../../constants"; -const endpoint = ApiPrefix + "/licenses/mintingfees"; +const endpoint = "./licenses/mintingfees"; test.describe("List Minting Fees @Licenses Minting Fees", async () => { test("Should return default Minting Fees list", async ({ request }) => { diff --git a/tests/api/licenses/licenses-owner.get.spec.ts b/tests/api/licenses/licenses-owner.get.spec.ts index 737cee4..1dd250f 100644 --- a/tests/api/licenses/licenses-owner.get.spec.ts +++ b/tests/api/licenses/licenses-owner.get.spec.ts @@ -1,7 +1,6 @@ import { test, expect } from "../fixtures/base"; -import { ApiPrefix } from "../../constants"; -const endpoint = ApiPrefix + "/licenses/owners"; +const endpoint = "./licenses/owners"; test.describe("Get a License Owner @Licenses Owners", async () => { test("Should return License Owner detail", async ({ diff --git a/tests/api/licenses/licenses-owner.post.spec.ts b/tests/api/licenses/licenses-owner.post.spec.ts index 8a61a3c..6802aa7 100644 --- a/tests/api/licenses/licenses-owner.post.spec.ts +++ b/tests/api/licenses/licenses-owner.post.spec.ts @@ -1,7 +1,6 @@ import { test, expect } from "../fixtures/base"; -import { ApiPrefix } from "../../constants"; -const endpoint = ApiPrefix + "/licenses/owners"; +const endpoint = "./licenses/owners"; test.describe("List License Owners @Licenses Owners", async () => { test("Should return default License Owners list", async ({ request }) => { diff --git a/tests/api/licenses/licenses.get.spec.ts b/tests/api/licenses/licenses.get.spec.ts index fe7b4bf..8993492 100644 --- a/tests/api/licenses/licenses.get.spec.ts +++ b/tests/api/licenses/licenses.get.spec.ts @@ -1,13 +1,12 @@ import { test, expect } from "../fixtures/base"; -import { ApiPrefix } from "../../constants"; -const endpoint = ApiPrefix + "/licenses"; +const endpoint = "./licenses"; test.describe("Get a License @Licenses", async () => { test("Should return Licenses detail", async ({ request, licenses }) => { const params = [ { licenseId: licenses[1].id, exists: true }, - { licenseId: "0", exists: false }, + { licenseId: "-1", exists: false }, ]; for (const { licenseId, exists } of params) { await test.step(`Query with licenseId ${licenseId}`, async () => { @@ -18,12 +17,16 @@ test.describe("Get a License @Licenses", async () => { expect(errors).toBeUndefined(); if (exists) { expect(data.id).toBe(licenseId); - expect(typeof data.policyId).toBe("string"); + expect(typeof data.licenseTermsId).toBe("string"); expect(typeof data.licensorIpId).toBe("string"); - expect(typeof data.amount).toBe("string"); + expect(typeof data.licenseTemplate).toBe("string"); expect(typeof data.transferable).toBe("boolean"); + expect(typeof data.owner).toBe("string"); + expect(typeof data.mintedAt).toBe("string"); + expect(typeof data.expiresAt).toBe("string"); + expect(typeof data.burntAt).toBe("string"); expect(typeof data.blockNumber).toBe("string"); - expect(typeof data.blockTimestamp).toBe("string"); + expect(typeof data.blockTime).toBe("string"); } else { expect(data).toBeNull(); } diff --git a/tests/api/licenses/licenses.post.spec.ts b/tests/api/licenses/licenses.post.spec.ts index bf02cff..eeebbe9 100644 --- a/tests/api/licenses/licenses.post.spec.ts +++ b/tests/api/licenses/licenses.post.spec.ts @@ -1,7 +1,6 @@ import { test, expect } from "../fixtures/base"; -import { ApiPrefix } from "../../constants"; -const endpoint = ApiPrefix + "/licenses"; +const endpoint = "./licenses"; test.describe("List Licenses @Licenses", async () => { test("Should return default Licenses list", async ({ request }) => { @@ -13,12 +12,16 @@ test.describe("List Licenses @Licenses", async () => { expect(Array.isArray(data)).toBeTruthy(); expect(data.length).toBeGreaterThan(0); expect(typeof data[0].id).toBe("string"); - expect(typeof data[0].policyId).toBe("string"); + expect(typeof data[0].licenseTermsId).toBe("string"); expect(typeof data[0].licensorIpId).toBe("string"); - expect(typeof data[0].amount).toBe("string"); + expect(typeof data[0].licenseTemplate).toBe("string"); expect(typeof data[0].transferable).toBe("boolean"); + expect(typeof data[0].owner).toBe("string"); + expect(typeof data[0].mintedAt).toBe("string"); + expect(typeof data[0].expiresAt).toBe("string"); + expect(typeof data[0].burntAt).toBe("string"); expect(typeof data[0].blockNumber).toBe("string"); - expect(typeof data[0].blockTimestamp).toBe("string"); + expect(typeof data[0].blockTime).toBe("string"); }); const pageParams = [ @@ -54,8 +57,8 @@ test.describe("List Licenses @Licenses", async () => { const orderParams = [ { orderBy: "id", orderDirection: "desc" }, { orderBy: "id", orderDirection: "asc" }, - { orderBy: "policyId", orderDirection: "desc" }, - { orderBy: "policyId", orderDirection: "asc" }, + { orderBy: "licenseTermsId", orderDirection: "desc" }, + { orderBy: "licenseTermsId", orderDirection: "asc" }, { orderBy: "licensorIpId", orderDirection: "desc" }, { orderBy: "licensorIpId", orderDirection: "asc" }, { orderBy: "amount", orderDirection: "desc" }, @@ -64,8 +67,8 @@ test.describe("List Licenses @Licenses", async () => { { orderBy: "transferable", orderDirection: "asc" }, { orderBy: "blockNumber", orderDirection: "desc" }, { orderBy: "blockNumber", orderDirection: "asc" }, - { orderBy: "blockTimestamp", orderDirection: "desc" }, - { orderBy: "blockTimestamp", orderDirection: "asc" }, + { orderBy: "blockTime", orderDirection: "desc" }, + { orderBy: "blockTime", orderDirection: "asc" }, ]; for (const { orderBy, orderDirection } of orderParams) { test(`Should return Licenses list ordered by ${orderBy} ${orderDirection}`, async ({ @@ -107,7 +110,7 @@ test.describe("List Licenses @Licenses", async () => { const pageAndOrderParams = [ { pagination: { offset: 0, limit: 5 }, - orderBy: "policyId", + orderBy: "licenseTermsId", orderDirection: "desc", }, { @@ -160,8 +163,8 @@ test.describe("List Licenses @Licenses", async () => { where: { licensorIpId: "0x4f4eda51d35f19a8372bf3894fdc2dbeff73d999" }, exists: false, }, - { where: { policyId: licenses[2].policyId }, exists: true }, - { where: { policyId: "0" }, exists: false }, + { where: { licenseTermsId: licenses[2].licenseTermsId }, exists: true }, + { where: { licenseTermsId: "0" }, exists: false }, { where: { transferable: true }, exists: true }, { where: { transferable: false }, exists: true }, ]; @@ -196,9 +199,9 @@ test.describe("List Licenses @Licenses", async () => { const params = [ { pagination: { offset: 0, limit: 4 }, - orderBy: "policyId", + orderBy: "licenseTermsId", orderDirection: "asc", - where: { policyId: licenses[0].policyId, transferable: true }, + where: { licenseTermsId: licenses[0].licenseTermsId, transferable: true }, }, { pagination: { offset: 0, limit: 3 }, @@ -206,7 +209,7 @@ test.describe("List Licenses @Licenses", async () => { orderDirection: "desc", where: { licensorIpId: licenses[1].licensorIpId, - policyId: licenses[1].policyId, + licenseTermsId: licenses[1].licenseTermsId, }, }, ]; diff --git a/tests/api/modules/modules.get.spec.ts b/tests/api/modules/modules.get.spec.ts index 309e464..f60427c 100644 --- a/tests/api/modules/modules.get.spec.ts +++ b/tests/api/modules/modules.get.spec.ts @@ -1,7 +1,6 @@ import { test, expect } from "../fixtures/base"; -import { ApiPrefix } from "../../constants"; -const endpoint = ApiPrefix + "/modules"; +const endpoint = "./modules"; test.describe("Get a Module @Modules", async () => { test("Should return Modules detail", async ({ request, modules }) => { diff --git a/tests/api/modules/modules.post.spec.ts b/tests/api/modules/modules.post.spec.ts index 6a8f9c9..9c05ed7 100644 --- a/tests/api/modules/modules.post.spec.ts +++ b/tests/api/modules/modules.post.spec.ts @@ -1,7 +1,6 @@ import { test, expect } from "../fixtures/base"; -import { ApiPrefix } from "../../constants"; -const endpoint = ApiPrefix + "/modules"; +const endpoint = "./modules"; test.describe("List Modules @Modules", async () => { test("Should return default Modules list", async ({ request }) => { diff --git a/tests/api/permissions/permissions.get.spec.ts b/tests/api/permissions/permissions.get.spec.ts index f62f84b..bf46758 100644 --- a/tests/api/permissions/permissions.get.spec.ts +++ b/tests/api/permissions/permissions.get.spec.ts @@ -1,7 +1,6 @@ import { test, expect } from "../fixtures/base"; -import { ApiPrefix } from "../../constants"; -const endpoint = ApiPrefix + "/permissions"; +const endpoint = "./permissions"; test.describe("Get a Permission @Permissions", async () => { test("Should return Permissions detail @bug", async ({ diff --git a/tests/api/permissions/permissions.post.spec.ts b/tests/api/permissions/permissions.post.spec.ts index 35d282d..ae4d059 100644 --- a/tests/api/permissions/permissions.post.spec.ts +++ b/tests/api/permissions/permissions.post.spec.ts @@ -1,7 +1,6 @@ import { test, expect } from "../fixtures/base"; -import { ApiPrefix } from "../../constants"; -const endpoint = ApiPrefix + "/permissions"; +const endpoint = "./permissions"; test.describe("List Permissions @Permissions", async () => { test("Should return default Permissions list", async ({ request }) => { diff --git a/tests/api/policies/policies-frameworks.get.spec.ts b/tests/api/policies/policies-frameworks.get.spec.ts index 380cf7f..34f3bb2 100644 --- a/tests/api/policies/policies-frameworks.get.spec.ts +++ b/tests/api/policies/policies-frameworks.get.spec.ts @@ -1,7 +1,6 @@ import { test, expect } from "../fixtures/base"; -import { ApiPrefix } from "../../constants"; -const endpoint = ApiPrefix + "/policies/frameworks"; +const endpoint = "./policies/frameworks"; test.describe("Get a Policy Framework @Policies", async () => { test("Should return Policy Framework detail", async ({ diff --git a/tests/api/policies/policies-frameworks.post.spec.ts b/tests/api/policies/policies-frameworks.post.spec.ts index 7c1cd6e..e793634 100644 --- a/tests/api/policies/policies-frameworks.post.spec.ts +++ b/tests/api/policies/policies-frameworks.post.spec.ts @@ -1,7 +1,6 @@ import { test, expect } from "../fixtures/base"; -import { ApiPrefix } from "../../constants"; -const endpoint = ApiPrefix + "/policies/frameworks"; +const endpoint = "./policies/frameworks"; test.describe("List Policies Frameworks @Policies", async () => { test("Should return default Policies Frameworks list", async ({ diff --git a/tests/api/policies/policies.get.spec.ts b/tests/api/policies/policies.get.spec.ts index 6c40875..cc4649f 100644 --- a/tests/api/policies/policies.get.spec.ts +++ b/tests/api/policies/policies.get.spec.ts @@ -1,7 +1,6 @@ import { test, expect } from "../fixtures/base"; -import { ApiPrefix } from "../../constants"; -const endpoint = ApiPrefix + "/policies"; +const endpoint = "./policies"; test.describe("Get a Policy @Policies", async () => { test("Should return Policies detail", async ({ request, policies }) => { diff --git a/tests/api/policies/policies.post.spec.ts b/tests/api/policies/policies.post.spec.ts index d44190c..755e364 100644 --- a/tests/api/policies/policies.post.spec.ts +++ b/tests/api/policies/policies.post.spec.ts @@ -1,7 +1,6 @@ import { test, expect } from "../fixtures/base"; -import { ApiPrefix } from "../../constants"; -const endpoint = ApiPrefix + "/policies"; +const endpoint = "./policies"; test.describe("List Policies @Policies", async () => { test("Should return default Policies list", async ({ request }) => { diff --git a/tests/api/royalties/royalties-payments.get.spec.ts b/tests/api/royalties/royalties-payments.get.spec.ts index a289815..c5d7de1 100644 --- a/tests/api/royalties/royalties-payments.get.spec.ts +++ b/tests/api/royalties/royalties-payments.get.spec.ts @@ -1,7 +1,6 @@ import { test, expect } from "../fixtures/base"; -import { ApiPrefix } from "../../constants"; -const endpoint = ApiPrefix + "/royalties/payments"; +const endpoint = "./royalties/payments"; test.describe("Get a RoyaltyPay @Royalties", () => { test("Should return RoyaltyPay detail", async ({ diff --git a/tests/api/royalties/royalties-payments.post.spec.ts b/tests/api/royalties/royalties-payments.post.spec.ts index 16a1464..fc34d20 100644 --- a/tests/api/royalties/royalties-payments.post.spec.ts +++ b/tests/api/royalties/royalties-payments.post.spec.ts @@ -1,7 +1,6 @@ import { test, expect } from "../fixtures/base"; -import { ApiPrefix } from "../../constants"; -const endpoint = ApiPrefix + "/royalties/payments"; +const endpoint = "./royalties/payments"; test.describe("List RoyaltyPays @Royalties", () => { test("Should return default Royalty Pays list", async ({ request }) => { diff --git a/tests/api/royalties/royalties-policies.get.spec.ts b/tests/api/royalties/royalties-policies.get.spec.ts index 9ad09b5..2bc4615 100644 --- a/tests/api/royalties/royalties-policies.get.spec.ts +++ b/tests/api/royalties/royalties-policies.get.spec.ts @@ -1,7 +1,6 @@ import { test, expect } from "../fixtures/base"; -import { ApiPrefix } from "../../constants"; -const endpoint = ApiPrefix + "/royalties/policies"; +const endpoint = "./royalties/policies"; test.describe("Get a Royalties Policy @Royalties", () => { test("Should return Royalties Policy detail", async ({ @@ -25,7 +24,7 @@ test.describe("Get a Royalties Policy @Royalties", () => { if (exists) { expect(data.id).toBe(royaltyPolicyId); expect(typeof data.royaltyStack).toBe("string"); - expect(typeof data.splitClone).toBe("string"); + expect(typeof data.ipRoyaltyVault).toBe("string"); expect(typeof data.ancestorsVault).toBe("string"); expect(Array.isArray(data.targetAncestors)).toBeTruthy(); expect(Array.isArray(data.targetRoyaltyAmount)).toBeTruthy(); diff --git a/tests/api/royalties/royalties-policies.post.spec.ts b/tests/api/royalties/royalties-policies.post.spec.ts index 61a0517..1362ad4 100644 --- a/tests/api/royalties/royalties-policies.post.spec.ts +++ b/tests/api/royalties/royalties-policies.post.spec.ts @@ -1,7 +1,6 @@ import { test, expect } from "../fixtures/base"; -import { ApiPrefix } from "../../constants"; -const endpoint = ApiPrefix + "/royalties/policies"; +const endpoint = "./royalties/policies"; test.describe("List RoyaltyPolicies @Royalties", () => { test("Should return default Royalty Policies list", async ({ request }) => { @@ -14,7 +13,7 @@ test.describe("List RoyaltyPolicies @Royalties", () => { expect(data.length).toBeGreaterThan(0); expect(typeof data[0].id).toBe("string"); expect(typeof data[0].royaltyStack).toBe("string"); - expect(typeof data[0].splitClone).toBe("string"); + expect(typeof data[0].ipRoyaltyVault).toBe("string"); expect(typeof data[0].ancestorsVault).toBe("string"); expect(Array.isArray(data[0].targetAncestors)).toBeTruthy(); expect(Array.isArray(data[0].targetRoyaltyAmount)).toBeTruthy(); @@ -57,8 +56,8 @@ test.describe("List RoyaltyPolicies @Royalties", () => { { orderBy: "id", orderDirection: "asc" }, { orderBy: "royaltyStack", orderDirection: "desc" }, { orderBy: "royaltyStack", orderDirection: "asc" }, - { orderBy: "splitClone", orderDirection: "desc" }, - { orderBy: "splitClone", orderDirection: "asc" }, + { orderBy: "ipRoyaltyVault", orderDirection: "desc" }, + { orderBy: "ipRoyaltyVault", orderDirection: "asc" }, { orderBy: "ancestorsVault", orderDirection: "desc" }, { orderBy: "ancestorsVault", orderDirection: "asc" }, { orderBy: "blockNumber", orderDirection: "desc" }, diff --git a/tests/api/royalties/royalties.splits.get.spec.ts b/tests/api/royalties/royalties.splits.get.spec.ts index 6a8c378..96a99d5 100644 --- a/tests/api/royalties/royalties.splits.get.spec.ts +++ b/tests/api/royalties/royalties.splits.get.spec.ts @@ -1,7 +1,6 @@ import { test, expect } from "../fixtures/base"; -import { ApiPrefix } from "../../constants"; -const endpoint = ApiPrefix + "/royalties/splits"; +const endpoint = "./royalties/splits"; test.describe("Get a Royalties Split @Royalties", () => { test("Should return Royalties Split detail @bug", async ({ diff --git a/tests/api/transactions/transactions.get.spec.ts b/tests/api/transactions/transactions.get.spec.ts index 3616828..c3eb073 100644 --- a/tests/api/transactions/transactions.get.spec.ts +++ b/tests/api/transactions/transactions.get.spec.ts @@ -1,7 +1,6 @@ import { test, expect } from "../fixtures/base"; -import { ApiPrefix } from "../../constants"; -const endpoint = ApiPrefix + "/transactions"; +const endpoint = "./transactions"; test.describe("Get a Transaction @Transactions", async () => { test("Should return Transaction detail", async ({ diff --git a/tests/api/transactions/transactions.post.spec.ts b/tests/api/transactions/transactions.post.spec.ts index 9f1576e..d4ab40e 100644 --- a/tests/api/transactions/transactions.post.spec.ts +++ b/tests/api/transactions/transactions.post.spec.ts @@ -1,7 +1,6 @@ import { test, expect } from "../fixtures/base"; -import { ApiPrefix } from "../../constants"; -const endpoint = ApiPrefix + "/transactions"; +const endpoint = "./transactions"; test.describe("List Transactions @Transactions", async () => { test("Should return default Transactions list", async ({ request }) => { diff --git a/tests/constants.ts b/tests/constants.ts deleted file mode 100644 index bd8afb4..0000000 --- a/tests/constants.ts +++ /dev/null @@ -1 +0,0 @@ -export const ApiPrefix = process.env.API_PREFIX || '/api/v1'; \ No newline at end of file