Skip to content

Instantly share code, notes, and snippets.

@mago0
Created October 2, 2018 19:03
Show Gist options
  • Save mago0/295fa687d8c324bf535adbd7f38c377c to your computer and use it in GitHub Desktop.
Save mago0/295fa687d8c324bf535adbd7f38c377c to your computer and use it in GitHub Desktop.
import { step, TestSettings, TestData, Until, By, Browser, MouseButtons, Device, ENV } from '@flood/element'
import * as assert from 'assert'
export const settings: TestSettings = {
userAgent: 'flood-chrome-test',
clearCache: true,
clearCookies: true,
loopCount: Infinity,
duration: -1,
actionDelay: 0.5,
stepDelay: 1.0,
waitTimeout: 30,
}
export const baseURL = 'https://lt01-public.flodogs.com'
interface EmailData {
email: string
}
TestData.fromCSV<EmailData>('plt_users.csv')
.shuffle()
.circular()
export default () => {
step('1. Bootstrap', async browser => {
await browser.visit(`${baseURL}?flotest=1`, { waitUntil: 'domcontentloaded' })
let expBtn = By.xpath("//flo-experimentation-widget/div/button")
browser.click(expBtn)
await browser.wait(Until.elementLocated(By.visibleText('FloTest Experiments')))
await browser.click(By.xpath("//button[contains(text(),'Treatment - Magazine')]"))
await browser.click(By.xpath("//button[contains(text(),'V3 Player')]"))
})
step('2. Visit Live Page and Click Login', async browser => {
await browser.visit(`${baseURL}/live/7459`)
await browser.wait(Until.urlContains('signup'))
await browser.click(By.linkText('Log In'))
await browser.wait(Until.urlContains('login'))
})
step('3. Submit Login Details', async (browser: Browser, data: EmailData) => {
assert.ok(data.email, 'data.email is set')
let inputEmail = By.nameAttr('Email')
await browser.wait(Until.elementLocated(inputEmail))
await browser.type(inputEmail, `${data.email}`, { "delay": 1.0 })
await browser.type(By.nameAttr('Password'), '123456', { "delay": 0.5 })
await browser.click(By.nameAttr('Login'))
})
step('Verify Live Page', async browser => {
await browser.wait(Until.elementLocated(By.xpath('//*[@id="6861"]')))
await browser.takeScreenshot()
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment