Commit eec1070f authored by Axel Martinius Kjønsberg's avatar Axel Martinius Kjønsberg
Browse files

Merge branch 'add-system-tests' into 'master'

Add system tests

See merge request !5
parents 1912099a ce2134be
Pipeline #126935 passed with stage
in 1 minute and 16 seconds
......@@ -13,7 +13,7 @@ test-backend:
- coverage run --source='.' manage.py test tests
- coverage report -m
# test-e2e:
# e2e:firefox:
# image: nikolaik/python-nodejs:python3.8-nodejs10
# stage: test
# script:
......
This diff is collapsed.
import { Selector, t } from "testcafe";
import { Alice } from "../roles";
const registerTestUsers = async () => {
await t
.navigateTo(`http://localhost:3000/register.html`)
.typeText("#register-username", "alice")
.typeText("#register-password", "aliceisok")
.typeText("#register-email", "tester@testing.com")
.click("#btn-create-account");
}
fixture `Register`
.page`http://localhost:3000/register.html`;
test('Can register', async t => {
await registerTestUsers();
})
fixture`Login`
.page`http://localhost:3000/login.html`
.beforeEach(async (t) => {
await registerTestUsers();
await t.useRole(Alice);
});
test("Can view profile", async (t) => {
const username = Selector("#username", { timeout: 1000 });
const textContent = username.textContent;
await t
.navigateTo("/profile.html")
.expect(username.exists).ok()
// .expect(textContent).eql("alice");
});
import { Role } from "testcafe";
const Alice = Role(`http://localhost:3000/login.html`, async (t) => {
await t
.typeText("#login-username", "alice")
.typeText("#login-password", "aliceisok")
.click("#rememberMe")
.click("#btn-login");
});
export { Alice }
\ No newline at end of file
import { Selector, Role } from "testcafe";
// fixture `Register`
// .page `http://localhost:3000/register.html`;
// test('Can register', async t => {
// await t
// .typeText()
// })
const alice = Role("http://localhost:3000/login.html", async (t) => {
await t
.typeText("#login-username", "alice")
.typeText("#login-password", "aliceisok")
.click("#rememberMe")
.click("#btn-login");
});
fixture`Login`.page`http://localhost:3000/index.html`;
test("Can view profile", async (t) => {
const username = Selector("#username");
await t
.useRole(alice)
.navigateTo("/profile.html")
.expect(username.exists)
.ok()
.expect(username.textContent)
.eql("alice");
});
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment