<commit_before>import { Page } from '@playwright/test'
import Factory from 'object-factory-bot'
import * as cp from 'child_process'
import * as faker from 'faker';
import 'expect-playwright'
import '../factories/definitions'
export * from '@playwright/test'
import { DateTime, DurationInput } from 'luxon'
export { faker, Factory }


//import '../factories/definitions'
export * from './mocker'

const serverPort = process.env.SERVER_PORT || 3001
const TC = {
    URL: `http://localhost:${serverPort}`,
}

type TestConfig = typeof TC
export type { TestConfig }


export const visitPage = async (page: Page, path: string) => {
    const url = `${TC.URL}${path}`
    await page.goto(url)
    await page.waitForLoadState('networkidle')
    await disableTours(page)
}

export const execRailsCmd = async (irb: string) => {
    return new Promise((result, reject) => {
        const cmd = `docker exec tutor-server_rails_1 bin/rails r "${irb}"`
        cp.exec(cmd, (error, stdout) => {
            if (error) {
                console.warn(cmd, error, stdout) // eslint-disable-line<commit_msg>wait for loader to be hidden<commit_after>import { Page } from '@playwright/test'
import Factory from 'object-factory-bot'
import * as cp from 'child_process'
import * as faker from 'faker';
import 'expect-playwright'
import '../factories/definitions'
export * from '@playwright/test'
import { DateTime, DurationInput } from 'luxon'
export { faker, Factory }


//import '../factories/definitions'
export * from './mocker'

const serverPort = process.env.SERVER_PORT || 3001
const TC = {
    URL: `http://localhost:${serverPort}`,
}

type TestConfig = typeof TC
export type { TestConfig }


export const visitPage = async (page: Page, path: string) => {
    const url = `${TC.URL}${path}`
    await page.goto(url)
    await page.waitForLoadState('networkidle')
    await loaderNotVisible(page)
    await disableTours(page)
}

export const execRailsCmd = async (irb: string) => {
    return new Promise((result, reject) => {
        const cmd = `docker exec tutor-server_rails_1 bin/rails r "${irb}"`
        cp.exec(cmd, (error, stdout) => {
            if (error) {
                console.warn(cmd, error, stdout) // eslint-disable-line
{'fraction_non_alphanumeric': 0.13746630727762804, 'fraction_numerical': 0.004492362982929021, 'mean_word_length': 3.6012396694214877, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '3682096', 'n_tokens_mistral': 709, 'n_tokens_neox': 693, 'n_words': 200}