Skip to content

Commit e449369

Browse files
committed
chore(e2e): add project creation flow happy path test
1 parent 6503f78 commit e449369

File tree

1 file changed

+113
-0
lines changed

1 file changed

+113
-0
lines changed
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
defmodule E2E.UI.ProjectCreationFlowTest do
2+
use E2E.UI.UserTestCase
3+
require Logger
4+
5+
describe "Project Creation Flow" do
6+
@tag timeout: 600_000
7+
test "complete project creation flow", %{session: session} do
8+
Logger.info("Starting Project Creation Flow test")
9+
10+
# Step 1: Navigate to project creation page
11+
Logger.info("Step 1: Navigating to project creation page")
12+
session = click(session, Wallaby.Query.link("Create new"))
13+
14+
# Verify we're on the project creation page
15+
Logger.info("Verifying project creation page")
16+
session = assert_has(session, Wallaby.Query.css("h1", text: "Project type"))
17+
18+
# Step 2: Select GitHub integration using a specific CSS selector
19+
Logger.info("Step 2: Selecting GitHub integration")
20+
session = click(session, Wallaby.Query.css(".f3.b", text: "GitHub"))
21+
22+
# Take screenshot to see what happened
23+
take_screenshot(session, name: "after_github_click")
24+
25+
# Verify we're on the repository selection page
26+
Logger.info("Verifying repository selection page")
27+
session = assert_has(session, Wallaby.Query.css("h2", text: "Repository"))
28+
29+
# Step 3: Search for repositories
30+
Logger.info("Step 3: Searching for repositories")
31+
session = fill_in(session, Wallaby.Query.fillable_field("Search repositories..."), with: "e2e-tests")
32+
33+
# Give the search some time to complete
34+
:timer.sleep(1000)
35+
36+
session = assert_has(session, Wallaby.Query.css(".option"))
37+
38+
# Try to find and click the "Choose" button if available
39+
Logger.info("Clicking 'Choose' button")
40+
session = click(session, Wallaby.Query.css(".green", text: "Choose"))
41+
42+
# Take screenshot after repository selection
43+
take_screenshot(session, name: "after_repository_selection")
44+
# Give some time to check for duplicates
45+
:timer.sleep(1000)
46+
take_screenshot(session, name: "after_repository_selection_with_duplicates")
47+
48+
session = maybe_enable_duplicate(session)
49+
50+
Logger.info("Clicking create project button")
51+
assert_has(session, Wallaby.Query.css("button.btn.btn-primary"))
52+
click(session, Wallaby.Query.button("✓"))
53+
54+
# Take screenshot after clicking continue
55+
take_screenshot(session, name: "after_continue")
56+
57+
:timer.sleep(15_000)
58+
# Verify we moved to the analysis page and check for the analysis steps checklist
59+
take_screenshot(session, name: "analysis_page")
60+
61+
# wait for project creation to complete (until webhook readonly input is visible)
62+
# This can take up to 15 seconds
63+
Logger.info("Waiting for project creation to complete (up to 15 seconds)...")
64+
65+
# click continue button
66+
session = click(session, Wallaby.Query.link("Continue"))
67+
68+
# Click on the "I want to configure this project from scratch" link
69+
Logger.info("Clicking 'I want to configure this project from scratch' link")
70+
session = click(session, Wallaby.Query.link("I want to configure this project from scratch"))
71+
72+
# Take a screenshot after clicking the link
73+
take_screenshot(session, name: "configure_from_scratch")
74+
75+
# Click continue button again after selecting "configure from scratch"
76+
Logger.info("Clicking Continue button again")
77+
session = assert_has(session, Wallaby.Query.button("Continue"))
78+
session = click(session, Wallaby.Query.button("Continue"))
79+
80+
# Take a screenshot after clicking continue again
81+
take_screenshot(session, name: "after_second_continue")
82+
83+
# Click "Looks good, start →" button
84+
Logger.info("Clicking 'Looks good, start →' button")
85+
session = assert_has(session, Wallaby.Query.button("Looks good, start →"))
86+
session = click(session, Wallaby.Query.button("Looks good, start →"))
87+
88+
# Take a screenshot after clicking the start button
89+
take_screenshot(session, name: "after_start_button")
90+
91+
# Wait for 15 seconds to allow page transition
92+
Logger.info("Waiting 15 seconds for page transition...")
93+
:timer.sleep(15_000)
94+
95+
# Verify the URL path starts with "/workflows/"
96+
Logger.info("Verifying we are on the workflows page")
97+
current_url = current_url(session)
98+
assert String.contains?(current_url, "/workflows/"),
99+
"Expected URL to contain '/workflows/', but got: #{current_url}"
100+
101+
# Take a final screenshot of the workflows page
102+
take_screenshot(session, name: "workflows_page")
103+
104+
Logger.info("Project Creation completed successfully, flow test is complete")
105+
end
106+
end
107+
108+
defp maybe_enable_duplicate(session) do
109+
if has?(session, Wallaby.Query.button("Make a duplicate project")) do
110+
click(session, Wallaby.Query.button("Make a duplicate project"))
111+
end
112+
end
113+
end

0 commit comments

Comments
 (0)