diff --git a/.travis.yml b/.travis.yml
index 8cda26706..245f265e3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -35,6 +35,8 @@ env:
- KNAPSACK_PRO_LOG_LEVEL=info
- KNAPSACK_PRO_CI_NODE_TOTAL=3
- COVERAGE_REPORTS_TOTAL=4
+ - FOREM_OWNER_SECRET="secret" # test secret so e2e tests can run properly.
+ - ELASTICSEARCH_URL="http://localhost:9200"
jobs:
- KNAPSACK_PRO_CI_NODE_INDEX=0
- KNAPSACK_PRO_CI_NODE_INDEX=1
@@ -55,7 +57,7 @@ script:
- echo -e '-XX:+DisableExplicitGC\n-Djdk.io.permissionsUseCanonicalPath=true\n-Dlog4j.skipJansi=true\n-server\n' | sudo tee -a /etc/elasticsearch/jvm.options
- sudo chown -R elasticsearch:elasticsearch /etc/default/elasticsearch
- sudo systemctl start elasticsearch
- - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-0.7.0-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- bundle config set path 'vendor/bundle'
- bin/ci-bundle
@@ -69,9 +71,10 @@ script:
- if [ "$KNAPSACK_PRO_CI_NODE_INDEX" == "1" ]; then bundle exec bundle-audit check --update --ignore CVE-2015-9284; fi
- if [ "$KNAPSACK_PRO_CI_NODE_INDEX" == "1" ]; then yarn build-storybook; fi
- if [ "$KNAPSACK_PRO_CI_NODE_INDEX" == "2" ]; then bin/test-console-check; fi
- - export FOREM_OWNER_SECRET="secret"
+ - bundle exec rake data_updates:run # required for at least creating the first admin user in e2e tests.
- yarn e2e:ci
# Dropping and recreating the database for Capybara/rspecs
+ - curl -XDELETE "${ELASTICSEARCH_URL}/*" # resetting elastic search post e2e tests
- bundle exec rails db:drop
- bundle exec rails db:create
- bundle exec rails db:schema:load
diff --git a/app/views/devise/confirmations/new.html.erb b/app/views/devise/confirmations/new.html.erb
index 89b9b5827..8fb9132dc 100644
--- a/app/views/devise/confirmations/new.html.erb
+++ b/app/views/devise/confirmations/new.html.erb
@@ -6,11 +6,11 @@
Didn't get the email?
- <%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
+ <%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }, data: { testid: "resend-confirmation-form" }) do |f| %>
<%= render "devise/shared/error_messages", resource: resource %>
- <%= f.email_field :email, class: "crayons-textfield", autofocus: false, value: proper_email %>
+ <%= f.email_field :email, class: "crayons-textfield", aria: { label: "Confirmation email address" }, autofocus: false, value: proper_email %>
diff --git a/cypress.json b/cypress.json
index 0b378fff5..17ef242e7 100644
--- a/cypress.json
+++ b/cypress.json
@@ -1,4 +1,3 @@
{
- "baseUrl": "http://localhost:3000",
- "chromeWebSecurity": false
+ "baseUrl": "http://localhost:3000"
}
diff --git a/cypress/integration/loginFlows/initialAdminLogin.spec.js b/cypress/integration/loginFlows/initialAdminLogin.spec.js
index 3887c2eba..72ad7b8ca 100644
--- a/cypress/integration/loginFlows/initialAdminLogin.spec.js
+++ b/cypress/integration/loginFlows/initialAdminLogin.spec.js
@@ -25,24 +25,38 @@ describe('Initial admin signup', () => {
cy.get('@registrationForm')
.findByLabelText(/Username/i)
.type(admin.username);
- cy.get('@registrationForm').findByLabelText(/Email/i).type(admin.email);
+ cy.get('@registrationForm')
+ .findByLabelText(/^Email$/i)
+ .type(admin.email);
cy.get('@registrationForm')
.findByLabelText('Password')
.type(admin.password);
cy.get('@registrationForm')
- .findByLabelText(/Password Confirmation/i)
+ .findByLabelText(/^Password Confirmation$/i)
.type(admin.password);
cy.get('@registrationForm')
.findByLabelText(/New Forem Secret/i)
.type(admin.foremSecret);
+
+ // Submit the form
+ cy.get('@registrationForm')
+ .findByText(/^Sign up$/)
+ .click();
+ cy.log('Submitting signup form');
+
+ // The initial administrator user was create and is redirected to the confirm email screen.
+ cy.url().should(
+ 'eq',
+ Cypress.config().baseUrl + '/confirm-email?email=' + admin.email,
+ );
+
+ cy.findByTestId('resend-confirmation-form').as('confirmationForm');
+ cy.get('@confirmationForm')
+ .findByLabelText(/^Confirmation email address$/i)
+ .should('have.value', admin.email);
+ cy.get('@confirmationForm').findByText(
+ /^Resend confirmation instructions$/i,
+ );
});
-
- // Submit the form
- cy.get('@registrationForm').findByText('Sign up').click();
- cy.log('Submitting signup form');
- cy.url().should('eq', Cypress.config().baseUrl + '/users');
-
- // We want to ensure that the form submitted without errors
- cy.findByTestId('signup-errors').should('not.exist');
});
});