Last active
November 18, 2022 06:16
-
-
Save bastsoft/9bc10bcf79144cd680c7f594e44bfbdf to your computer and use it in GitHub Desktop.
krediska first anket
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function setNewPassport(){ | |
const random = Math.random().toString().split(".")[1]; | |
cy.contains("label", "СЕРИЯ").get("input").type(random.slice(0,4)); | |
cy.contains("label", "НОМЕР").get("input").type(random.slice(0,6)); | |
cy.contains("label", "ДАТА ВЫДАЧИ").get("input").type("11.11.2011"); | |
cy.contains("label", "КОД ПОДРАЗДЕЛЕНИЯ").get("input").type("890-001"); | |
cy.contains("label", "ДАТА РОЖДЕНИЯ").get("input").type("11.11.1991"); | |
cy.contains("label", "МЕСТО РОЖДЕНИЯ").get("input").type("Москва"); | |
cy.contains("label", "КЕМ ВЫДАН").get("input").focus().type("УФМС России"); | |
cy.contains(".radio__label", "Мужской").click(); | |
} | |
const snippets = { | |
'1. Общие сведенья, заполнить'() { | |
const salt = Math.random().toString().split(".")[1].slice(7); | |
cy.get("input[name='surname']").type("Иванов"); | |
cy.get("input[name='name']").type("Иван"); | |
cy.get("input[name='patronymic']").type("Иванович"); | |
cy.get("input[name='phone']").type("891" + salt); | |
cy.get("input[name='email']").type("ya" + salt + "@ya.ru"); | |
}, | |
'1.1 Общие сведенья, включить моки'() { | |
const salt = Math.random().toString().split(".")[1].slice(7); | |
cy.get("input[name='surname']").type("Иванов"); | |
cy.get("input[name='name']").type("Иван"); | |
cy.get("input[name='patronymic']").type("Иванович"); | |
cy.get("input[name='phone']").type("89123456789"); | |
}, | |
'2.1. новая версия паспорта'(){ | |
setNewPassport(); | |
cy.contains("label", "РЕГИОН").get("input").focus().type("Московска").click(); | |
cy.wait(1 * 1000); | |
cy.contains("li", "Московска").click(); | |
cy.contains("label", "ГОРОД").get("input").focus().type("Мыт").click(); | |
cy.wait(1 * 1000); | |
cy.contains("li", "Мытищи").click(); | |
cy.contains("label", "УЛИЦА").get("input").focus().type("Пуш").click(); | |
cy.wait(1 * 1000); | |
cy.contains("li", "Пушкина").click(); | |
cy.contains("label", "ДОМ").get("input").type("10"); | |
cy.contains("label", "КВАРТИРА").get("input").type("10"); | |
}, | |
'2.2. новая версия с отказом'(){ | |
setNewPassport(); | |
cy.contains("label", "РЕГИОН").get("input").focus().type("Дагестан").click(); | |
cy.wait(1 * 1000); | |
cy.contains("li", "Дагестан").click(); | |
cy.contains("label", "ГОРОД").get("input").focus().type("Дербент").click(); | |
cy.wait(1 * 1000); | |
cy.contains("li", "Дербент").click(); | |
cy.contains("label", "УЛИЦА").get("input").focus().type("А.Дюма").click(); | |
cy.wait(1 * 1000); | |
cy.contains("li", "А.Дюма").click(); | |
cy.contains("label", "ДОМ").get("input").type("10"); | |
cy.contains("label", "КВАРТИРА").get("input").type("10"); | |
}, | |
'4. Данные вашей карты, заполнить'(){ | |
// https://cartoved.ru/common/generator-kreditnyh-kart.html | |
const kreditType = ["540436" , "540437", "517743", "521841", "528877", "528900", "531450", "531570", "532350", "536990", "540510"][Math.round(Math.random() * 10)]; | |
const salt = Math.random().toString().split(".")[1].slice(0,10); | |
cy.contains(".field__title", "НОМЕР КАРТЫ").parent().parent().get("input").type(kreditType + salt); | |
cy.contains(".field__title", "ВЛАДЕЛЕЦ КАРТЫ").parent().parent().get("input").type("IVANOV I"); | |
cy.contains(".field__title", "СРОК ДЕЙСТВИЯ").parent().parent().get("input").type("10 / 25"); | |
}, | |
'4.1 успешная карта 3000000000000029'(){ | |
cy.contains("label", "НОМЕР КАРТЫ").get("input").type("3000000000000029"); | |
cy.contains("label", "ВЛАДЕЛЕЦ КАРТЫ").get("input").type("IVANOV I"); | |
cy.contains("label", "СРОК ДЕЙСТВИЯ").get("input").type("10 / 25"); | |
cy.contains("label", "CVV").get("input").type("111"); | |
}, | |
'4.2 new Данные вашей карты, заполнить'(){ | |
// https://cartoved.ru/common/generator-kreditnyh-kart.html | |
const kreditType = ["540436" , "540437", "517743", "521841", "528877", "528900", "531450", "531570", "532350", "536990", "540510"][Math.round(Math.random() * 10)]; | |
const salt = Math.random().toString().split(".")[1].slice(0,10); | |
cy.contains("label", "НОМЕР КАРТЫ").get("input").type(kreditType + salt); | |
cy.contains("label", "ВЛАДЕЛЕЦ КАРТЫ").get("input").type("IVANOV I"); | |
cy.contains("label", "СРОК ДЕЙСТВИЯ").get("input").type("10 / 25"); | |
}, | |
'Скинуть сессию'(){ | |
let domain = window.location.hostname.indexOf(".mk-dev.ru") !== -1 ? ".mk-dev.ru" : window.location.hostname; | |
document.cookie = 'tid=; Max-Age=0; path=/; domain=' + domain; | |
document.cookie = 'PHPSESSID=; Max-Age=0; path=/; domain=' + domain; | |
window.location.reload(); | |
} | |
}; | |
inquirer | |
.prompt([ | |
{ | |
type: 'list', | |
name: 'actionSnippet', | |
message: 'krediska snippet', | |
choices: Object.keys(snippets), | |
}, | |
]) | |
.then(answers => snippets[answers.actionSnippet]()); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
javascript:(function(){var el = document.createElement('script'); el.onload = function (){ btr.loadGist({ id: "9bc10bcf79144cd680c7f594e44bfbdf", file: "main.js" }); }; document.head.appendChild(el).src = 'https://cdn.jsdelivr.net/gh/bastsoft/[email protected]/dist/btr.js';})();