|
|
@ -5,6 +5,19 @@ import { VERY_LONG_TEST_TIMEOUT, webhintURL } from "../test_utils/webhint.js";
|
|
|
|
import { withProdApp } from "../test_utils/with-prod-app.js";
|
|
|
|
import { withProdApp } from "../test_utils/with-prod-app.js";
|
|
|
|
import { LogoutURL, SignInURL, SignUpURL } from "./urls.js";
|
|
|
|
import { LogoutURL, SignInURL, SignUpURL } from "./urls.js";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe("SignUp webhint", () => {
|
|
|
|
|
|
|
|
it(
|
|
|
|
|
|
|
|
"doesn't crash",
|
|
|
|
|
|
|
|
async function () {
|
|
|
|
|
|
|
|
return withProdApp(async ({ base_url, rest_api }) => {
|
|
|
|
|
|
|
|
await rest_api.get(SignUpURL);
|
|
|
|
|
|
|
|
await webhintURL(base_url + SignUpURL);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
VERY_LONG_TEST_TIMEOUT
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
describe("SignUp", () => {
|
|
|
|
describe("SignUp", () => {
|
|
|
|
let page: Page;
|
|
|
|
let page: Page;
|
|
|
|
let browser: Browser;
|
|
|
|
let browser: Browser;
|
|
|
@ -23,100 +36,110 @@ describe("SignUp", () => {
|
|
|
|
await context.close();
|
|
|
|
await context.close();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it("doesn't crash", async function () {
|
|
|
|
|
|
|
|
this.timeout(VERY_LONG_TEST_TIMEOUT);
|
|
|
|
|
|
|
|
return withProdApp(async ({ base_url, rest_api }) => {
|
|
|
|
|
|
|
|
await rest_api.get(SignUpURL);
|
|
|
|
|
|
|
|
await webhintURL(base_url + SignUpURL);
|
|
|
|
|
|
|
|
// alternatively you can use webhintHTML for faster but less precise scans
|
|
|
|
|
|
|
|
// or for scanning responses of requests that use some form of authorization:
|
|
|
|
|
|
|
|
// const response = await rest_api.get(SignUpURL);
|
|
|
|
|
|
|
|
// await webhintHTML(response);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe("signup test", () => {
|
|
|
|
describe("signup test", () => {
|
|
|
|
it("username is taken", async function () {
|
|
|
|
it(
|
|
|
|
await withProdApp(async ({ base_url }) => {
|
|
|
|
"username is taken",
|
|
|
|
this.timeout(VERY_LONG_TEST_TIMEOUT);
|
|
|
|
async function () {
|
|
|
|
await page.goto(base_url);
|
|
|
|
await withProdApp(async ({ base_url }) => {
|
|
|
|
await page.getByRole("link", { name: "Sign up" }).click();
|
|
|
|
await page.goto(base_url);
|
|
|
|
await page.getByPlaceholder("text").click();
|
|
|
|
await page.getByRole("link", { name: "Sign up" }).click();
|
|
|
|
await page.getByPlaceholder("text").fill(username);
|
|
|
|
await page.getByPlaceholder("text").click();
|
|
|
|
await page.getByPlaceholder("text").press("Tab");
|
|
|
|
await page.getByPlaceholder("text").fill(username);
|
|
|
|
await page.getByPlaceholder("email").fill("user0192939@randomsuper.com");
|
|
|
|
await page.getByPlaceholder("text").press("Tab");
|
|
|
|
await page.getByPlaceholder("email").press("Tab");
|
|
|
|
await page
|
|
|
|
await page.getByPlaceholder("password").fill("user12341234");
|
|
|
|
.getByPlaceholder("email")
|
|
|
|
await page.getByRole("button", { name: "Wyślij" }).click();
|
|
|
|
.fill("user0192939@randomsuper.com");
|
|
|
|
await page.waitForSelector(".input__error");
|
|
|
|
await page.getByPlaceholder("email").press("Tab");
|
|
|
|
});
|
|
|
|
await page.getByPlaceholder("password").fill("user12341234");
|
|
|
|
});
|
|
|
|
await page.getByRole("button", { name: "Wyślij" }).click();
|
|
|
|
it("password is too shot ", async function () {
|
|
|
|
await page.waitForSelector(".input__error");
|
|
|
|
await withProdApp(async ({ base_url }) => {
|
|
|
|
});
|
|
|
|
this.timeout(VERY_LONG_TEST_TIMEOUT);
|
|
|
|
},
|
|
|
|
await page.goto(base_url);
|
|
|
|
VERY_LONG_TEST_TIMEOUT
|
|
|
|
await page.getByRole("link", { name: "Sign up" }).click();
|
|
|
|
);
|
|
|
|
await page.getByPlaceholder("text").click();
|
|
|
|
|
|
|
|
await page.getByPlaceholder("text").fill("dasdsa");
|
|
|
|
it(
|
|
|
|
await page.getByPlaceholder("email").click();
|
|
|
|
"password is too shot ",
|
|
|
|
await page
|
|
|
|
async function () {
|
|
|
|
.getByPlaceholder("email")
|
|
|
|
await withProdApp(async ({ base_url }) => {
|
|
|
|
.fill("asasdsdadsadss123asddsa@asdasca.com");
|
|
|
|
await page.goto(base_url);
|
|
|
|
await page.getByPlaceholder("password").click();
|
|
|
|
await page.getByRole("link", { name: "Sign up" }).click();
|
|
|
|
await page.getByPlaceholder("password").fill("asddsa");
|
|
|
|
await page.getByPlaceholder("text").click();
|
|
|
|
await page.getByRole("button", { name: "Wyślij" }).click();
|
|
|
|
await page.getByPlaceholder("text").fill("dasdsa");
|
|
|
|
await page.waitForSelector(".form-message.form-message--error");
|
|
|
|
await page.getByPlaceholder("email").click();
|
|
|
|
});
|
|
|
|
await page
|
|
|
|
});
|
|
|
|
.getByPlaceholder("email")
|
|
|
|
it("email is taken", async function () {
|
|
|
|
.fill("asasdsdadsadss123asddsa@asdasca.com");
|
|
|
|
await withProdApp(async ({ base_url }) => {
|
|
|
|
await page.getByPlaceholder("password").click();
|
|
|
|
this.timeout(VERY_LONG_TEST_TIMEOUT);
|
|
|
|
await page.getByPlaceholder("password").fill("asddsa");
|
|
|
|
await page.goto(base_url);
|
|
|
|
await page.getByRole("button", { name: "Wyślij" }).click();
|
|
|
|
await page.getByRole("link", { name: "Sign up" }).click();
|
|
|
|
await page.waitForSelector(".form-message.form-message--error");
|
|
|
|
await page.getByPlaceholder("text").click();
|
|
|
|
});
|
|
|
|
await page.getByPlaceholder("text").fill("ranomusername2023072722");
|
|
|
|
},
|
|
|
|
await page.getByPlaceholder("text").press("Tab");
|
|
|
|
VERY_LONG_TEST_TIMEOUT
|
|
|
|
await page.getByPlaceholder("email").fill(email);
|
|
|
|
);
|
|
|
|
await page.getByPlaceholder("email").press("Tab");
|
|
|
|
|
|
|
|
await page.getByPlaceholder("password").fill("asdasdasdasdasd");
|
|
|
|
it(
|
|
|
|
await page.getByRole("button", { name: "Wyślij" }).click();
|
|
|
|
"email is taken",
|
|
|
|
await page.waitForSelector(".form-message.form-message--error");
|
|
|
|
async function () {
|
|
|
|
});
|
|
|
|
await withProdApp(async ({ base_url }) => {
|
|
|
|
});
|
|
|
|
await page.goto(base_url);
|
|
|
|
it("correct", async function () {
|
|
|
|
await page.getByRole("link", { name: "Sign up" }).click();
|
|
|
|
await withProdApp(async ({ base_url }) => {
|
|
|
|
await page.getByPlaceholder("text").click();
|
|
|
|
this.timeout(VERY_LONG_TEST_TIMEOUT);
|
|
|
|
await page.getByPlaceholder("text").fill("ranomusername2023072722");
|
|
|
|
await page.goto(base_url);
|
|
|
|
await page.getByPlaceholder("text").press("Tab");
|
|
|
|
await page.getByRole("link", { name: "Sign up" }).click();
|
|
|
|
await page.getByPlaceholder("email").fill(email);
|
|
|
|
await page.getByPlaceholder("text").click();
|
|
|
|
await page.getByPlaceholder("email").press("Tab");
|
|
|
|
await page.getByPlaceholder("text").fill("ranomusername20230720722");
|
|
|
|
await page.getByPlaceholder("password").fill("asdasdasdasdasd");
|
|
|
|
await page.getByPlaceholder("text").press("Tab");
|
|
|
|
await page.getByRole("button", { name: "Wyślij" }).click();
|
|
|
|
await page.getByPlaceholder("email").fill("radomemail@emailrandom.com");
|
|
|
|
await page.waitForSelector(".form-message.form-message--error");
|
|
|
|
await page.getByPlaceholder("email").press("Tab");
|
|
|
|
});
|
|
|
|
await page.getByPlaceholder("password").fill("asdasdasdasdasd");
|
|
|
|
},
|
|
|
|
await page.getByRole("button", { name: "Wyślij" }).click();
|
|
|
|
VERY_LONG_TEST_TIMEOUT
|
|
|
|
await page.waitForSelector(".success-notify");
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
it(
|
|
|
|
|
|
|
|
"correct",
|
|
|
|
|
|
|
|
async function () {
|
|
|
|
|
|
|
|
await withProdApp(async ({ base_url }) => {
|
|
|
|
|
|
|
|
await page.goto(base_url);
|
|
|
|
|
|
|
|
await page.getByRole("link", { name: "Sign up" }).click();
|
|
|
|
|
|
|
|
await page.getByPlaceholder("text").click();
|
|
|
|
|
|
|
|
await page.getByPlaceholder("text").fill("ranomusername20230720722");
|
|
|
|
|
|
|
|
await page.getByPlaceholder("text").press("Tab");
|
|
|
|
|
|
|
|
await page
|
|
|
|
|
|
|
|
.getByPlaceholder("email")
|
|
|
|
|
|
|
|
.fill("radomemail@emailrandom.com");
|
|
|
|
|
|
|
|
await page.getByPlaceholder("email").press("Tab");
|
|
|
|
|
|
|
|
await page.getByPlaceholder("password").fill("asdasdasdasdasd");
|
|
|
|
|
|
|
|
await page.getByRole("button", { name: "Wyślij" }).click();
|
|
|
|
|
|
|
|
await page.waitForSelector(".success-notify");
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
VERY_LONG_TEST_TIMEOUT
|
|
|
|
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
describe("can access test", () => {
|
|
|
|
describe("can access test", () => {
|
|
|
|
it("access url", async function () {
|
|
|
|
it(
|
|
|
|
await withProdApp(async ({ base_url }) => {
|
|
|
|
"access url",
|
|
|
|
this.timeout(VERY_LONG_TEST_TIMEOUT);
|
|
|
|
async function () {
|
|
|
|
await page.goto(base_url);
|
|
|
|
await withProdApp(async ({ base_url }) => {
|
|
|
|
await page.getByRole("link", { name: "Sign in" }).click();
|
|
|
|
await page.goto(base_url);
|
|
|
|
await page.getByPlaceholder("text").click();
|
|
|
|
await page.getByRole("link", { name: "Sign in" }).click();
|
|
|
|
await page.getByPlaceholder("text").fill(username);
|
|
|
|
await page.getByPlaceholder("text").click();
|
|
|
|
await page.getByPlaceholder("text").press("Tab");
|
|
|
|
await page.getByPlaceholder("text").fill(username);
|
|
|
|
await page.getByPlaceholder("password").fill(password);
|
|
|
|
await page.getByPlaceholder("text").press("Tab");
|
|
|
|
await page.getByPlaceholder("password").press("Enter");
|
|
|
|
await page.getByPlaceholder("password").fill(password);
|
|
|
|
await page.waitForSelector(`a[href="${LogoutURL}"]`);
|
|
|
|
await page.getByPlaceholder("password").press("Enter");
|
|
|
|
await page.goto(base_url + SignUpURL);
|
|
|
|
await page.waitForSelector(`a[href="${LogoutURL}"]`);
|
|
|
|
await page.waitForSelector('body:has-text("no access")');
|
|
|
|
await page.goto(base_url + SignUpURL);
|
|
|
|
await page.goto(base_url);
|
|
|
|
await page.waitForSelector('body:has-text("no access")');
|
|
|
|
await page.getByRole("link", { name: "Logout" }).click();
|
|
|
|
await page.goto(base_url);
|
|
|
|
await page.waitForSelector(`a[href="${SignInURL}"]`);
|
|
|
|
await page.getByRole("link", { name: "Logout" }).click();
|
|
|
|
});
|
|
|
|
await page.waitForSelector(`a[href="${SignInURL}"]`);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
VERY_LONG_TEST_TIMEOUT
|
|
|
|
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|