diff --git a/.travis.yml b/.travis.yml
index 547c9303..9450e7ea 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -30,23 +30,25 @@ before_install:
- nvm install ${NODE_VERSION}
before_script:
- - docker-compose -f docker-compose.yml -f docker-compose.ci.yml build
- chmod a+rwx ${HOST_COVERAGE_DATA_DIR}
script:
+ - if [[ $TRAVIS_EVENT_TYPE == "cron" && $TRAVIS_BRANCH == "develop" ]];
+ then
+ docker-compose -f docker-compose.yml -f ./tests/docker-compose.email.yml up -d --build;
+ docker exec -it cvat bash -ic 'python3 ~/manage.py migrate';
+ docker exec -it cvat bash -ic "echo \"from django.contrib.auth.models import User; User.objects.create_superuser('${DJANGO_SU_NAME}', '${DJANGO_SU_EMAIL}', '${DJANGO_SU_PASSWORD}')\" | python3 ~/manage.py shell";
+ cd ./tests && npm install && npm run cypress:run:firefox; exit $?;
+ fi;
+ - docker-compose -f docker-compose.yml -f docker-compose.ci.yml build
- docker-compose -f docker-compose.yml -f docker-compose.ci.yml run cvat_ci /bin/bash -c 'coverage run -a manage.py test cvat/apps utils/cli && mv .coverage ${CONTAINER_COVERAGE_DATA_DIR}'
- docker-compose -f docker-compose.yml -f docker-compose.ci.yml run cvat_ci /bin/bash -c 'cd cvat-data && npm install && cd ../cvat-core && npm install && npm run test && mv ./reports/coverage/lcov.info ${CONTAINER_COVERAGE_DATA_DIR} && chmod a+rwx ${CONTAINER_COVERAGE_DATA_DIR}/lcov.info'
- docker-compose up -d
- docker exec -it cvat bash -ic "echo \"from django.contrib.auth.models import User; User.objects.create_superuser('${DJANGO_SU_NAME}', '${DJANGO_SU_EMAIL}', '${DJANGO_SU_PASSWORD}')\" | python3 ~/manage.py shell"
# End-to-end testing
- - cd ./tests && npm install && cd ..
- - if [[ $TRAVIS_EVENT_TYPE == "cron" && $TRAVIS_BRANCH == "develop" ]];
- then
- cd ./tests && npm run cypress:run:firefox && exit $?;
- fi;
- npm install && npm run coverage
- docker-compose up -d --build
- - cd ./tests && npx cypress run --headless --browser chrome
+ - cd ./tests && npm install && npx cypress run --headless --browser chrome
- mv ./.nyc_output ../ && cd ..
- npx nyc report --reporter=text-lcov >> ${HOST_COVERAGE_DATA_DIR}/lcov.info
- docker-compose -f docker-compose.yml -f docker-compose.ci.yml run cvat_ci /bin/bash -c 'cd ${CONTAINER_COVERAGE_DATA_DIR} && coveralls-lcov -v -n lcov.info > ${CONTAINER_COVERAGE_DATA_DIR}/coverage.json'
diff --git a/tests/__init__.py b/tests/__init__.py
new file mode 100644
index 00000000..f19d9bef
--- /dev/null
+++ b/tests/__init__.py
@@ -0,0 +1,3 @@
+# Copyright (C) 2020 Intel Corporation
+#
+# SPDX-License-Identifier: MIT
diff --git a/tests/cypress.json b/tests/cypress.json
index 690735f6..bfd99ddd 100644
--- a/tests/cypress.json
+++ b/tests/cypress.json
@@ -6,12 +6,13 @@
"defaultCommandTimeout": 25000,
"env": {
"user": "admin",
+ "email": "admin@localhost.company",
"password": "12qwaszx"
},
"testFiles": [
"auth_page.js",
"actions_tasks_objects/*",
- "actions_users/*",
+ "actions_users/**/*",
"actions_projects/*",
"remove_users_tasks_projects.js"
]
diff --git a/tests/cypress/integration/actions_users/case_1_create_delete_task.js b/tests/cypress/integration/actions_tasks_objects/case_1_create_delete_task.js
similarity index 100%
rename from tests/cypress/integration/actions_users/case_1_create_delete_task.js
rename to tests/cypress/integration/actions_tasks_objects/case_1_create_delete_task.js
diff --git a/tests/cypress/integration/actions_tasks_objects/issue_1922_error_canvas_is_busy_at_resize_element.js b/tests/cypress/integration/actions_tasks_objects/issue_1922_error_canvas_is_busy_at_resize_element.js
index ace78490..63f4ca30 100644
--- a/tests/cypress/integration/actions_tasks_objects/issue_1922_error_canvas_is_busy_at_resize_element.js
+++ b/tests/cypress/integration/actions_tasks_objects/issue_1922_error_canvas_is_busy_at_resize_element.js
@@ -7,7 +7,6 @@
import { taskName, labelName } from '../../support/const';
context('Check error canvas is busy at resize element', () => {
-
const issueId = '1922';
const createRectangleShape2Points = {
points: 'By 2 Points',
@@ -43,9 +42,10 @@ context('Check error canvas is busy at resize element', () => {
const secondY = createRectangleShape2Points.secondY;
cy.get('.cvat-canvas-container')
.trigger('mousemove', secondX - 10, secondY - 10) // activate second shape
- .trigger('mousedown', secondX, secondY, {button: 0})
+ .trigger('mousedown', secondX, secondY, { button: 0 })
.trigger('mousemove', secondX + 100, secondY + 100)
- .get('body').type('d') // go to previous frame
+ .get('body')
+ .type('d') // go to previous frame
.trigger('mouseup');
});
diff --git a/tests/cypress/integration/actions_users/case_2_register_user_change_pass.js b/tests/cypress/integration/actions_users/registration_involved/case_2_register_user_change_pass.js
similarity index 100%
rename from tests/cypress/integration/actions_users/case_2_register_user_change_pass.js
rename to tests/cypress/integration/actions_users/registration_involved/case_2_register_user_change_pass.js
diff --git a/tests/cypress/integration/actions_users/case_4_assign_taks_job_users.js b/tests/cypress/integration/actions_users/registration_involved/case_4_assign_taks_job_users.js
similarity index 100%
rename from tests/cypress/integration/actions_users/case_4_assign_taks_job_users.js
rename to tests/cypress/integration/actions_users/registration_involved/case_4_assign_taks_job_users.js
diff --git a/tests/cypress/integration/actions_users/issue_1599_ch_user_registration.js b/tests/cypress/integration/actions_users/registration_involved/issue_1599_ch_user_registration.js
similarity index 63%
rename from tests/cypress/integration/actions_users/issue_1599_ch_user_registration.js
rename to tests/cypress/integration/actions_users/registration_involved/issue_1599_ch_user_registration.js
index 08cda62c..bbcb5db7 100644
--- a/tests/cypress/integration/actions_users/issue_1599_ch_user_registration.js
+++ b/tests/cypress/integration/actions_users/registration_involved/issue_1599_ch_user_registration.js
@@ -5,6 +5,12 @@
///
context('Issue 1599 (Chinese alphabet).', () => {
+ const firstName = '测试者';
+ const lastName = '测试';
+ const userName = 'Testuser_ch';
+ const email = 'Testuser_ch@local.local';
+ const password = 'Qwerty123!';
+
before(() => {
cy.visit('auth/register');
cy.url().should('include', '/auth/register');
@@ -12,33 +18,32 @@ context('Issue 1599 (Chinese alphabet).', () => {
describe('User registration using the Chinese alphabet.', () => {
it('Filling in the placeholder "First name"', () => {
- cy.get('[placeholder="First name"]').type('测试者').should('not.have.class', 'has-error');
+ cy.get('[placeholder="First name"]').type(firstName).should('not.have.class', 'has-error');
});
it('Filling in the placeholder "Last name"', () => {
- cy.get('[placeholder="Last name"]').type('测试').should('not.have.class', 'has-error');
+ cy.get('[placeholder="Last name"]').type(lastName).should('not.have.class', 'has-error');
});
it('Filling in the placeholder "Username"', () => {
- cy.get('[placeholder="Username"]').type('Testuser_ch');
+ cy.get('[placeholder="Username"]').type(userName);
});
it('Filling in the placeholder "Email address"', () => {
- cy.get('[placeholder="Email address"]').type('Testuser_ch@local.local');
+ cy.get('[placeholder="Email address"]').type(email);
});
it('Filling in the placeholder "Password"', () => {
- cy.get('[placeholder="Password"]').type('Qwerty123!');
+ cy.get('[placeholder="Password"]').type(password);
});
it('Filling in the placeholder "Confirm password"', () => {
- cy.get('[placeholder="Confirm password"]').type('Qwerty123!');
+ cy.get('[placeholder="Confirm password"]').type(password);
});
it('Click to "Submit" button', () => {
cy.get('[type="submit"]').click();
});
-
it('Successful registration', () => {
cy.url().should('include', '/tasks');
});
diff --git a/tests/cypress/integration/actions_users/issue_1599_pl_user_registration.js b/tests/cypress/integration/actions_users/registration_involved/issue_1599_pl_user_registration.js
similarity index 61%
rename from tests/cypress/integration/actions_users/issue_1599_pl_user_registration.js
rename to tests/cypress/integration/actions_users/registration_involved/issue_1599_pl_user_registration.js
index 11a48a15..2ee411d9 100644
--- a/tests/cypress/integration/actions_users/issue_1599_pl_user_registration.js
+++ b/tests/cypress/integration/actions_users/registration_involved/issue_1599_pl_user_registration.js
@@ -5,6 +5,12 @@
///
context('Issue 1599 (Polish alphabet).', () => {
+ const firstName = 'Świętobor';
+ const lastName = 'Сzcić';
+ const userName = 'Testuser_pl';
+ const email = 'Testuser_pl@local.local';
+ const password = 'Qwerty123!';
+
before(() => {
cy.visit('auth/register');
cy.url().should('include', '/auth/register');
@@ -12,27 +18,27 @@ context('Issue 1599 (Polish alphabet).', () => {
describe('User registration using the Polish alphabet.', () => {
it('Filling in the placeholder "First name"', () => {
- cy.get('[placeholder="First name"]').type('Świętobor').should('not.have.class', 'has-error');
+ cy.get('[placeholder="First name"]').type(firstName).should('not.have.class', 'has-error');
});
it('Filling in the placeholder "Last name"', () => {
- cy.get('[placeholder="Last name"]').type('Сzcić').should('not.have.class', 'has-error');
+ cy.get('[placeholder="Last name"]').type(lastName).should('not.have.class', 'has-error');
});
it('Filling in the placeholder "Username"', () => {
- cy.get('[placeholder="Username"]').type('Testuser_pl');
+ cy.get('[placeholder="Username"]').type(userName);
});
it('Filling in the placeholder "Email address"', () => {
- cy.get('[placeholder="Email address"]').type('Testuser_pl@local.local');
+ cy.get('[placeholder="Email address"]').type(email);
});
it('Filling in the placeholder "Password"', () => {
- cy.get('[placeholder="Password"]').type('Qwerty123!');
+ cy.get('[placeholder="Password"]').type(password);
});
it('Filling in the placeholder "Confirm password"', () => {
- cy.get('[placeholder="Confirm password"]').type('Qwerty123!');
+ cy.get('[placeholder="Confirm password"]').type(password);
});
it('Click to "Submit" button', () => {
diff --git a/tests/cypress/integration/email_system/check_email_verification_system.js b/tests/cypress/integration/email_system/check_email_verification_system.js
new file mode 100644
index 00000000..8ff33b1b
--- /dev/null
+++ b/tests/cypress/integration/email_system/check_email_verification_system.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2020 Intel Corporation
+//
+// SPDX-License-Identifier: MIT
+
+///
+
+const randomString = (isPassword) => {
+ let result = '';
+ const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
+ for (let i = 0; i <= 8; i++) {
+ result += characters.charAt(Math.floor(Math.random() * characters.length));
+ }
+ return isPassword ? `${result}${Math.floor(Math.random() * 10)}` : result;
+};
+
+context('Check email verification system', () => {
+ const caseId = 'Email verification system';
+ const firstName = `${randomString()}`;
+ const lastName = `${randomString()}`;
+ const userName = `${randomString()}`;
+ const emailAddr = `${userName}@local.local`;
+ const password = `${randomString(true)}`;
+
+ before(() => {
+ cy.visit('auth/register');
+ cy.url().should('include', '/auth/register');
+ });
+
+ describe(`Case: "${caseId}"`, () => {
+ it('Register user. Notification exist. The response status is successful.', () => {
+ cy.server().route('POST', '/api/v1/auth/register').as('userRegister');
+ cy.userRegistration(firstName, lastName, userName, emailAddr, password);
+ cy.get('.ant-notification-topRight')
+ .contains(`We have sent an email with a confirmation link to ${emailAddr}.`)
+ .should('exist');
+ cy.wait('@userRegister').its('status').should('eq', 201);
+ });
+ });
+});
diff --git a/tests/cypress/integration/remove_users_tasks_projects.js b/tests/cypress/integration/remove_users_tasks_projects.js
index 4aa2e0da..a2392e95 100644
--- a/tests/cypress/integration/remove_users_tasks_projects.js
+++ b/tests/cypress/integration/remove_users_tasks_projects.js
@@ -13,6 +13,7 @@ describe('Delete users and tasks created during the test run.', () => {
url: '/api/v1/auth/login',
body: {
username: Cypress.env('user'),
+ email: Cypress.env('email'),
password: Cypress.env('password'),
},
}).then(async (responce) => {
diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js
index 92e8de7b..d9d2f86a 100644
--- a/tests/cypress/support/commands.js
+++ b/tests/cypress/support/commands.js
@@ -33,7 +33,9 @@ Cypress.Commands.add('userRegistration', (firstName, lastName, userName, emailAd
cy.get('#password1').type(password);
cy.get('#password2').type(password);
cy.get('.register-form-button').click();
- cy.url().should('include', '/tasks');
+ if (Cypress.browser.family === 'chromium') {
+ cy.url().should('include', '/tasks');
+ }
});
Cypress.Commands.add(
diff --git a/tests/cypress_cron_type.json b/tests/cypress_cron_type.json
new file mode 100644
index 00000000..2033f6a3
--- /dev/null
+++ b/tests/cypress_cron_type.json
@@ -0,0 +1,19 @@
+{
+ "video": false,
+ "baseUrl": "http://localhost:8080",
+ "viewportWidth": 1300,
+ "viewportHeight": 960,
+ "defaultCommandTimeout": 25000,
+ "env": {
+ "user": "admin",
+ "email": "admin@localhost.company",
+ "password": "12qwaszx"
+ },
+ "testFiles": [
+ "auth_page.js",
+ "actions_tasks_objects/*",
+ "actions_users/*",
+ "email_system/*",
+ "remove_users_tasks_projects.js"
+ ]
+}
diff --git a/tests/docker-compose.email.yml b/tests/docker-compose.email.yml
new file mode 100644
index 00000000..962376a5
--- /dev/null
+++ b/tests/docker-compose.email.yml
@@ -0,0 +1,6 @@
+version: "3.3"
+
+services:
+ cvat:
+ environment:
+ DJANGO_SETTINGS_MODULE: tests.email_settings
diff --git a/tests/email_settings.py b/tests/email_settings.py
new file mode 100644
index 00000000..278b3399
--- /dev/null
+++ b/tests/email_settings.py
@@ -0,0 +1,17 @@
+#!/usr/bin/env python
+
+# Copyright (C) 2020 Intel Corporation
+#
+# SPDX-License-Identifier: MIT
+
+from cvat.settings.production import *
+
+
+# https://github.com/pennersr/django-allauth
+ACCOUNT_AUTHENTICATION_METHOD = 'username'
+ACCOUNT_CONFIRM_EMAIL_ON_GET = True
+ACCOUNT_EMAIL_REQUIRED = True
+ACCOUNT_EMAIL_VERIFICATION = 'mandatory'
+
+# Email backend settings for Django
+EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
diff --git a/tests/package.json b/tests/package.json
index 2b38c570..746be871 100644
--- a/tests/package.json
+++ b/tests/package.json
@@ -1,7 +1,7 @@
{
"scripts": {
"cypress:run:chrome": "cypress run --env coverage=false --headless --browser chrome",
- "cypress:run:firefox": "cypress run --env coverage=false --headless --browser firefox"
+ "cypress:run:firefox": "cypress run --env coverage=false --headless --browser firefox --config-file cypress_cron_type.json"
},
"devDependencies": {
"@cypress/code-coverage": "^3.8.1",