refactor: remove emoji from e2e scripts and docs

- Remove emoji from create_test_user.exs output
- Remove emoji from setup.sh
- Keep emoji in test files (used for matching actual app emoji)
This commit is contained in:
Graham McIntire 2026-03-06 15:43:02 -06:00
parent cc3ca1c7de
commit 70c82ba8f1
No known key found for this signature in database
2 changed files with 30 additions and 28 deletions

View file

@ -11,25 +11,27 @@ email = "e2e-test@towerops.local"
password = "TestPassword123!" password = "TestPassword123!"
totp_secret = "JBSWY3DPEHPK3PXP" totp_secret = "JBSWY3DPEHPK3PXP"
IO.puts("\n🎭 Creating E2E Test User...") IO.puts("\nCreating E2E Test User...")
IO.puts("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n") IO.puts(String.duplicate("=", 40) <> "\n")
# Check if user already exists # Check if user already exists
case Accounts.get_user_by_email(email) do case Accounts.get_user_by_email(email) do
nil -> nil ->
# Create new user # Create new user
IO.puts("📝 Registering user: #{email}") IO.puts("Registering user: #{email}")
case Accounts.register_user(%{ case Accounts.register_user(%{
email: email, email: email,
password: password, password: password,
password_confirmation: password password_confirmation: password,
terms_of_service_consent: true,
privacy_policy_consent: true
}) do }) do
{:ok, user} -> {:ok, user} ->
IO.puts(" User created successfully!") IO.puts("[OK] User created successfully!")
# Set up TOTP # Set up TOTP
IO.puts("🔐 Setting up TOTP authentication...") IO.puts("Setting up TOTP authentication...")
case Accounts.create_user_credential(user, %{ case Accounts.create_user_credential(user, %{
type: :totp, type: :totp,
@ -37,56 +39,56 @@ case Accounts.get_user_by_email(email) do
enabled: true enabled: true
}) do }) do
{:ok, _credential} -> {:ok, _credential} ->
IO.puts(" TOTP enabled!") IO.puts("[OK] TOTP enabled!")
# Create organization # Create organization
IO.puts("🏢 Creating test organization...") IO.puts("Creating test organization...")
case Organizations.create_organization(%{name: "E2E Test Org"}, user.id) do case Organizations.create_organization(%{name: "E2E Test Org"}, user.id) do
{:ok, org} -> {:ok, org} ->
IO.puts(" Organization created: #{org.name}") IO.puts("[OK] Organization created: #{org.name}")
# Print credentials # Print credentials
IO.puts("\n" <> String.duplicate("", 40)) IO.puts("\n" <> String.duplicate("=", 40))
IO.puts("\nE2E Test User Ready!") IO.puts("\nE2E Test User Ready!")
IO.puts("\nAdd these to e2e/.env:\n") IO.puts("\nAdd these to e2e/.env:\n")
IO.puts("TEST_USER_EMAIL=#{email}") IO.puts("TEST_USER_EMAIL=#{email}")
IO.puts("TEST_USER_PASSWORD=#{password}") IO.puts("TEST_USER_PASSWORD=#{password}")
IO.puts("TEST_USER_TOTP_SECRET=#{totp_secret}") IO.puts("TEST_USER_TOTP_SECRET=#{totp_secret}")
IO.puts("\n" <> String.duplicate("", 40) <> "\n") IO.puts("\n" <> String.duplicate("=", 40) <> "\n")
{:error, changeset} -> {:error, changeset} ->
IO.puts(" Failed to create organization:") IO.puts("[ERROR] Failed to create organization:")
IO.inspect(changeset.errors) IO.inspect(changeset.errors)
end end
{:error, changeset} -> {:error, changeset} ->
IO.puts(" Failed to set up TOTP:") IO.puts("[ERROR] Failed to set up TOTP:")
IO.inspect(changeset.errors) IO.inspect(changeset.errors)
end end
{:error, changeset} -> {:error, changeset} ->
IO.puts(" Failed to create user:") IO.puts("[ERROR] Failed to create user:")
IO.inspect(changeset.errors) IO.inspect(changeset.errors)
end end
user -> user ->
IO.puts("⚠️ User already exists: #{email}") IO.puts("[WARN] User already exists: #{email}")
IO.puts("\nExisting user details:") IO.puts("\nExisting user details:")
# Get TOTP credential # Get TOTP credential
credential = Repo.get_by(Accounts.UserCredential, user_id: user.id, type: :totp) credential = Repo.get_by(Accounts.UserCredential, user_id: user.id, type: :totp)
if credential do if credential do
IO.puts("\n" <> String.duplicate("", 40)) IO.puts("\n" <> String.duplicate("=", 40))
IO.puts("\nE2E Test User Credentials:") IO.puts("\nE2E Test User Credentials:")
IO.puts("\nAdd these to e2e/.env:\n") IO.puts("\nAdd these to e2e/.env:\n")
IO.puts("TEST_USER_EMAIL=#{email}") IO.puts("TEST_USER_EMAIL=#{email}")
IO.puts("TEST_USER_PASSWORD=#{password}") IO.puts("TEST_USER_PASSWORD=#{password}")
IO.puts("TEST_USER_TOTP_SECRET=#{credential.totp_secret}") IO.puts("TEST_USER_TOTP_SECRET=#{credential.totp_secret}")
IO.puts("\n" <> String.duplicate("", 40) <> "\n") IO.puts("\n" <> String.duplicate("=", 40) <> "\n")
else else
IO.puts("⚠️ No TOTP credential found for this user") IO.puts("[WARN] No TOTP credential found for this user")
IO.puts("\nTo set up TOTP manually, run:") IO.puts("\nTo set up TOTP manually, run:")
IO.puts(""" IO.puts("""
@ -107,7 +109,7 @@ case Accounts.get_user_by_email(email) do
|> Enum.filter(&(&1.role == :owner)) |> Enum.filter(&(&1.role == :owner))
if Enum.empty?(orgs) do if Enum.empty?(orgs) do
IO.puts("\n⚠️ User has no organizations") IO.puts("\n[WARN] User has no organizations")
IO.puts("\nTo create one, run:") IO.puts("\nTo create one, run:")
IO.puts(""" IO.puts("""
@ -116,6 +118,6 @@ case Accounts.get_user_by_email(email) do
Towerops.Organizations.create_organization(%{name: "E2E Test Org"}, user.id) Towerops.Organizations.create_organization(%{name: "E2E Test Org"}, user.id)
""") """)
else else
IO.puts("\n User has #{length(orgs)} organization(s)") IO.puts("\n[OK] User has #{length(orgs)} organization(s)")
end end
end end

View file

@ -2,22 +2,22 @@
set -e set -e
echo "🎭 Setting up Playwright E2E tests..." echo "Setting up Playwright E2E tests..."
# Install dependencies # Install dependencies
echo "📦 Installing npm dependencies..." echo "Installing npm dependencies..."
npm install npm install
# Install Playwright browsers # Install Playwright browsers
echo "🌐 Installing Playwright browsers..." echo "Installing Playwright browsers..."
npx playwright install npx playwright install
# Create .env if it doesn't exist # Create .env if it doesn't exist
if [ ! -f .env ]; then if [ ! -f .env ]; then
echo "📝 Creating .env file from template..." echo "Creating .env file from template..."
cp .env.example .env cp .env.example .env
echo "" echo ""
echo "⚠️ IMPORTANT: Edit .env and set your test user credentials!" echo "IMPORTANT: Edit .env and set your test user credentials!"
echo " TEST_USER_EMAIL, TEST_USER_PASSWORD, and TEST_USER_TOTP_SECRET" echo " TEST_USER_EMAIL, TEST_USER_PASSWORD, and TEST_USER_TOTP_SECRET"
echo "" echo ""
fi fi
@ -25,7 +25,7 @@ fi
# Create .auth directory # Create .auth directory
mkdir -p tests/.auth mkdir -p tests/.auth
echo "Setup complete!" echo "Setup complete!"
echo "" echo ""
echo "Next steps:" echo "Next steps:"
echo " 1. Edit .env with your test user credentials" echo " 1. Edit .env with your test user credentials"