test: add accept invitation invalid token tests

This commit is contained in:
Jakub P.
2024-07-16 12:08:50 +02:00
parent b7b3a3025b
commit 2f1f537e00
17 changed files with 143 additions and 12 deletions

View File

@@ -1,3 +1,4 @@
const { expect } = require('@playwright/test');
const { BasePage } = require('./base-page');
export class AcceptInvitation extends BasePage {
@@ -14,6 +15,7 @@ export class AcceptInvitation extends BasePage {
this.passwordConfirmationTextField = this.page.getByTestId('confirm-password-text-field');
this.submitButton = this.page.getByTestId('submit-button');
this.pageTitle = this.page.getByTestId('accept-invitation-form-title');
this.formErrorMessage = this.page.getByTestId('accept-invitation-form-error');
}
async open(token) {
@@ -28,4 +30,17 @@ export class AcceptInvitation extends BasePage {
await this.submitButton.click();
}
async fillPasswordField(password) {
await this.passwordTextField.fill(password);
await this.passwordConfirmationTextField.fill(password);
}
async excpectSubmitButtonToBeDisabled() {
await expect(this.submitButton).toBeDisabled();
}
async expectAlertToBeVisible() {
await expect(this.formErrorMessage).toBeVisible();
}
}

View File

@@ -1,4 +1,3 @@
const path = require('node:path');
const { ApplicationsModal } = require('./applications-modal');
const { AuthenticatedPage } = require('./authenticated-page');

View File

@@ -5,6 +5,7 @@ const { ExecutionsPage } = require('./executions-page');
const { FlowEditorPage } = require('./flow-editor-page');
const { UserInterfacePage } = require('./user-interface-page');
const { LoginPage } = require('./login-page');
const { AcceptInvitation } = require('./accept-invitation-page');
const { adminFixtures } = require('./admin');
exports.test = test.extend({
@@ -46,6 +47,11 @@ exports.publicTest = test.extend({
await use(loginPage);
},
acceptInvitationPage: async ({ page }, use) => {
const acceptInvitationPage = new AcceptInvitation(page);
await use(acceptInvitationPage);
}
});
expect.extend({

View File

@@ -0,0 +1,11 @@
const { Client } = require('pg');
const client = new Client({
host: process.env.POSTGRES_HOST,
user: process.env.POSTGRES_USERNAME,
port: process.env.POSTGRES_PORT,
password: process.env.POSTGRES_PASSWORD,
database: process.env.POSTGRES_DATABASE
});
exports.client = client;