(plugin) add CommuneCreation plugin

Add E2E test to cover the API integration, access grant &c.
This commit is contained in:
Laurent Bossavit
2025-01-27 15:23:35 +01:00
committed by Laurent Bossavit
parent 471f69d4ec
commit a68f8171cb
2 changed files with 28 additions and 1 deletions

View File

@@ -250,7 +250,7 @@ class CommuneCreation(BaseOrganizationPlugin):
zone_name = orga.name.lower() + ".collectivite.fr"
try:
domain = MailDomain.objects.get(domain=zone_name)
domain = MailDomain.objects.get(name=zone_name)
except MailDomain.DoesNotExist:
domain = None

View File

@@ -0,0 +1,27 @@
import { expect, test } from '@playwright/test';
import { keyCloakSignIn } from './common';
test.beforeEach(async ({ page, browserName }) => {
await page.goto('/');
await keyCloakSignIn(page, browserName, 'marie');
});
test.describe('When a commune, domain is created on first login via ProConnect', () => {
test('it checks the domain has been created', async ({ page }) => {
const header = page.locator('header').first();
await expect(header.getByAltText('Marianne Logo')).toBeVisible();
await page
.locator('menu')
.first()
.getByLabel(`Mail Domains button`)
.click();
await expect(page).toHaveURL(/mail-domains\//);
await expect(
page.getByLabel('Mail domains panel', { exact: true }),
).toBeVisible();
await expect(page.getByText('merlaut.collectivite.fr')).toHaveCount(1);
await expect(page.getByText('No domains exist.')).toHaveCount(0);
});
});