"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SignUpPage = void 0;
const test_1 = require("@playwright/test");
class SignUpPage {
    page;
    firstNameInput;
    lastNameInput;
    passwordInput;
    passwordInputInvitedUser;
    signupButton;
    emailInput;
    companyInput;
    createAccountButton;
    backgroundDrodownList;
    whatDoYouDoDropdownList;
    APIClientDropdownList;
    levelOfExperienceDropdownList;
    nextButton;
    runProcessRadioButton;
    whyAreYouEvaluatingCamunda;
    confirmSaaSTrial;
    loginToCamundaButton;
    backgroundPageHeading;
    useCasePageHeading;
    goalPageHeading;
    camundaPlansPageHeading;
    setPasswordPageHeading;
    signUpCompletedPageHeading;
    verifyEmailText;
    signupFailedText;
    constructor(page) {
        this.page = page;
        this.firstNameInput = page.getByLabel('First Name');
        this.lastNameInput = page.getByLabel('Last Name');
        this.passwordInput = page.locator('[id="password"]');
        this.passwordInputInvitedUser = page.getByLabel('Password (min 12 characters)');
        this.signupButton = page.getByRole('button', { name: 'Sign up' });
        this.emailInput = page.getByLabel('Email');
        this.companyInput = page.getByLabel('Company*');
        this.createAccountButton = page.getByRole('button', {
            name: 'Create account',
        });
        this.backgroundDrodownList = page.getByLabel('Background*');
        this.whatDoYouDoDropdownList = page.getByLabel('What do you do?*');
        this.APIClientDropdownList = page.getByRole('combobox', {
            name: 'what is your preferred api client?',
        });
        this.levelOfExperienceDropdownList = page.getByLabel('what is your level of experience with process design?*');
        this.nextButton = page.getByRole('button', { name: 'Next' });
        this.runProcessRadioButton = page.getByRole('radio');
        this.whyAreYouEvaluatingCamunda = page.getByLabel('Why are you evaluating');
        this.confirmSaaSTrial = page.getByRole('button', {
            name: 'Confirm SaaS Trial',
        });
        this.loginToCamundaButton = page.getByRole('button', {
            name: 'log in to camunda',
        });
        this.backgroundPageHeading = page.getByRole('heading', {
            name: 'great! to customize your account, tell us a little about yourself',
        });
        this.useCasePageHeading = page.getByRole('heading', {
            name: 'thank you! how will you use camunda',
        });
        this.goalPageHeading = page.getByRole('heading', {
            name: 'finally, what is your goal with camunda?',
        });
        this.camundaPlansPageHeading = page.getByRole('heading', {
            name: 'Here is your custom recommendation, please confirm your Camunda account below:',
        });
        this.setPasswordPageHeading = page.getByRole('heading', {
            name: 'Finish',
        });
        this.signUpCompletedPageHeading = page.getByRole('heading', {
            name: 'thank you for signing up for camunda',
        });
        this.runProcessRadioButton = page.getByRole('radio', { name: 'yes' });
        this.verifyEmailText = page.getByText('Verify your email');
        this.signupFailedText = page.getByText('Sign up failed');
    }
    async signupToC8(emailAddress, password) {
        await this.page.goto('https://accounts.ultrawombat.com/signup');
        await this.clickFirstNameInput();
        await this.fillFirstNameInput('QA');
        await this.clickLastNameInput();
        await this.fillLastNameInput('Camunda');
        await this.clickEmailInput();
        await this.fillEmailInput(emailAddress);
        await this.clickPasswordInput();
        await this.fillPasswordInput(password);
        await this.clickSignupButton();
        await (0, test_1.expect)(this.verifyEmailText.first()).toBeVisible({
            timeout: 40000,
        });
        await (0, test_1.expect)(this.signupFailedText.first()).not.toBeVisible({
            timeout: 30000,
        });
    }
    async clickFirstNameInput() {
        await (0, test_1.expect)(this.firstNameInput).toBeVisible({ timeout: 60000 });
        await this.firstNameInput.click({ timeout: 30000 });
    }
    async fillFirstNameInput(firstName) {
        await this.firstNameInput.fill(firstName);
    }
    async clickLastNameInput() {
        await (0, test_1.expect)(this.lastNameInput).toBeVisible({ timeout: 60000 });
        await this.lastNameInput.click();
    }
    async fillLastNameInput(lastName) {
        await this.lastNameInput.fill(lastName);
    }
    async clickPasswordInput() {
        await (0, test_1.expect)(this.passwordInput).toBeVisible({ timeout: 60000 });
        await this.passwordInput.click({ timeout: 30000 });
    }
    async fillPasswordInput(password) {
        await this.passwordInput.fill(password);
    }
    async clickPasswordInputInvitedUser() {
        await this.passwordInputInvitedUser.click({ timeout: 30000 });
    }
    async fillPasswordInputInvitedUser(password) {
        await this.passwordInputInvitedUser.fill(password);
    }
    async clickSignupButton() {
        await this.signupButton.click();
    }
    async clickEmailInput() {
        await this.emailInput.click();
    }
    async fillEmailInput(email) {
        await this.emailInput.fill(email);
    }
}
exports.SignUpPage = SignUpPage;
