web: fixed login wats tests

- pulled out some after each logic that doesnt apply to login autocomplete test
- removed test.only on the login autocomplete test

concourse/concourse#3839

Signed-off-by: James Thomson <jthomson@pivotal.io>
Co-authored-by: Jamie Klassen <cklassen@pivotal.io>
This commit is contained in:
James Thomson 2019-05-17 13:57:54 -04:00 committed by James Cooper
parent b5aea536fe
commit 9d77b232d1
1 changed files with 7 additions and 4 deletions

View File

@ -2,7 +2,6 @@ import test from 'ava';
import Fly from './helpers/fly';
import Web from './helpers/web';
import puppeteer from 'puppeteer';
import Suite from './helpers/suite';
test.beforeEach(async t => {
let url = process.env.ATC_URL || 'http://localhost:8080';
@ -23,17 +22,19 @@ test.afterEach(async t => {
});
test.afterEach.always(async t => {
await t.context.fly.run('destroy-pipeline -n -p some-pipeline');
if (t.context.web.page && !t.context.succeeded) {
await t.context.web.page.screenshot({path: 'failure.png'});
}
if (t.context.web.browser) {
await t.context.web.browser.close();
}
await t.context.fly.cleanup();
});
async function cleanup (t) {
await t.context.fly.run('destroy-pipeline -n -p some-pipeline');
};
test('can fly login with browser and reuse same browser without CSRF issues', async t => {
let flyPromise = t.context.fly.spawn(`login -c ${t.context.url}`);
flyPromise.childProcess.stdout.on('data', async data => {
@ -57,9 +58,11 @@ test('can fly login with browser and reuse same browser without CSRF issues', as
await t.context.web.page.click(playButton);
await t.context.web.page.waitForSelector(pauseButton, {timeout: 90000});
t.pass();
cleanup(t);
});
test.only('password input does not autocomplete', async t => {
test('password input does not autocomplete', async t => {
await t.context.web.page.goto(t.context.web.route('/sky/login'));
let passwordInput = await t.context.web.page.waitForSelector('#password', {timeout: 90000});
const autocomplete = await t.context.web.page.evaluate(body => body.getAttribute('autocomplete'), passwordInput);