Fixed initial e2e test now that data updates are run. (#11958)
* Fixed initial e2e test now that data updates are run. * Clearing any indices created in ES during E2E tests. * Fixed a typo. * Fixed env vars not being loaded. * Prefixed data updates command with bundle exec. * Promoted setting secret to the global section of the Travis config. * Stopped sourcing .env and promoted ELASTICSEARCH_URL to global section of Travis configuration. * Had to fix cc reporter in my PR to get PR to work.
This commit is contained in:
parent
893151d76b
commit
c24cf73b28
4 changed files with 32 additions and 16 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@
|
|||
<h3 class="mb-5">A confirmation email has been sent to <a href="mailto:<%= proper_email %>"><%= proper_email %></a></h3>
|
||||
<div class="mt-8 mb-6 crayons-card p-7 align-left mx-auto">
|
||||
<h2 class="pb-4">Didn't get the email?</h2>
|
||||
<%= 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 %>
|
||||
|
||||
<div class="crayons-field mt-2">
|
||||
<%= 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 %>
|
||||
</div>
|
||||
|
||||
<div class="crayons-field mt-2">
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
{
|
||||
"baseUrl": "http://localhost:3000",
|
||||
"chromeWebSecurity": false
|
||||
"baseUrl": "http://localhost:3000"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue