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

View file

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