Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for running E2E tests without seeded data #14285

Merged
merged 13 commits into from
Jul 22, 2021
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
8 changes: 7 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,17 @@ jobs:
- bin/test-console-check
- yarn build-storybook
- stage: Test
name: "E2E"
name: "E2E Seeded"
script:
- bundle exec rails db:create db:schema:load assets:precompile
- yarn cypress install
- bin/e2e-ci
- stage: Test
name: "E2E Non-seeded"
script:
- bundle exec rails db:create db:schema:load assets:precompile
- yarn cypress install
- SKIP_SEED_DATA=1 E2E_FOLDER=nonSeededFlows bin/e2e-ci
- stage: Deploy
name: Deploy DEV
if: type != pull_request
Expand Down
9 changes: 6 additions & 3 deletions config/initializers/cypress_rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,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."
Rails.application.load_tasks
Rake::Task["db:seed:e2e"].invoke

if ENV["SKIP_SEED_DATA"].blank?
nickytonline marked this conversation as resolved.
Show resolved Hide resolved
Rails.application.load_tasks
Rake::Task["db:seed:e2e"].invoke
end
end

CypressRails.hooks.after_transaction_start do
Expand All @@ -22,7 +25,7 @@
CypressRails.hooks.before_server_stop do
# Called once, at_exit
puts "Cleaning up and stopping server for end to end tests."
Rake::Task["db:truncate_all"].invoke
Rake::Task["db:truncate_all"].invoke if ENV["SKIP_SEED_DATA"].blank?
djuber marked this conversation as resolved.
Show resolved Hide resolved
puts "The end to end test server shutdown gracefully."
end

Expand Down
5 changes: 5 additions & 0 deletions cypress/integration/nonSeededFlows/test.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe('Describe for the new E2E build node', () => {
nickytonline marked this conversation as resolved.
Show resolved Hide resolved
it('Test for the new E2E build node', () => {
expect(true).to.be.true;
});
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getInterceptsForLingeringUserRequests } from '../../util/networkUtils';
import { getInterceptsForLingeringUserRequests } from '../../../util/networkUtils';
nickytonline marked this conversation as resolved.
Show resolved Hide resolved

describe('User Change Password', () => {
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getInterceptsForLingeringUserRequests } from '../../util/networkUtils';
import { getInterceptsForLingeringUserRequests } from '../../../util/networkUtils';
nickytonline marked this conversation as resolved.
Show resolved Hide resolved

describe('User Logout', () => {
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BREAKPOINTS } from '../../../app/javascript/shared/components/useMediaQuery';
nickytonline marked this conversation as resolved.
Show resolved Hide resolved
import { BREAKPOINTS } from '../../../../app/javascript/shared/components/useMediaQuery';

describe('Reading List Archive', () => {
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BREAKPOINTS } from '../../../app/javascript/shared/components/useMediaQuery';
import { BREAKPOINTS } from '../../../../app/javascript/shared/components/useMediaQuery';
nickytonline marked this conversation as resolved.
Show resolved Hide resolved

describe('Reading List Archive', () => {
beforeEach(() => {
Expand Down
4 changes: 4 additions & 0 deletions cypress/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ module.exports = (on, config) => {
...process.env,
};

const { E2E_FOLDER = 'seededFlows' } = process.env;
nickytonline marked this conversation as resolved.
Show resolved Hide resolved

config.testFiles = `**/${E2E_FOLDER}/**/*.spec.js`;

on('task', {
failed: require('cypress-failed-log/src/failed')(),
});
Expand Down