28 lines
971 B
TypeScript
28 lines
971 B
TypeScript
/// <reference types="cypress" />
|
||
|
||
declare global {
|
||
namespace Cypress {
|
||
interface Chainable {
|
||
login(): Chainable<void>
|
||
}
|
||
}
|
||
}
|
||
|
||
Cypress.Commands.add('login', () => {
|
||
// Пробуем перейти на страницу входа
|
||
cy.visit('/signin', {
|
||
timeout: 10000, // Увеличиваем таймаут до 10 секунд
|
||
failOnStatusCode: false // Не падаем при ошибках статуса
|
||
});
|
||
|
||
// Проверяем, что мы на странице входа
|
||
cy.url().should('include', '/signin');
|
||
|
||
// Вводим данные для входа
|
||
cy.get('#email', { timeout: 10000 }).should('be.visible').type('test@test.ru');
|
||
cy.get('#password', { timeout: 10000 }).should('be.visible').type('testtest');
|
||
cy.get('button[type="submit"]', { timeout: 10000 }).should('be.visible').click();
|
||
|
||
// Ждем успешного входа
|
||
cy.url().should('not.include', '/signin', { timeout: 10000 });
|
||
});
|