This repository was archived by the owner on Jan 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 157
/
Copy pathtest.js
40 lines (31 loc) · 1.38 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { test, expect } from '@playwright/test';
import { playwright } from 'test-util-ipfs-example';
// Setup
const play = test.extend({
...playwright.servers(),
});
play.describe('add readable stream:', () => {
// DOM
const fileDirectoryInput = "#file-directory"
const fileNameInput = "#file-name"
const fileContentInput = "#file-content"
const addFileBtn = "#add-submit"
const output = "#output"
play.beforeEach(async ({servers, page}) => {
await page.goto(`http://localhost:${servers[0].port}/`);
})
play('should properly initialized a IPFS node and add files using a readable stream', async ({ page }) => {
const fileName = 'test.txt'
const fileContent = 'This is a test sample!'
await page.fill(fileDirectoryInput, 'directory')
await page.fill(fileNameInput, fileName)
await page.fill(fileContentInput, fileContent)
await page.click(addFileBtn)
await page.waitForSelector(`${output}:has-text('Done!')`);
expect(await page.textContent(output)).toContain("directory");
expect(await page.textContent(output)).toContain(fileName);
expect(await page.textContent(output)).toContain(fileContent);
expect(await page.textContent(output)).toContain("QmTZ9ZptBBbjzT6kJcHvPJQRoY2oPWYdishpeYqsCSiKXM");
expect(await page.textContent(output)).toContain("https://ipfs.io/ipfs/QmTZ9ZptBBbjzT6kJcHvPJQRoY2oPWYdishpeYqsCSiKXM/test.txt");
});
});