<commit_before>const viewports = [
  {
    name: "phone",
    width: 360,
  },
  {
    name: "tablet",
    width: 768,
  },
  {
    name: "laptop",
    width: 1024,
  },
  {
    name: "tv",
    width: 1920,
  },
]

const date = new Date().toJSON().slice(0, 10)

module.exports = {
  "inspect homepage": browser => {
    browser
      .url("https://eric.dictybase.dev/stockcenter")
      .waitForElementVisible("body", 1000)
      .assert.title("Dicty Stock Center")
      .getText("h1", function(res) {
        this.assert.equal(res.value, "Welcome to Dicty Stock Center (DSC)")
      })
    viewports.forEach(item => {
      browser
        .resizeWindow(item.width, 2000)
        .saveScreenshot(
          `./nightwatch/reports/dsc-homepage-${item.name}-chrome-${date}.png`,
        )
    })
    browser.end()
  },
  "inspect information page": browser => {
    browser
      .url("https://eric.dictybase.dev/stockcenter/information/order")
      .waitForElementVisible("body", 1000)
    viewports.forEach(item => {
      browser
        .resizeWindow(item.width, 2000)
        .saveScreenshot(
          `./nightwatch/reports/dsc-infopage-${item.name}-chrome-${date}.png`,
        )
    })
    browser.end()
  },
  "inspect login page": browser => {
    browser
      .url("https://eric.dictybase.dev/stockcenter/login")
      .waitForElementVisible("body", 1000)
    viewports.forEach(item => {
      browser
        .resizeWindow(item.width, 2000)
        .saveScreenshot(
          `./nightwatch/reports/dsc-login-${item.name}-chrome-${date}.png`,
        )
    })
    browser.end()
  },
}<commit_msg>test: separate nightwatch functions<commit_after>const viewports = [
  {
    name: "phone",
    width: 360,
  },
  {
    name: "tablet",
    width: 768,
  },
  {
    name: "laptop",
    width: 1024,
  },
  {
    name: "tv",
    width: 1920,
  },
]

const date = new Date().toJSON().slice(0, 10)

const test = (browser, url, page) => {
  return browser.url(url).waitForElementVisible("body", 1000)
  viewports.forEach(item => {
    browser
      .resizeWindow(item.width, 2000)
      .saveScreenshot(
        `./nightwatch/reports/dsc-${page}-${item.name}-chrome-${date}.png`,
      )
  })
  browser.end()
}

module.exports = {
  "inspect homepage": browser => {
    test(browser, "https://eric.dictybase.dev/stockcenter", "homepage")
  },
  "inspect information page": browser => {
    test(
      browser,
      "https://eric.dictybase.dev/stockcenter/information/order",
      "infopage",
    )
  },
  "inspect login page": browser => {
    test(browser, "https://eric.dictybase.dev/stockcenter/login", "login")
  },
}
{'fraction_non_alphanumeric': 0.1735159817351598, 'fraction_numerical': 0.025494672754946726, 'mean_word_length': 2.4775132275132274, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 14, 'https://': 6, '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': '6844709', 'n_tokens_mistral': 976, 'n_tokens_neox': 898, 'n_words': 143}