Repository navigation
Expand file tree
/
Copy pathgithub_onboarding.spec.js_
More file actions
78 lines (65 loc) · 2.28 KB
/
Copy pathgithub_onboarding.spec.js_
File metadata and controls
78 lines (65 loc) · 2.28 KB
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
68
69
70
71
72
73
74
75
76
77
78
import { test, expect } from '@playwright/test';
const REPOS_TO_SYNC = 3;
test('test', async ({ page }) => {
await page.goto(`http://localhost:5173`);
await page.getByRole('button', { name: "Don't share" }).click();
await page.getByRole('button', { name: 'Skip this step' }).click();
await page.getByRole('button', { name: 'Skip this step' }).click();
await expect(page.locator('.subhead-l > span')).toBeVisible();
await page.getByRole('button').first().click();
const [page1] = await Promise.all([
page.waitForEvent('popup'),
page.getByRole('button', { name: 'Connect GitHub' }).click(),
]);
await page1
.getByLabel('Username or email address')
.fill(process.env.GITHUB_USER);
await page1.getByLabel('Username or email address').press('Tab');
await page1.getByLabel('Password').fill(process.env.GITHUB_PASSWORD);
await page1.getByRole('button', { name: 'Sign in' }).click();
const githubAuthCode = await page
.locator('.subhead-l > span')
.first()
.innerText();
for (var i = 0; i < githubAuthCode.length; i++) {
if (i === 4) continue;
await page1.locator(`#user-code-${i}`).fill(githubAuthCode[i]);
}
await page1.getByRole('button', { name: 'Continue' }).click();
await page1.getByRole('button', { name: 'Authorize BloopAI' }).click();
await page1.close();
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 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 }),
),
);
});