Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Releases/v0.0.13 #89

Merged
merged 48 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
44d6b17
Fix tests
2-towns Nov 14, 2024
f49f608
Fix undefined value when deleting the url
2-towns Nov 20, 2024
3fbd0c8
Update codex version
2-towns Nov 20, 2024
dbc4562
Update marketplace address
2-towns Nov 20, 2024
810a7f5
Clean components and update dependencies
2-towns Nov 20, 2024
6abbb53
Fix unit test to use GMT
2-towns Nov 20, 2024
d22f331
Upload artifacts except when job is cancelled
2-towns Nov 20, 2024
155615d
Fix tests
2-towns Nov 20, 2024
f62ad91
Increase timeout when checking marketplace
2-towns Nov 20, 2024
68e393b
Bump dependencies
2-towns Nov 21, 2024
b258e40
Refactoring
2-towns Nov 21, 2024
37592fc
Remove unused variable
2-towns Nov 21, 2024
6025164
Use announce address to check the TCP port
2-towns Nov 21, 2024
eed0331
Fix build
2-towns Nov 21, 2024
169e192
Move to React Router and use preact for better performance
2-towns Nov 21, 2024
e30618b
Update version
2-towns Nov 21, 2024
6f4eb2d
Update icons
2-towns Nov 21, 2024
b576d71
Remove the proxy object for the port forwarding
2-towns Nov 21, 2024
cd48cbc
Fix availabilities style
2-towns Nov 21, 2024
ca2b536
Update dependencies
2-towns Nov 22, 2024
5a64c1a
Update icons
2-towns Nov 22, 2024
10de82b
Update vite config to have hot reload with preact
2-towns Nov 22, 2024
3304a64
Fix import not used
2-towns Nov 22, 2024
3f64433
Make style responsive
2-towns Nov 22, 2024
ae5f037
Fix icon size
2-towns Nov 22, 2024
06f66f9
Fix mobile menu display
2-towns Nov 22, 2024
07917f8
Restablish previous peer component
2-towns Nov 25, 2024
35192b5
Add currency converter
2-towns Nov 25, 2024
9edf09b
Add chart for connected account
2-towns Nov 25, 2024
4f30b9d
Refactor css variables
2-towns Nov 26, 2024
a61207c
Refactory bytes pretty
2-towns Nov 27, 2024
dc8b42c
Use slots instead of purchases to check marketplace in order to avoid…
2-towns Nov 27, 2024
b90b5bd
Allow to create a storage request for days and months
2-towns Nov 27, 2024
cd35972
Fix the contract duration unit
2-towns Nov 27, 2024
174dcf7
Update the availability duration and size input
2-towns Nov 27, 2024
d576020
Fix lint
2-towns Nov 27, 2024
492e258
Fix unit test
2-towns Nov 27, 2024
1b9bc61
Update codex version
2-towns Nov 27, 2024
3072622
Fix stepper validation issue
2-towns Nov 27, 2024
7bb34ce
Fix unit test
2-towns Nov 27, 2024
cef126a
Use the week starting dates
2-towns Nov 27, 2024
1f4e7d0
Add other currencies to the wallet
2-towns Nov 27, 2024
e6e7730
Limit the contract duration to 7 for the testnet
2-towns Nov 27, 2024
40c0b84
Fix tests
2-towns Nov 27, 2024
333cd5b
Fix misleading title #88
2-towns Nov 28, 2024
6d843d0
Fix response style
2-towns Nov 28, 2024
dd85353
Fix responsive and minors bugs
2-towns Nov 28, 2024
ab704ae
Fix decimal value sent to the api
2-towns Nov 28, 2024
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
8 changes: 4 additions & 4 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ on:
workflow_dispatch:

env:
codex_version: v0.1.7
circuit_version: v0.1.7
marketplace_address: "0xfE822Df439d987849a90B64a4C0e26a297DBD47F"
codex_version: v0.1.9
circuit_version: v0.1.9
marketplace_address: "0xAB03b6a58C5262f530D54146DA2a552B1C0F7648"
eth_provider: "https://rpc.testnet.codex.storage"
VITE_CODEX_API_URL: ${{ secrets.VITE_CODEX_API_URL }}
VITE_GEO_IP_URL: ${{ secrets.VITE_GEO_IP_URL }}
Expand Down Expand Up @@ -119,7 +119,7 @@ jobs:
run: npm run test

- uses: actions/upload-artifact@v4
# if: ${{ !cancelled() }}
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
Expand Down
74 changes: 69 additions & 5 deletions e2e/availabilities.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import test, { expect } from "@playwright/test";
import { Bytes } from "../src/utils/bytes"
import { GB } from "../src/utils/constants"

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');

const value = (Math.random() * 0.5) + 0.1;

await page.getByLabel('Total size').fill(value.toFixed(1));
await page.getByLabel('Duration').click();
await page.getByLabel('Duration').fill('30');
await page.getByLabel('Min price').click();
Expand All @@ -17,17 +22,16 @@ 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();
await expect(page.getByText('512.0 MB allocated for the').first()).toBeVisible();
await expect(page.getByText(Bytes.pretty(parseFloat(value.toFixed(1)) * GB)).first()).toBeVisible();
})

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");
Expand Down Expand Up @@ -55,3 +59,63 @@ test('availability navigation buttons', async ({ page }) => {
await page.getByRole('button', { name: 'Finish' }).click();
await expect(page.locator('.modal--open')).not.toBeVisible();
})

test('create an availability with changing the duration to months', async ({ page }) => {
await page.goto('/dashboard/availabilities');
await page.waitForTimeout(500);
await page.locator('.availability-edit button').first().click();
await page.getByLabel('Total size').click();

await page.getByLabel('Total size').fill("0.1");
await page.getByLabel('Duration').click();
await page.getByLabel('Duration').fill("3");
await page.getByRole('combobox').nth(1).selectOption('months');

await page.getByLabel('Min price').click();
await page.getByLabel('Min price').fill('5');
await page.getByLabel('Max collateral').click();
await page.getByLabel('Max collateral').fill('30');
await page.getByLabel('Min price').fill('5');
await page.getByLabel('Nickname').click();
await page.getByLabel('Nickname').fill('test');
await page.getByRole('button', { name: 'Next' }).click();
await expect(page.getByText('Confirm your new sale')).toBeVisible();
await page.getByRole('button', { name: 'Next' }).click();
await expect(page.getByText('Success', { exact: true })).toBeVisible();
await page.getByRole('button', { name: 'Finish' }).click();
await expect(page.getByText("3 months").first()).toBeVisible();
})


test('create an availability after checking max size and invalid input', async ({ page }) => {
await page.goto('/dashboard/availabilities');
await page.waitForTimeout(500);
await page.locator('.availability-edit button').first().click();
await page.getByLabel('Total size').click();


await page.getByLabel('Total size').fill("9999");
await expect(page.getByLabel('Total size')).toHaveAttribute("aria-invalid");

await page.getByText("Use max size").click()
await expect(page.getByLabel('Total size')).not.toHaveAttribute("aria-invalid");

const value = (Math.random() * 0.5);
await page.getByLabel('Total size').fill(value.toFixed(1));

await page.getByLabel('Duration').click();
await page.getByLabel('Duration').fill('30');
await page.getByLabel('Min price').click();
await page.getByLabel('Min price').fill('5');
await page.getByLabel('Max collateral').click();
await page.getByLabel('Max collateral').fill('30');
await page.getByLabel('Min price').fill('5');
await page.getByLabel('Nickname').click();
await page.getByLabel('Nickname').fill('test');
await page.getByRole('button', { name: 'Next' }).click();
await expect(page.getByText('Confirm your new sale')).toBeVisible();
await page.getByRole('button', { name: 'Next' }).click();
await expect(page.getByText('Success', { exact: true })).toBeVisible();
await page.getByRole('button', { name: 'Finish' }).click();
await expect(page.getByText(Bytes.pretty(parseFloat(value.toFixed(1)) * GB)).first()).toBeVisible();
})
54 changes: 26 additions & 28 deletions e2e/download.spec.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
// import { test, expect } from '@playwright/test';
// import path, { dirname } from 'path';
// import { fileURLToPath } from 'url';
import { test, expect } from '@playwright/test';
import path, { dirname } from 'path';
import { fileURLToPath } from 'url';

// const __filename = fileURLToPath(import.meta.url);
// const __dirname = dirname(__filename);
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

// test('download a file', async ({ page, browserName }) => {
// // https://github.com/microsoft/playwright/issues/13037
// test.skip(browserName.toLowerCase() !== 'chromium',
// `Test only for chromium!`);
test('download a file', async ({ page, browserName }) => {
// https://github.com/microsoft/playwright/issues/13037
test.skip(browserName.toLowerCase() !== 'chromium',
`Test only for chromium!`);

// await page.goto('/dashboard');
// await page.locator('div').getByTestId("upload").setInputFiles([
// path.join(__dirname, "assets", 'chatgpt.jpg'),
// ]);
// await page.context().grantPermissions(["clipboard-read", "clipboard-write"]);
// await page.locator('.files-fileActions > button:nth-child(3)').first().click();
// await page.getByRole('button', { name: 'Copy CID' }).click();
// const handle = await page.evaluateHandle(() => navigator.clipboard.readText());
// const cid = await handle.jsonValue()
// await page.locator('.sheets > .backdrop').click();
// await page.locator('.download-input input').click();
// await page.locator('.download-input input').fill(cid);
// // const page1Promise = page.waitForEvent('popup');
// const downloadPromise = page.waitForEvent('download');
// await page.locator('div').filter({ hasText: /^Download a fileDownload$/ }).getByRole('button').click();
// // const page1 = await page1Promise;
// const download = await downloadPromise;
// expect(await download.failure()).toBeNull()
// });
await page.goto('/dashboard');
await page.locator('div').getByTestId("upload").setInputFiles([
path.join(__dirname, "assets", 'chatgpt.jpg'),
]);
await page.context().grantPermissions(["clipboard-read", "clipboard-write"]);
await page.locator('.file-cell button').first().click();
const handle = await page.evaluateHandle(() => navigator.clipboard.readText());
const cid = await handle.jsonValue()

await page.locator('.download-input input').fill(cid);
// const page1Promise = page.waitForEvent('popup');
const downloadPromise = page.waitForEvent('download');
await page.locator('.download-input + button').click();
// const page1 = await page1Promise;
const download = await downloadPromise;
expect(await download.failure()).toBeNull()
});
14 changes: 7 additions & 7 deletions e2e/folders.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
})
99 changes: 58 additions & 41 deletions e2e/onboarding.spec.ts
Original file line number Diff line number Diff line change
@@ -1,41 +1,58 @@
import { test, expect } from '@playwright/test';

test('onboarding steps', async ({ page }) => {
await page.context().setOffline(false)
await page.goto('/');
await expect(page.getByText("Codex is a durable, decentralised data storage protocol, created so the world community can preserve its most important knowledge without risk of censorship.")).toBeVisible()
await page.locator('.navigation').click();
await expect(page.locator('.navigation')).toHaveAttribute("aria-disabled");
await page.getByLabel('Preferred name').fill('Arnaud');
await expect(page.locator('.navigation')).not.toHaveAttribute("aria-disabled");
await page.locator('.navigation').click();

// Network
await expect(page.locator(".health-checks ul li").nth(1).getByTestId("icon-error")).not.toBeVisible()
await expect(page.locator(".health-checks ul li").nth(1).getByTestId("icon-success")).toBeVisible()

// Port forwarding
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()

// 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()

// Marketplace
await expect(page.locator(".health-checks ul li").nth(4).getByTestId("icon-error")).not.toBeVisible()
await expect(page.locator(".health-checks ul li").nth(4).getByTestId("icon-success")).toBeVisible()

await page.context().setOffline(true)

// Network
await expect(page.locator(".health-checks ul li").nth(1).getByTestId("icon-error")).toBeVisible()
await expect(page.locator(".health-checks ul li").nth(1).getByTestId("icon-success")).not.toBeVisible()

await page.context().setOffline(false)
});

// await expect(page.locator('#root')).toContainText('Network connected');
// await page.locator('a').nth(2).click();
// await page.context().setOffline(true)
// await expect(page.locator('#root')).toContainText('Network disconnected');
import { test, expect, } from '@playwright/test';

test.describe('onboarding', () => {
test('onboarding steps', async ({ page, browserName }) => {
await page.context().setOffline(false)
await page.goto('/');
await expect(page.getByText("Codex is a durable, decentralised data storage protocol, created so the world community can preserve its most important knowledge without risk of censorship.")).toBeVisible()
await page.locator('.navigation').click();
await expect(page.locator('.navigation')).toHaveAttribute("aria-disabled");
await page.getByLabel('Preferred name').fill('Arnaud');
await expect(page.locator('.navigation')).not.toHaveAttribute("aria-disabled");
await page.locator('.navigation').click();

// Network
await expect(page.locator(".health-checks ul li").nth(1).getByTestId("icon-error")).not.toBeVisible()
await expect(page.locator(".health-checks ul li").nth(1).getByTestId("icon-success")).toBeVisible()

// Port forwarding
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()

// Codex node
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(3).getByTestId("icon-warning")).toBeVisible({ timeout: 10_000 })
await expect(page.locator(".health-checks ul li").nth(3).getByTestId("icon-success")).not.toBeVisible()

// Can be simulated with File -> Work offline
if (browserName.toLowerCase() !== 'firefox') {
await page.context().setOffline(true)

// Network
await expect(page.locator(".health-checks ul li").nth(1).getByTestId("icon-error")).toBeVisible()
await expect(page.locator(".health-checks ul li").nth(1).getByTestId("icon-success")).not.toBeVisible()

await page.context().setOffline(false)
}
});

test.beforeEach(async ({ page }) => {
await page.context().setOffline(false)
});
})

test('does not display undefined when delete the url value', async ({ page }) => {
await page.goto('/onboarding-checks');
await page.locator('#url').focus()

for (let i = 0; i < "http://localhost:8080".length; i++) {
await page.keyboard.press('Backspace');
}

await expect(page.locator('#url')).toHaveValue("");
await expect(page.locator('#url')).toHaveAttribute("aria-invalid")
await expect(page.locator('.refresh svg')).toHaveAttribute("color", "#494949")
});
10 changes: 5 additions & 5 deletions e2e/settings.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
Loading
Loading