Merge pull request #2434 from dvkruchinin/dkru/cypress-test-check-email-verification
Сypress test. Email verification system.main
commit
6ef3ff2a95
@ -0,0 +1,3 @@
|
||||
# Copyright (C) 2020 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
@ -0,0 +1,39 @@
|
||||
// Copyright (C) 2020 Intel Corporation
|
||||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
/// <reference types="cypress" />
|
||||
|
||||
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);
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -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"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
version: "3.3"
|
||||
|
||||
services:
|
||||
cvat:
|
||||
environment:
|
||||
DJANGO_SETTINGS_MODULE: tests.email_settings
|
||||
@ -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'
|
||||
Loading…
Reference in New Issue