mirror of
https://github.com/logos-storage/logos-storage-marketplace-ui.git
synced 2026-01-02 13:33:06 +00:00
Fix tests
This commit is contained in:
parent
027d756fb1
commit
44d6b17599
@ -3,7 +3,7 @@ import test, { expect } from "@playwright/test";
|
||||
test('create an availability', async ({ page }) => {
|
||||
await page.goto('/dashboard/availabilities');
|
||||
await page.waitForTimeout(500);
|
||||
await page.locator('.availabilities-create').first().click();
|
||||
await page.locator('.availability-edit button').first().click();
|
||||
await page.getByLabel('Total size').click();
|
||||
await page.getByLabel('Total size').fill('0.50');
|
||||
await page.getByLabel('Duration').click();
|
||||
@ -17,7 +17,6 @@ test('create an availability', async ({ page }) => {
|
||||
await page.getByLabel('Nickname').fill('test');
|
||||
await page.getByRole('button', { name: 'Next' }).click();
|
||||
await expect(page.getByText('Confirm your new sale')).toBeVisible();
|
||||
await expect(page.getByText('512.0 MB').first()).toBeVisible();
|
||||
await page.getByRole('button', { name: 'Next' }).click();
|
||||
await expect(page.getByText('Success', { exact: true })).toBeVisible();
|
||||
await page.getByRole('button', { name: 'Finish' }).click();
|
||||
@ -27,7 +26,7 @@ test('create an availability', async ({ page }) => {
|
||||
test('availability navigation buttons', async ({ page }) => {
|
||||
await page.goto('/dashboard/availabilities');
|
||||
await page.waitForTimeout(500);
|
||||
await page.locator('.availabilities-create').first().click();
|
||||
await page.locator('.availability-edit button').first().click();
|
||||
await expect(page.locator('.stepper-number-done')).not.toBeVisible()
|
||||
await expect(page.locator('.step--active')).toBeVisible()
|
||||
await expect(page.locator('footer .button--primary')).not.toHaveAttribute("disabled");
|
||||
|
||||
@ -4,17 +4,17 @@ test('create a folder', async ({ page }) => {
|
||||
await page.goto('/dashboard');
|
||||
await page.locator('#folder').click();
|
||||
await page.locator('#folder').fill('abc');
|
||||
await expect(page.getByText('Enter the folder name')).toBeVisible();
|
||||
await expect(page.getByPlaceholder('Folder name')).toBeVisible();
|
||||
await page.locator('#folder').fill('abc ');
|
||||
await expect(page.getByText('9 alpha characters maximum')).toBeVisible();
|
||||
await expect(page.getByPlaceholder('Folder name')).toHaveAttribute("aria-invalid", "true");
|
||||
await page.locator('#folder').fill('abc !');
|
||||
await expect(page.getByText('9 alpha characters maximum')).toBeVisible();
|
||||
await expect(page.getByPlaceholder('Folder name')).toHaveAttribute("aria-invalid", "true");
|
||||
await page.locator('#folder').fill('abc )');
|
||||
await expect(page.getByText('9 alpha characters maximum')).toBeVisible();
|
||||
await expect(page.getByPlaceholder('Folder name')).toHaveAttribute("aria-invalid", "true");
|
||||
await page.locator('#folder').fill('Favorites )');
|
||||
await expect(page.getByText('This folder already exists')).toBeVisible();
|
||||
await expect(page.getByPlaceholder('Folder name')).toHaveAttribute("aria-invalid", "true");
|
||||
await page.locator('#folder').fill('abc-_');
|
||||
await expect(page.getByText('Enter the folder name')).toBeVisible();
|
||||
await expect(page.getByPlaceholder('Folder name')).toBeVisible();
|
||||
await page.getByRole('button', { name: 'Folder' }).click();
|
||||
await expect(page.locator('span').filter({ hasText: 'abc-_' })).toBeVisible();
|
||||
await expect(page.locator('span').filter({ hasText: 'abc-_' }).first()).toBeVisible();
|
||||
})
|
||||
@ -19,8 +19,8 @@ test('onboarding steps', async ({ page }) => {
|
||||
await expect(page.locator(".health-checks ul li").nth(2).getByTestId("icon-success")).toBeVisible()
|
||||
|
||||
// Codex node
|
||||
await expect(page.locator(".health-checks ul li").nth(3).getByTestId("icon-error")).not.toBeVisible()
|
||||
await expect(page.locator(".health-checks ul li").nth(3).getByTestId("icon-success")).toBeVisible()
|
||||
await expect(page.locator(".health-checks ul li").nth(2).getByTestId("icon-error")).not.toBeVisible()
|
||||
await expect(page.locator(".health-checks ul li").nth(2).getByTestId("icon-success")).toBeVisible()
|
||||
|
||||
// Marketplace
|
||||
await expect(page.locator(".health-checks ul li").nth(4).getByTestId("icon-error")).not.toBeVisible()
|
||||
|
||||
@ -14,17 +14,17 @@ test('update the URL with wrong URL applies', async ({ page }) => {
|
||||
await page.getByLabel('Address').click();
|
||||
await page.getByLabel('Address').fill('hello');
|
||||
await expect(page.getByLabel('Address')).toHaveAttribute("aria-invalid")
|
||||
await expect(page.locator(".refresh svg")).toHaveAttribute("aria-disabled")
|
||||
await expect(page.locator(".refresh svg")).toHaveAttribute("color", "#494949")
|
||||
await page.getByLabel('Address').fill('http://127.0.0.1:8079');
|
||||
await expect(page.getByLabel('Address')).not.toHaveAttribute("aria-invalid")
|
||||
await expect(page.locator(".refresh svg")).not.toHaveAttribute("aria-disabled")
|
||||
await expect(page.getByLabel('Address')).toHaveValue("http://127.0.0.1")
|
||||
await expect(page.getByLabel('Port')).toHaveValue("8079")
|
||||
await page.locator(".refresh").click()
|
||||
await expect(page.locator(".health-checks ul li").nth(3).getByTestId("icon-error")).toBeVisible()
|
||||
await expect(page.locator(".health-checks ul li").nth(3).getByTestId("icon-success")).not.toBeVisible()
|
||||
await expect(page.locator(".health-checks ul li").nth(2).getByTestId("icon-error")).toBeVisible()
|
||||
await expect(page.locator(".health-checks ul li").nth(2).getByTestId("icon-success")).not.toBeVisible()
|
||||
await page.getByLabel('Address').fill('http://127.0.0.1:8080');
|
||||
await page.locator(".refresh").click()
|
||||
await expect(page.locator(".health-checks ul li").nth(3).getByTestId("icon-error")).not.toBeVisible()
|
||||
await expect(page.locator(".health-checks ul li").nth(3).getByTestId("icon-success")).toBeVisible()
|
||||
await expect(page.locator(".health-checks ul li").nth(2).getByTestId("icon-error")).not.toBeVisible()
|
||||
await expect(page.locator(".health-checks ul li").nth(2).getByTestId("icon-success")).toBeVisible()
|
||||
})
|
||||
@ -20,7 +20,7 @@ test('create a storage request', async ({ page }) => {
|
||||
await expect(page.getByText('Your request is being processed.')).toBeVisible();
|
||||
await page.getByRole('button', { name: 'Finish' }).click();
|
||||
await expect(page.getByText('No data.')).not.toBeVisible();
|
||||
await page.getByRole('cell', { name: 'pending' }).getByRole('paragraph').click();
|
||||
await expect(page.getByTestId('cell-submitted').first()).toBeVisible();
|
||||
})
|
||||
|
||||
test('select a uploaded cid when creating a storage request', async ({ page }) => {
|
||||
@ -30,7 +30,7 @@ test('select a uploaded cid when creating a storage request', async ({ page }) =
|
||||
]);
|
||||
await page.locator('a').filter({ hasText: 'Purchases' }).click();
|
||||
await page.getByRole('button', { name: 'Storage Request' }).click();
|
||||
await page.getByPlaceholder('Select or type your CID').click();
|
||||
await page.getByPlaceholder('CID').click();
|
||||
await page.locator('.dropdown ul li').nth(1).click();
|
||||
await expect(page.getByText('button[disabled]')).not.toBeVisible();
|
||||
})
|
||||
@ -73,6 +73,6 @@ test('remove the CID when the file is deleted', async ({ page }) => {
|
||||
path.join(__dirname, "assets", 'chatgpt.jpg'),
|
||||
]);
|
||||
await expect(page.locator('#cid')).not.toBeEmpty()
|
||||
await page.locator('.button-icon--small').click();
|
||||
await page.locator('.button-icon--small').nth(1).click();
|
||||
await expect(page.locator('#cid')).toBeEmpty()
|
||||
})
|
||||
|
||||
8
package-lock.json
generated
8
package-lock.json
generated
@ -9,7 +9,7 @@
|
||||
"version": "0.0.7",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@codex-storage/marketplace-ui-components": "^0.0.43",
|
||||
"@codex-storage/marketplace-ui-components": "0.0.44",
|
||||
"@codex-storage/sdk-js": "^0.0.15",
|
||||
"@sentry/browser": "^8.32.0",
|
||||
"@sentry/react": "^8.31.0",
|
||||
@ -424,9 +424,9 @@
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/@codex-storage/marketplace-ui-components": {
|
||||
"version": "0.0.43",
|
||||
"resolved": "https://registry.npmjs.org/@codex-storage/marketplace-ui-components/-/marketplace-ui-components-0.0.43.tgz",
|
||||
"integrity": "sha512-rNhLfbJXu/1ZKh8hTnD2PkUcj/6M0/jHEfHJ86vIgFX4AFPq4+XGMstylx33VZAUYiDCEAc8iyJV/hMXjTNOsA==",
|
||||
"version": "0.0.44",
|
||||
"resolved": "https://registry.npmjs.org/@codex-storage/marketplace-ui-components/-/marketplace-ui-components-0.0.44.tgz",
|
||||
"integrity": "sha512-ZOTQ04OwtFVJ0+MejBiKxi3F5UJRdbLbYN6S9aKvb6ozBYknz3Oxa9wwPVn5r0Gme0A+MwHckx6tnG6EUHclzg==",
|
||||
"dependencies": {
|
||||
"lucide-react": "^0.453.0"
|
||||
},
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
"React"
|
||||
],
|
||||
"dependencies": {
|
||||
"@codex-storage/marketplace-ui-components": "^0.0.43",
|
||||
"@codex-storage/marketplace-ui-components": "^0.0.44",
|
||||
"@codex-storage/sdk-js": "^0.0.15",
|
||||
"@sentry/browser": "^8.32.0",
|
||||
"@sentry/react": "^8.31.0",
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<svg
|
||||
data-testid="icon-success"
|
||||
width="20"
|
||||
height="20"
|
||||
viewBox="0 0 20 20"
|
||||
|
||||
|
Before Width: | Height: | Size: 389 B After Width: | Height: | Size: 418 B |
@ -18,26 +18,25 @@ export const CustomStateCellRender = ({ state, message }: Props) => {
|
||||
errored: ErrorCircleIcon,
|
||||
};
|
||||
|
||||
const states = {
|
||||
cancelled: "error",
|
||||
errored: "error",
|
||||
pending: "warning",
|
||||
started: "loading",
|
||||
submitted: "loading",
|
||||
finished: "success",
|
||||
};
|
||||
|
||||
const Icon = icons[state as keyof typeof icons] || PurchaseStateIcon;
|
||||
|
||||
return (
|
||||
<Cell>
|
||||
<p className={"cell-state" + states[state as keyof typeof states]}>
|
||||
<p className={"cell-state"}>
|
||||
{message ? (
|
||||
<Tooltip message={message}>
|
||||
<Icon width={20} className="cell-stateIcon" />
|
||||
<Icon
|
||||
width={20}
|
||||
className="cell-stateIcon"
|
||||
data-testid={"cell-" + state}
|
||||
/>
|
||||
</Tooltip>
|
||||
) : (
|
||||
<Icon width={20} className="cell-stateIcon" />
|
||||
<Icon
|
||||
width={20}
|
||||
className="cell-stateIcon"
|
||||
data-testid={"cell-" + state}
|
||||
/>
|
||||
)}
|
||||
</p>
|
||||
</Cell>
|
||||
|
||||
@ -67,7 +67,7 @@ export function StorageRequestFileChooser({
|
||||
id="cid"
|
||||
placeholder="CID"
|
||||
onChange={onChange}
|
||||
value={storageRequest.cid}
|
||||
value={storageRequest.cid || ""}
|
||||
options={options}
|
||||
onSelected={onSelected}
|
||||
size="medium"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user