Minimal Seed Data for Admin Onboarding (#14385)

* minimal seeded flows

* fix: remove mistake

* refactor: rename the files appropriately

* feat: change some text

* fix: typo

* chore: new commit to rebuild
This commit is contained in:
Ridhwana 2021-07-29 17:08:41 +02:00 committed by GitHub
parent fe0714199c
commit e827b8bab9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 23 additions and 10 deletions

View file

@ -100,7 +100,7 @@ jobs:
script:
- bundle exec rails db:create db:schema:load assets:precompile
- yarn cypress install
- SKIP_SEED_DATA=1 E2E_FOLDER=nonSeededFlows bin/e2e-ci
- CREATOR_ONBOARDING_SEED_DATA=1 E2E_FOLDER=creatorOnboardingFlows bin/e2e-ci
- stage: Deploy
name: Deploy DEV
if: type != pull_request

View file

@ -30,9 +30,9 @@ printf "Starting the test runner...\n\n"
bundle exec rails assets:precompile;
if [ $1 = "--no-seed" ]; then
echo "Running E2E tests without seed data"
CYPRESS_RAILS_CYPRESS_OPTS="--config-file cypress.dev.json" RAILS_ENV=test E2E=true SKIP_SEED_DATA=1 E2E_FOLDER=nonSeededFlows bundle exec rake cypress:open
if [ $1 = "--creator-onboarding-seed" ]; then
echo "Running E2E tests with creator onboarding seed data"
CYPRESS_RAILS_CYPRESS_OPTS="--config-file cypress.dev.json" RAILS_ENV=test E2E=true CREATOR_ONBOARDING_SEED_DATA=1 E2E_FOLDER=creatorOnboardingFlows bundle exec rake cypress:open
else
CYPRESS_RAILS_CYPRESS_OPTS="--config-file cypress.dev.json" RAILS_ENV=test E2E=true bundle exec rake cypress:open
fi

View file

@ -8,8 +8,11 @@ CypressRails.hooks.before_server_start do
# Called once, before either the transaction or the server is started
puts "Starting up server for end to end tests."
if ENV["SKIP_SEED_DATA"].blank?
Rails.application.load_tasks
Rails.application.load_tasks
if ENV["CREATOR_ONBOARDING_SEED_DATA"]
Rake::Task["db:seed:e2e_creator_onboarding"].invoke
else
Rake::Task["db:seed:e2e"].invoke
end
end

View file

@ -43,9 +43,8 @@ coordinate all this work.
### 1. From the command line, run `yarn e2e`
Note: If you want to run E2E tests that do not require seeded data, run
`yarn e2e:noseed`. Some tests, like the admin onboarding require there to be no
seeded data.
Note: If you want to run E2E tests for the creator onboarding flow, you can run
`yarn e2e:creator-onboarding-seed`.
Some initial setup and checks will automatically run as part of this command:

View file

@ -10,5 +10,13 @@ namespace :db do
filename = SEED_DIR.join("seeds_e2e.rb")
load(filename) if File.exist?(filename)
end
desc "Creator Onboarding seed data for e2e tests"
task e2e_creator_onboarding: :environment do
raise "Attempting to seed production environment, aborting!" if Rails.env.production?
filename = SEED_DIR.join("creator_onboarding_seed_e2e.rb")
load(filename) if File.exist?(filename)
end
end
end

View file

@ -26,7 +26,7 @@
"test:watch": "jest app/javascript/ bin/ --watch",
"postcss": "postcss public/assets/*.css -d public/assets 2> postcss_error.log",
"e2e": "bin/e2e",
"e2e:noseed": "yarn run e2e --no-seed"
"e2e:creator-onboarding-seed": "yarn run e2e --creator-onboarding-seed"
},
"lint-staged": {
"app/assets/config/manifest.js": [

View file

@ -0,0 +1,3 @@
return unless Rails.env.test? && ENV["E2E"].present?
FeatureFlag.enable(:creator_onboarding)