<commit_before>/**
 * Anonymous Sign Up / scene 01: create sale order as guest.
 */

/* libs and includes */
const fs = require('fs');
const mobi = require('../../../../src/mobi');

/**
 * Wrapper for async start of the scenario.
 *
 * @param {mobi} mobi
 * @returns {Promise.<void>}
 */
async function main(mobi) {
    /* get automation engine from app. context */
    const chromy = mobi.chromy;

    try {
        console.log('Go to front.');
        /* start test scenario*/
        await chromy.goto(mobi.cfg.url.mage.front.base);

        console.log('Switch to Russian store (USD is selected by default for Russian store).');
        await chromy.click('#switcher-store-trigger > strong', {waitLoadEvent: false});
        await chromy.click('#switcher-store > div > ul > li > a', {waitLoadEvent: true});

        const cssConfirm = '#maincontent > div.page.messages > div:nth-child(2) > div > div > div';


        console.log('Add BoostIron to cart.');
        await chromy.goto('http://gen.mage.test.mobi.prxgt.com/catalog/product/view/id/1');
        await chromy.click('#product-addtocart-button', {waitLoadEvent: false});
        await chromy.wait(cssConfirm);
        console.log('BoostIron is added.');


        console.log('Add BeeRoyal to cart.');
        await chromy.goto('http://gen.mage.test.mobi.prxgt.com/catalog/product/view/id/4');
        await chromy.evaluate(() => {
            let qty = document.querySelector('#qty');
            qty.value = '10';
        });
        await chromy.click('#product-addtocart-button', {waitLoadEvent: false});
        await chromy.wait(cssConfirm);
        console.log('BeeRoyal is added.');


        console.log('Go to checkout page.');
        await chromy.goto('http://gen.mage.test.mobi.prxgt.com/checkout/');
        console.log('Wait for "Email" field will appear on the form.');
        await chromy.wait('#customer-email');
        await chromy.type('#customer-email', '<EMAIL>');


        console.log('Wait for "First Name" field will appear on the form then fill in form fields.');<commit_msg>MOBI-851 #<commit_after>/**
 * Anonymous Sign Up / scene 01: create sale order as guest.
 */

/* libs and includes */
const fs = require('fs');
const mobi = require('../../../../src/mobi');

/**
 * Wrapper for async start of the scenario.
 *
 * @param {mobi} mobi
 * @returns {Promise.<void>}
 */
async function main(mobi) {
    /* get automation engine from app. context */
    const chromy = mobi.chromy;
    const front = mobi.cfg.url.mage.front.base;
    const prod_1 = mobi.cfg.url.mage.front.aliases["prod1"];
    const prod_4 = mobi.cfg.url.mage.front.aliases["prod4"];

    try {
        console.log('Go to front.');
        /* start test scenario*/
        await chromy.goto(mobi.cfg.url.mage.front.base);

        console.log('Switch to Russian store (USD is selected by default for Russian store).');
        await chromy.click('#switcher-store-trigger > strong', {waitLoadEvent: false});
        await chromy.click('#switcher-store > div > ul > li > a', {waitLoadEvent: true});

        const cssConfirm = '#maincontent > div.page.messages > div:nth-child(2) > div > div > div';


        console.log('Add BoostIron to cart.');
        await chromy.goto(front + prod_1);
        await chromy.click('#product-addtocart-button', {waitLoadEvent: false});
        await chromy.wait(cssConfirm);
        console.log('BoostIron is added.');


        console.log('Add BeeRoyal to cart.');
        await chromy.goto(front + prod_4);
        await chromy.evaluate(() => {
            let qty = document.querySelector('#qty');
            qty.value = '10';
        });
        await chromy.click('#product-addtocart-button', {waitLoadEvent: false});
        await chromy.wait(cssConfirm);
        console.log('BeeRoyal is added.');


        console.log('Go to checkout page.');
        await chromy.goto(front + '/checkout/');
        console.log('Wait for "Email" field will appear on the form.');
        await chromy.wait('#customer-email');
        await chromy.type('#customer-email', '<EMAIL>');


        console.log('Wait for "First Name" field will appear on the form then fill in form fields.');
{'fraction_non_alphanumeric': 0.15804597701149425, 'fraction_numerical': 0.005028735632183908, 'mean_word_length': 2.673702726473175, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '210893', 'n_tokens_mistral': 1293, 'n_tokens_neox': 1274, 'n_words': 328}