From 5e82375a38919507238c5dda9e7b390b6f93d67c Mon Sep 17 00:00:00 2001 From: Khaled Emara Date: Wed, 31 May 2023 22:09:51 +0300 Subject: [PATCH] fix: CI Signed-off-by: Khaled Emara --- .github/workflows/ruby.yml | 6 +++--- .../e2e/rails_examples/using_scenarios.spec.js | 2 +- specs_e2e/rails_3_2/test.sh | 9 +++++---- specs_e2e/rails_4_2/test.sh | 9 +++++---- specs_e2e/rails_5_2/test.sh | 12 ++++++------ 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 0b311ad..bf58efa 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -16,7 +16,7 @@ jobs: uses: ruby/setup-ruby@v1 with: ruby-version: 2.3 - bundler-cache: true + bundler-cache: true - name: Run tests run: bundle exec rake - run: gem uninstall -v '>= 2' -ax bundler || true @@ -54,10 +54,10 @@ jobs: uses: ruby/setup-ruby@v1 with: ruby-version: 2.6 - bundler-cache: true + bundler-cache: true - name: Run tests run: bundle exec rake - name: Run interaction tests run: ./specs_e2e/rails_5_2/test.sh env: - CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} \ No newline at end of file + CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} diff --git a/lib/generators/cypress_on_rails/templates/spec/playwright/e2e/rails_examples/using_scenarios.spec.js b/lib/generators/cypress_on_rails/templates/spec/playwright/e2e/rails_examples/using_scenarios.spec.js index 55aca22..0734bdc 100644 --- a/lib/generators/cypress_on_rails/templates/spec/playwright/e2e/rails_examples/using_scenarios.spec.js +++ b/lib/generators/cypress_on_rails/templates/spec/playwright/e2e/rails_examples/using_scenarios.spec.js @@ -9,6 +9,6 @@ test.describe("Rails using scenarios examples", () => { test("setup basic scenario", async ({ page }) => { await appScenario('basic'); await page.goto("/"); - await expect(page).toHaveTitle("Rails Examples"); + await expect(page).toHaveTitle("Rails32"); }); }); diff --git a/specs_e2e/rails_3_2/test.sh b/specs_e2e/rails_3_2/test.sh index ecc80fb..4660255 100755 --- a/specs_e2e/rails_3_2/test.sh +++ b/specs_e2e/rails_3_2/test.sh @@ -14,7 +14,7 @@ bundle --version bundle install --quiet --gemfile="$DIR/Gemfile" --retry 2 --path vendor/bundle echo '-- cypress install' -bundle exec ./bin/rails g cypress_on_rails:install --install_folder=test/e2e --cypress_folder=test/cypress --playwright_folder=test/playwright --install_cypress --install_playwright --install_with=npm --skip +bundle exec ./bin/rails g cypress_on_rails:install --install_cypress --install_playwright --install_with=npm rm -vf cypress/e2e/rails_examples/advance_factory_bot.cy.js rm -vf cypress/e2e/rails_examples/using_vcr.cy.js @@ -34,9 +34,10 @@ cp -fv ../cypress.config.js . node_modules/.bin/cypress run --record # fi -echo '-- cypress run' -cp -fv ../cypress.config.js . -npx playwright test +echo '-- playwright run' +cp -fv ../playwright.config.js . +npx playwright install-deps +npx playwright test playwright/e2e/ echo '-- stop rails server' kill -9 `cat tmp/pids/server.pid` diff --git a/specs_e2e/rails_4_2/test.sh b/specs_e2e/rails_4_2/test.sh index 2f455af..9f14ccb 100755 --- a/specs_e2e/rails_4_2/test.sh +++ b/specs_e2e/rails_4_2/test.sh @@ -15,7 +15,7 @@ bundle --version bundle install --quiet --gemfile="$DIR/Gemfile" --retry 2 --path vendor/bundle echo '-- cypress and playwright install' -bundle exec ./bin/rails g cypress_on_rails:install --install_folder=spec/e2e --cypress_folder=spec/cypress --playwright_folder=spec/playwright --install_cypress --install_playwright --experimental --skip +bundle exec ./bin/rails g cypress_on_rails:install --install_folder=spec/e2e --cypress_folder=spec/cypress --playwright_folder=spec/playwright --install_cypress --install_playwright --experimental --install_with=npm --skip rm -vf spec/cypress/e2e/rails_examples/advance_factory_bot.cy.js echo '-- start rails server' @@ -29,15 +29,16 @@ echo '-- cypress run' cp -fv ../cypress.config.js spec/ # if [ -z $CYPRESS_RECORD_KEY ] # then -# yarn run cypress run -P ./spec +# npx cypress run -P ./spec # else - yarn run cypress run -P ./spec --record + npx cypress run -P ./spec --record # fi echo '-- playwright run' cp -fv ../playwright.config.js spec/ cd spec -yarn run playwright test +npx playwright install-deps +npx playwright test spec/playwright/e2e/ echo '-- stop rails server' kill -9 `cat tmp/pids/server.pid` diff --git a/specs_e2e/rails_5_2/test.sh b/specs_e2e/rails_5_2/test.sh index f51a9f9..9956509 100755 --- a/specs_e2e/rails_5_2/test.sh +++ b/specs_e2e/rails_5_2/test.sh @@ -19,7 +19,7 @@ bundle exec ./bin/rails db:drop || true bundle exec ./bin/rails db:create db:migrate echo '-- cypress and playwright install' -bundle exec ./bin/rails g cypress_on_rails:install --install_folder=test/e2e --cypress_folder=test/cypress --playwright_folder=test/playwright --install_cypress --install_playwright --skip +bundle exec ./bin/rails g cypress_on_rails:install --install_folder=test/e2e --cypress_folder=test/cypress --playwright_folder=test/playwright --install_cypress --install_playwright --install_with=npm --skip rm -vf test/cypress/e2e/rails_examples/using_vcr.cy.js echo '-- start rails server' @@ -34,15 +34,15 @@ cp -fv ../cypress.config.js test/ cd test # if [ -z $CYPRESS_RECORD_KEY ] # then -# yarn run cypress run +# npx cypress run # else - yarn run cypress run --record + npx cypress run --record # fi echo '-- playwright run' -cp -fv ../playwright.config.js test/ -cd test -yarn run playwright test +cp -fv ../../playwright.config.js . +npx playwright install-deps +npx playwright test test/playwright/e2e/ echo '-- stop rails server' kill -9 `cat ../tmp/pids/server.pid` || true