Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import type { PlaywrightTestConfig } from '@playwright/test';
import { randomBytes } from 'crypto';
import dotenv from 'dotenv';

if (process.env.NODE_ENV === 'development') {
console.log(`NODE_ENV=${process.env.NODE_ENV}`);
console.log('Using local .env file...');
dotenv.config({ path: '.env' });
}

const signingSecret = randomBytes(32).toString('hex');

Expand Down
2 changes: 2 additions & 0 deletions src/lib/prisma/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ async function main() {
{ UserId: 4, OrganizationId: 1 }, // loren_hawthorne@sil.org - SIL
{ UserId: 5, OrganizationId: 2 }, // chris.kalaam@gmail.com - Kalaam
{ UserId: 6, OrganizationId: 1 }, // Scriptoria CI - SIL
{ UserId: 6, OrganizationId: 2 }, // Scriptoria CI - Kalaam
{ UserId: 7, OrganizationId: 1 }, // 7dev7urandom@gmail.com - SIL
{ UserId: 8, OrganizationId: 1 } // aejones4gm@gmail.com - SIL
];
Expand Down Expand Up @@ -572,6 +573,7 @@ async function main() {
{ UserId: 4, RoleId: 3, OrganizationId: 1 }, // loren_hawthorne@sil.org - AppBuilder - SIL
{ UserId: 5, RoleId: 3, OrganizationId: 3 }, // chris.kalaam@gmail.com - AppBuilder - Kalaam
{ UserId: 6, RoleId: 2, OrganizationId: 1 }, // CI - OrgAdmin - SIL (this is so CI can send an invite email)
{ UserId: 6, RoleId: 4, OrganizationId: 2 }, // CI - Author - Kalaam (this is so CI can test OrgAdmin permissions)
{ UserId: 7, RoleId: 1, OrganizationId: 1 }, // 7dev7urandom@gmail.com - SuperAdmin - SIL
{ UserId: 8, RoleId: 1, OrganizationId: 1 } // aejones4gm@gmail.com - SuperAdmin - SIL
];
Expand Down
8 changes: 4 additions & 4 deletions src/routes/(authenticated)/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
bind:this={drawerToggle}
/>

<div class="h-full drawer-side shrink-0 z-10">
<aside class="h-full drawer-side shrink-0 z-10">
<label for="primary-content-drawer" class="drawer-overlay"></label>
<div
class="dark:border-gray-600 h-full mt-0 overflow-hidden w-full lg:w-72 lg:border-r min-[480px]:w-1/2 min-[720px]:w-1/3"
Expand All @@ -120,7 +120,7 @@
<li
class="dark:border-gray-600 border-y top-0 sticky z-10 bg-base-200 hover:bg-base-300 h-16"
>
<div class="flex flex-row flex-nowrap">
<div class="flex flex-row flex-nowrap" role="heading" aria-level="1">
{#if data.organizations.length > 1}
<button
class="rounded-none p-0 pl-2 cursor-pointer grow flex items-center"
Expand All @@ -136,7 +136,7 @@
</div>
</button>
{:else}
<div class="rounded-none h-16 p-0 pl-2 grow flex items-center">
<div class="rounded-none p-0 pl-2 grow flex items-center">
{@render orgDisplay(selectedOrg, 'font-bold text-sm')}
</div>
{/if}
Expand Down Expand Up @@ -280,7 +280,7 @@
</div>
</ul>
</div>
</div>
</aside>
<div class="drawer-content grow items-start justify-start">
<div class="navbar bg-[#1c3258]">
<div class="navbar-start">
Expand Down
31 changes: 30 additions & 1 deletion tests/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test.describe('Create a Test Project', () => {

test('Go to New Projects', async () => {
// go to new projects page
await page.goto('/projects/new/1');
await page.goto('/projects/new/1'); // this will set $orgActive to 1
await expect(page.getByRole('heading', { name: 'New Project' })).toBeVisible();
});

Expand Down Expand Up @@ -107,3 +107,32 @@ test.describe('Create a Test Project', () => {

// TODO: test BuildEngine stuff
});

// see issue #1368
test.describe('No admin perms in other org', () => {
// skip tests if earlier one fails
test.describe.configure({ mode: 'serial' });
let page: Page;
test.beforeAll(async ({ browser }) => {
page = await browser.newPage();
});

test('Select Org', async () => {
await page.goto('/');
// Wait for the page to load
await expect(page.getByRole('heading', { name: 'My Tasks' })).toBeVisible();
const orgSelector = page
.getByRole('complementary')
.getByRole('button', { name: /(SIL International|Kalaam Media|All Organizations)/ });
await expect(orgSelector).toBeVisible();
// $orgActive is set to 1 by Create a Test Project, switch just in case
if (!(await orgSelector.textContent())?.match(/SIL International/)) {
await orgSelector.click();
const button = page.getByRole('button', { name: 'SIL International' });
await expect(button).toBeVisible();
await button.click();
}

await expect(orgSelector).toContainText('SIL International');
});
});
Loading