Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions e2e/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ e2e-*.tar
# Temporary files, for example, from tests.
/tmp/
.envrc
/out/
3 changes: 1 addition & 2 deletions e2e/config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ if System.get_env("START_WALLABY") do
"--no-sandbox",
"--disable-gpu",
"--disable-dev-shm-usage",
"--disable-software-rasterizer",
"--window-size=1280,800"
"--window-size=1920,1200"
]
]
end
Expand Down
16 changes: 10 additions & 6 deletions e2e/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,19 @@ defmodule E2E.MixProject do
if System.get_env("START_WALLABY") do
base
else
# Exclude ui_test_case.ex if Wallaby is not available
ui_test_files = [
"test/support/ui_test_case.ex",
"test/support/user_action.ex"
]

["lib", "test/support"]
|> Enum.flat_map(fn path ->
if path == "test/support" do
|> Enum.flat_map(fn
"test/support" ->
Path.wildcard("test/support/*.ex")
|> Enum.reject(&(&1 =~ "ui_test_case.ex"))
else
|> Enum.reject(&(&1 in ui_test_files))

path ->
[path]
end
end)
end
end
Expand Down
4 changes: 4 additions & 0 deletions e2e/test/e2e/ui/login_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ defmodule E2E.UI.LoginTest do
|> assert_has(Query.css("#kc-login[type='submit'][value='Sign In']"))
|> fill_in(Query.text_field("username"), with: root_email)
|> fill_in(Query.text_field("password"), with: root_password)
|> then(fn s ->
s |> find(Query.css("#kc-form-buttons"))
s
end)
|> click(Query.css("#kc-login"))
|> assert_has(
Query.css("h1.f2.f1-m.lh-title.mb1",
Expand Down
136 changes: 136 additions & 0 deletions e2e/test/e2e/ui/project_creation_test.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
defmodule E2E.UI.ProjectCreationFlowTest do
use E2E.UI.UserTestCase
require Logger

describe "Project Creation Flow" do
@tag timeout: 600_000
test "complete project creation flow", %{session: session} do
Logger.info("Starting Project Creation Flow test")

# Step 1: Navigate to project creation page
Logger.info("Step 1: Navigating to project creation page")
session = click(session, Wallaby.Query.link("Create new"))

# Verify we're on the project creation page
Logger.info("Verifying project creation page")
session = assert_has(session, Wallaby.Query.css("h1", text: "Project type"))

# Step 2: Select GitHub integration using a specific CSS selector
Logger.info("Step 2: Selecting GitHub integration")
session = click(session, Wallaby.Query.css(".f3.b", text: "GitHub"))

# Take screenshot to see what happened
take_screenshot(session, name: "after_github_click")

# Verify we're on the repository selection page
Logger.info("Verifying repository selection page")
session = assert_has(session, Wallaby.Query.css("h2", text: "Repository"))

# Step 3: Search for repositories
Logger.info("Step 3: Searching for repositories")

session =
fill_in(session, Wallaby.Query.fillable_field("Search repositories..."), with: "e2e-tests")

# Give the search some time to complete
:timer.sleep(1000)

session = assert_has(session, Wallaby.Query.css(".option"))

# Try to find and click the "Choose" button if available
Logger.info("Clicking 'Choose' button")
session = click(session, Wallaby.Query.css(".green", text: "Choose"))

# Take screenshot after repository selection
take_screenshot(session, name: "after_repository_selection")
# Give some time to check for duplicates
:timer.sleep(1000)
take_screenshot(session, name: "after_repository_selection_with_duplicates")

session = maybe_enable_duplicate(session)

Logger.info("Clicking create project button")
session = wait_for(session, Wallaby.Query.css("button.btn.btn-primary"), 30_000)
click(session, Wallaby.Query.button("βœ“"))

# Take screenshot after clicking continue
take_screenshot(session, name: "after_continue")

:timer.sleep(15_000)
# Verify we moved to the analysis page and check for the analysis steps checklist
take_screenshot(session, name: "analysis_page")

# wait for project creation to complete (until webhook readonly input is visible)
# This can take up to 15 seconds
Logger.info("Waiting for project creation to complete (up to 15 seconds)...")

# click continue button
session = click(session, Wallaby.Query.link("Continue"))

# Click on the "I want to configure this project from scratch" link
Logger.info("Clicking 'I want to configure this project from scratch' link")

session =
click(session, Wallaby.Query.link("I want to configure this project from scratch"))

# Take a screenshot after clicking the link
take_screenshot(session, name: "configure_from_scratch")

# Click continue button again after selecting "configure from scratch"
Logger.info("Clicking Continue button again")
session = assert_has(session, Wallaby.Query.button("Continue"))
session = click(session, Wallaby.Query.button("Continue"))

# Take a screenshot after clicking continue again
take_screenshot(session, name: "after_second_continue")

# Click "Looks good, start β†’" button
Logger.info("Clicking 'Looks good, start β†’' button")
session = assert_has(session, Wallaby.Query.button("Looks good, start β†’"))
session = click(session, Wallaby.Query.button("Looks good, start β†’"))

# Take a screenshot after clicking the start button
take_screenshot(session, name: "after_start_button")

Logger.info("Waiting 15 seconds for page transition...")
:timer.sleep(15_000)

# Verify the URL path starts with "/workflows/"
Logger.info("Verifying we are on the workflows page")
current_url = current_url(session)

assert String.contains?(current_url, "/workflows/"),
"Expected URL to contain '/workflows/', but got: #{current_url}"

# Take a final screenshot of the workflows page
take_screenshot(session, name: "workflows_page")

Logger.info("Project Creation completed successfully, flow test is complete")
end
end

defp maybe_enable_duplicate(session) do
duplicate_button = Wallaby.Query.button("Make a duplicate project")

if has?(session, duplicate_button) do
click(session, duplicate_button)
else
session
end
end

defp wait_for(session, query, timeout_ms, interval_ms \\ 200)
defp wait_for(session, query, timeout_ms, _interval_ms) when timeout_ms <= 0 do
assert_has(session, query)
end

defp wait_for(session, query, timeout_ms, interval_ms) do
if has?(session, query) do
session
else
Process.sleep(interval_ms)
wait_for(session, query, timeout_ms - interval_ms, interval_ms)
end
end

end
Loading