You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
bandolier-website/tests/ui/unsubscribe.js

33 lines
992 B

import test from 'ava';
import {login, expect, tid, playstart, playstop} from '../../lib/testing.js';
import { User } from "../../lib/models.js";
import { base_host } from "../../lib/config.js";
test.before(async t => t.context = await playstart(`${base_host}/client/#/login/`));
test.after(async t => {
await playstop(t.context.browser, t.context.p);
});
test('test /login/ works', async (t) => {
const {p} = t.context;
let user;
try {
user = await login(t, p);
await p.goto(`${base_host}/client/#/email/unsubscribe/${user.unsubkey}/`);
await expect(t, p, tid("page-unsubscribe"));
await expect(t, p, tid("unsubscribe-good"));
await p.goto(`${base_host}/client/#/email/unsubscribe/deadbeef000/`);
await p.reload();
await expect(t, p, tid("page-unsubscribe"));
await expect(t, p, tid("unsubscribe-fail"));
} catch (error) {
console.log(error);
t.fail(error.message);
} finally {
if(user) await User.delete({id: user.id});
}
});