forked from trent_larson/crowd-funder-for-time-pwa
Playwright: implemented importUser
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
test('Create new project', async ({ page }) => {
|
||||
test('Create new project, then search for it', async ({ page }) => {
|
||||
// Generate a random string of 16 characters
|
||||
let randomString = Math.random().toString(36).substring(2, 18);
|
||||
|
||||
@@ -18,16 +18,8 @@ test('Create new project', async ({ page }) => {
|
||||
const finalTitle = standardTitle + finalRandomString;
|
||||
const finalDescription = standardDescription + finalRandomString;
|
||||
|
||||
// Create new ID using seed phrase "rigid shrug mobile…"
|
||||
await page.goto('./start');
|
||||
await page.getByText('You have a seed').click();
|
||||
await page.getByPlaceholder('Seed Phrase').fill('rigid shrug mobile smart veteran half all pond toilet brave review universe ship congress found yard skate elite apology jar uniform subway slender luggage');
|
||||
await page.getByRole('button', { name: 'Import' }).click();
|
||||
|
||||
// Set name
|
||||
await page.getByRole('link', { name: 'Set Your Name' }).click();
|
||||
await page.getByPlaceholder('Name').fill('User Zero');
|
||||
await page.getByRole('button', { name: 'Save Changes' }).click();
|
||||
// Import user 00
|
||||
await importUser(page, '00');
|
||||
|
||||
// Pause for 5 seconds
|
||||
await page.waitForTimeout(5000); // I have to wait, otherwise the (+) button to add a new project doesn't appear
|
||||
@@ -46,4 +38,11 @@ test('Create new project', async ({ page }) => {
|
||||
// Check texts
|
||||
await expect(page.locator('h2')).toContainText(finalTitle);
|
||||
await expect(page.locator('#Content')).toContainText(finalDescription);
|
||||
|
||||
// Search for project that was just created
|
||||
await page.goto('./discover');
|
||||
await page.waitForTimeout(5000); // Wait for a bit
|
||||
await page.getByPlaceholder('Search…').fill(finalRandomString);
|
||||
await page.locator('#QuickSearch button').click();
|
||||
await expect(page.locator('ul#listDiscoverResults li.border-b:nth-child(1)')).toContainText(finalRandomString);
|
||||
});
|
||||
Reference in New Issue
Block a user