Skip to content
Merged
27 changes: 27 additions & 0 deletions apps/webapp/test/e2e_tests/backend/brigRepository.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,4 +251,31 @@ export class BrigRepositoryE2E {
},
);
}

public async claimDomain(domain: string) {
await this.axiosInstance.put(
`i/domain-registration/${domain}`,
{
backend: {
config_url: new URL('deeplink.json', process.env.FEDERATION_BACKEND_URL),
webapp_url: process.env.FEDERATION_WEBAPP_URL,
},
domain_redirect: 'backend',
team_invite: 'not-allowed',
},
{
headers: {
Authorization: `Basic ${BASIC_AUTH}`,
},
},
);
}

public async deleteDomainClaim(domain: string) {
await this.axiosInstance.delete(`i/domain-registration/${domain}`, {
headers: {
Authorization: `Basic ${BASIC_AUTH}`,
},
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Wire
* Copyright (C) 2025 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*
*/

import {expect, test} from '../../test.fixtures';
import {PageManager} from '../../pageManager';
import {faker} from '@faker-js/faker';

const ON_PREM_WEBAPP_URL = 'https://webapp.anta.wire.link';

test.describe('On Prem Login Redirect Flow', () => {
Comment thread
JacquelineLehner marked this conversation as resolved.
let domain: string;
let email: string;

test.beforeEach(async ({api}) => {
domain = faker.internet.domainName();
email = `redirect-user@${domain}`;

await test.step('Claim domain and configure on-prem redirect', async () => {
await api.brig.claimDomain(domain);
Comment thread
markbrockhoff marked this conversation as resolved.
});
});

test('On Prem Login Redirect', {tag: ['@TC-8757', '@regression']}, async ({context, createPage}) => {
const page = await createPage(context);
const pageManager = PageManager.from(page);
const {pages} = pageManager.webapp;

await test.step('Open login page and enter email with claimed domain', async () => {
await pageManager.openSSOPage();
await pages.singleSignOn().enterEmailOnSSOPage(email);
});

await test.step('Verify connect-to-organization backend dialog is shown', async () => {
await expect(page.getByText("Connect to your organization's backend?")).toBeVisible();
await expect(page.getByText(ON_PREM_WEBAPP_URL)).toBeVisible();
});

await test.step('Click connect and verify redirect to on-prem webapp', async () => {
await page.getByRole('button', {name: 'Connect'}).click();
await expect(page).toHaveURL(new RegExp(String.raw`${ON_PREM_WEBAPP_URL}`), {timeout: 20_000});
});
});

test.afterEach(async ({api}) => {
await test.step('Delete claimed domain registration', async () => {
await api.brig.deleteDomainClaim(domain);
});
});
});
Loading