Created
October 2, 2018 19:03
-
-
Save mago0/295fa687d8c324bf535adbd7f38c377c to your computer and use it in GitHub Desktop.
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
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