forked from BloopAI/bloop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocal_onboarding.spec.js_
67 lines (57 loc) · 2.06 KB
/
local_onboarding.spec.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import { test, expect } from '@playwright/test';
const REPOS_TO_SYNC = 3;
test.skip('test', async ({ page }) => {
if (!process.env.SCAN_FOLDER) {
throw new Error('SCAN_FOLDER env not set');
}
await page.goto(
`http://localhost:5173/?chosen_scan_folder=${process.env.SCAN_FOLDER}`,
);
await page.getByRole('button', { name: "Don't share" }).click();
await page.getByPlaceholder('First name').click();
await page.getByPlaceholder('First name').fill('Steve');
await page.getByPlaceholder('First name').press('Tab');
await page.getByRole('button').first().press('Tab');
await page.getByPlaceholder('Last name').fill('Wozniak');
await page.getByPlaceholder('Email address').click();
await page.getByPlaceholder('Email address').fill('[email protected]');
await page.locator('form').getByRole('button').nth(2).click();
await page.getByPlaceholder('Email address').fill('[email protected]');
await page.getByRole('button', { name: 'Submit' }).click();
await page.getByRole('button', { name: 'Choose a folder' }).click();
await page.getByRole('button', { name: 'Sync selected repos' }).click();
await page.waitForSelector('.bg-skeleton', {
state: 'detached',
timeout: 60 * 1000,
});
await page
.locator('label')
.filter({ hasText: 'Select all' })
.getByRole('checkbox')
.click();
// Store repo names to check status later
const repoNames = [];
for (let i = 1; i <= REPOS_TO_SYNC; i++) {
const repo = page.locator(`ul > :nth-match(li, ${i})`);
repoNames.push(await repo.locator('span').innerText());
await repo.click();
}
await page.getByRole('button', { name: 'Sync repositories' }).click();
await page.getByRole('button', { name: 'Setup later' }).click();
await Promise.all(
repoNames.map((repoName) =>
page.waitForSelector(`p:has-text("${repoName}")`, {
state: 'attached',
timeout: 60 * 1000,
}),
),
);
await Promise.all(
repoNames.map((repoName, i) =>
page
.locator('.bg-green-500')
.nth(i)
.waitFor({ timeout: 60 * 1000 }),
),
);
});