Skip to content

Commit

Permalink
tests: fix custom claims test data
Browse files Browse the repository at this point in the history
  • Loading branch information
stonith404 committed Oct 28, 2024
1 parent 8304065 commit b9daa5d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
20 changes: 10 additions & 10 deletions frontend/tests/user-group.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ test('Update user group custom claims', async ({ page }) => {
// Add two custom claims
await page.getByRole('button', { name: 'Add custom claim' }).click();

await page.getByPlaceholder('Key').fill('custom_claim_1');
await page.getByPlaceholder('Value').fill('custom_claim_1_value');
await page.getByPlaceholder('Key').fill('customClaim1');
await page.getByPlaceholder('Value').fill('customClaim1_value');

await page.getByRole('button', { name: 'Add another' }).click();
await page.getByPlaceholder('Key').nth(1).fill('custom_claim_2');
await page.getByPlaceholder('Value').nth(1).fill('custom_claim_2_value');
await page.getByPlaceholder('Key').nth(1).fill('customClaim2');
await page.getByPlaceholder('Value').nth(1).fill('customClaim2_value');

await page.getByRole('button', { name: 'Save' }).nth(2).click();

Expand All @@ -94,10 +94,10 @@ test('Update user group custom claims', async ({ page }) => {
await page.reload();

// Check if custom claims are saved
await expect(page.getByPlaceholder('Key').first()).toHaveValue('custom_claim_1');
await expect(page.getByPlaceholder('Value').first()).toHaveValue('custom_claim_1_value');
await expect(page.getByPlaceholder('Key').nth(1)).toHaveValue('custom_claim_2');
await expect(page.getByPlaceholder('Value').nth(1)).toHaveValue('custom_claim_2_value');
await expect(page.getByPlaceholder('Key').first()).toHaveValue('customClaim1');
await expect(page.getByPlaceholder('Value').first()).toHaveValue('customClaim1_value');
await expect(page.getByPlaceholder('Key').nth(1)).toHaveValue('customClaim2');
await expect(page.getByPlaceholder('Value').nth(1)).toHaveValue('customClaim2_value');

// Remove one custom claim
await page.getByLabel('Remove custom claim').first().click();
Expand All @@ -106,6 +106,6 @@ test('Update user group custom claims', async ({ page }) => {
await page.reload();

// Check if custom claim is removed
await expect(page.getByPlaceholder('Key').first()).toHaveValue('custom_claim_2');
await expect(page.getByPlaceholder('Value').first()).toHaveValue('custom_claim_2_value');
await expect(page.getByPlaceholder('Key').first()).toHaveValue('customClaim2');
await expect(page.getByPlaceholder('Value').first()).toHaveValue('customClaim2_value');
});
20 changes: 10 additions & 10 deletions frontend/tests/user-settings.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,12 @@ test('Update user custom claims', async ({ page }) => {
// Add two custom claims
await page.getByRole('button', { name: 'Add custom claim' }).click();

await page.getByPlaceholder('Key').fill('custom_claim_1');
await page.getByPlaceholder('Value').fill('custom_claim_1_value');
await page.getByPlaceholder('Key').fill('customClaim1');
await page.getByPlaceholder('Value').fill('customClaim1_value');

await page.getByRole('button', { name: 'Add another' }).click();
await page.getByPlaceholder('Key').nth(1).fill('custom_claim_2');
await page.getByPlaceholder('Value').nth(1).fill('custom_claim_2_value');
await page.getByPlaceholder('Key').nth(1).fill('customClaim2');
await page.getByPlaceholder('Value').nth(1).fill('customClaim2_value');

await page.getByRole('button', { name: 'Save' }).nth(1).click();

Expand All @@ -154,10 +154,10 @@ test('Update user custom claims', async ({ page }) => {
await page.reload();

// Check if custom claims are saved
await expect(page.getByPlaceholder('Key').first()).toHaveValue('custom_claim_1');
await expect(page.getByPlaceholder('Value').first()).toHaveValue('custom_claim_1_value');
await expect(page.getByPlaceholder('Key').nth(1)).toHaveValue('custom_claim_2');
await expect(page.getByPlaceholder('Value').nth(1)).toHaveValue('custom_claim_2_value');
await expect(page.getByPlaceholder('Key').first()).toHaveValue('customClaim1');
await expect(page.getByPlaceholder('Value').first()).toHaveValue('customClaim1_value');
await expect(page.getByPlaceholder('Key').nth(1)).toHaveValue('customClaim2');
await expect(page.getByPlaceholder('Value').nth(1)).toHaveValue('customClaim2_value');

// Remove one custom claim
await page.getByLabel('Remove custom claim').first().click();
Expand All @@ -166,6 +166,6 @@ test('Update user custom claims', async ({ page }) => {
await page.reload();

// Check if custom claim is removed
await expect(page.getByPlaceholder('Key').first()).toHaveValue('custom_claim_2');
await expect(page.getByPlaceholder('Value').first()).toHaveValue('custom_claim_2_value');
await expect(page.getByPlaceholder('Key').first()).toHaveValue('customClaim2');
await expect(page.getByPlaceholder('Value').first()).toHaveValue('customClaim2_value');
});

0 comments on commit b9daa5d

Please sign in to comment.