From 9f40c73a501dd976deb975911bc45be99b85a89b Mon Sep 17 00:00:00 2001 From: Timshel Date: Fri, 13 Sep 2024 17:33:13 +0200 Subject: [PATCH] Migrate to web-v2024.8.3 --- docker/DockerSettings.yaml | 2 +- docker/Dockerfile.alpine | 9 ++--- docker/Dockerfile.debian | 9 ++--- docker/Dockerfile.j2 | 7 ++-- playwright/tests/login.smtp.spec.ts | 47 +++++++++++++---------- playwright/tests/login.spec.ts | 10 ++--- playwright/tests/organization.spec.ts | 14 ++++--- playwright/tests/sso_organization.spec.ts | 12 ++++-- 8 files changed, 62 insertions(+), 48 deletions(-) diff --git a/docker/DockerSettings.yaml b/docker/DockerSettings.yaml index 936045ee..51a677c2 100644 --- a/docker/DockerSettings.yaml +++ b/docker/DockerSettings.yaml @@ -6,7 +6,7 @@ xx_image_digest: "sha256:1978e7a58a1777cb0ef0dde76bad60b7914b21da57cfa88047875e4 rust_version: 1.81.0 # Rust version to be used debian_version: bookworm # Debian release name to be used alpine_version: "3.20" # Alpine version to be used -oidc_web_release: https://github.com/Timshel/oidc_web_builds/releases/download/v2024.6.2-4 +oidc_web_release: https://github.com/Timshel/oidc_web_vault/releases/download/v2024.8.3-3 # For which platforms/architectures will we try to build images platforms: ["linux/amd64", "linux/arm64", "linux/arm/v7", "linux/arm/v6"] # Determine the build images per OS/Arch diff --git a/docker/Dockerfile.alpine b/docker/Dockerfile.alpine index 76b59f2b..e4c19581 100644 --- a/docker/Dockerfile.alpine +++ b/docker/Dockerfile.alpine @@ -24,7 +24,7 @@ ARG TARGETARCH ARG TARGETVARIANT ARG TARGETPLATFORM -ARG OIDC_WEB_RELEASE="https://github.com/Timshel/oidc_web_builds/releases/download/v2024.6.2-4" +ARG OIDC_WEB_RELEASE="https://github.com/Timshel/oidc_web_vault/releases/download/v2024.8.3-3" SHELL ["/bin/bash", "-o", "pipefail", "-c"] @@ -41,10 +41,6 @@ ENV DEBIAN_FRONTEND=noninteractive \ -# Get all version of the front-end -RUN curl -L "${OIDC_WEB_RELEASE}/oidc_button_web_vault.tar.gz" | tar -xz ; mv web-vault /web-vault_button -RUN curl -L "${OIDC_WEB_RELEASE}/oidc_override_web_vault.tar.gz" | tar -xz ; mv web-vault /web-vault_override - # Create CARGO_HOME folder and don't download rust docs RUN mkdir -pv "${CARGO_HOME}" && \ rustup set profile minimal @@ -96,6 +92,9 @@ RUN source /env-cargo && \ ln -vfsr "/app/target/${CARGO_TARGET}/${CARGO_PROFILE}" /app/target/final ; \ fi +# Get all version of the front-end +RUN curl -L "${OIDC_WEB_RELEASE}/oidc_button_web_vault.tar.gz" | tar -xz ; mv web-vault /web-vault_button +RUN curl -L "${OIDC_WEB_RELEASE}/oidc_override_web_vault.tar.gz" | tar -xz ; mv web-vault /web-vault_override ######################## RUNTIME IMAGE ######################## # Create a new stage with a minimal image diff --git a/docker/Dockerfile.debian b/docker/Dockerfile.debian index 16340f35..1e827f22 100644 --- a/docker/Dockerfile.debian +++ b/docker/Dockerfile.debian @@ -22,7 +22,7 @@ ARG TARGETARCH ARG TARGETVARIANT ARG TARGETPLATFORM -ARG OIDC_WEB_RELEASE="https://github.com/Timshel/oidc_web_builds/releases/download/v2024.6.2-4" +ARG OIDC_WEB_RELEASE="https://github.com/Timshel/oidc_web_vault/releases/download/v2024.8.3-3" SHELL ["/bin/bash", "-o", "pipefail", "-c"] @@ -65,10 +65,6 @@ RUN apt-get update && \ # Run xx-cargo early, since it sometimes seems to break when run at a later stage echo "export CARGO_TARGET=$(xx-cargo --print-target-triple)" >> /env-cargo -# Get all version of the front-end -RUN curl -L "${OIDC_WEB_RELEASE}/oidc_button_web_vault.tar.gz" | tar -xz ; mv web-vault /web-vault_button -RUN curl -L "${OIDC_WEB_RELEASE}/oidc_override_web_vault.tar.gz" | tar -xz ; mv web-vault /web-vault_override - # Create CARGO_HOME folder and don't download rust docs RUN mkdir -pv "${CARGO_HOME}" && \ rustup set profile minimal @@ -137,6 +133,9 @@ RUN source /env-cargo && \ ln -vfsr "/app/target/${CARGO_TARGET}/${CARGO_PROFILE}" /app/target/final ; \ fi +# Get all version of the front-end +RUN curl -L "${OIDC_WEB_RELEASE}/oidc_button_web_vault.tar.gz" | tar -xz ; mv web-vault /web-vault_button +RUN curl -L "${OIDC_WEB_RELEASE}/oidc_override_web_vault.tar.gz" | tar -xz ; mv web-vault /web-vault_override ######################## RUNTIME IMAGE ######################## # Create a new stage with a minimal image diff --git a/docker/Dockerfile.j2 b/docker/Dockerfile.j2 index 6c5b06b7..795f0c3c 100644 --- a/docker/Dockerfile.j2 +++ b/docker/Dockerfile.j2 @@ -84,10 +84,6 @@ RUN apt-get update && \ echo "export CARGO_TARGET=$(xx-cargo --print-target-triple)" >> /env-cargo {% endif %} -# Get all version of the front-end -RUN curl -L "${OIDC_WEB_RELEASE}/oidc_button_web_vault.tar.gz" | tar -xz ; mv web-vault /web-vault_button -RUN curl -L "${OIDC_WEB_RELEASE}/oidc_override_web_vault.tar.gz" | tar -xz ; mv web-vault /web-vault_override - # Create CARGO_HOME folder and don't download rust docs RUN mkdir -pv "${CARGO_HOME}" && \ rustup set profile minimal @@ -169,6 +165,9 @@ RUN source /env-cargo && \ ln -vfsr "/app/target/${CARGO_TARGET}/${CARGO_PROFILE}" /app/target/final ; \ fi +# Get all version of the front-end +RUN curl -L "${OIDC_WEB_RELEASE}/oidc_button_web_vault.tar.gz" | tar -xz ; mv web-vault /web-vault_button +RUN curl -L "${OIDC_WEB_RELEASE}/oidc_override_web_vault.tar.gz" | tar -xz ; mv web-vault /web-vault_override ######################## RUNTIME IMAGE ######################## # Create a new stage with a minimal image diff --git a/playwright/tests/login.smtp.spec.ts b/playwright/tests/login.smtp.spec.ts index 7bd64947..70f6beac 100644 --- a/playwright/tests/login.smtp.spec.ts +++ b/playwright/tests/login.smtp.spec.ts @@ -96,24 +96,31 @@ test('Activaite 2fa', async ({ context, page }) => { await logUser(test, page, users.user1); - await page.getByRole('button', { name: users.user1.name }).click(); - await page.getByRole('menuitem', { name: 'Account settings' }).click(); - await page.getByLabel('Security').click(); - await page.getByRole('link', { name: 'Two-step login' }).click(); - await page.locator('li').filter({ hasText: 'Email Verification codes will' }).getByRole('button').click(); - await page.getByLabel('Master password (required)').fill(users.user1.password); - await page.getByRole('button', { name: 'Continue' }).click(); - await page.getByRole('button', { name: 'Send email' }).click(); + await test.step('activate', async () => { + await page.getByRole('button', { name: users.user1.name }).click(); + await page.getByRole('menuitem', { name: 'Account settings' }).click(); + await page.getByRole('link', { name: 'Security' }).click(); + await page.getByRole('link', { name: 'Two-step login' }).click(); + await page.locator('li').filter({ hasText: 'Email Email Enter a code sent' }).getByRole('button').click(); + await page.getByLabel('Master password (required)').fill(users.user1.password); + await page.getByRole('button', { name: 'Continue' }).click(); + await page.getByRole('button', { name: 'Send email' }).click(); + }); - const codeMail = await emails.next((mail) => mail.subject === "Vaultwarden Login Verification Code"); - const page2 = await context.newPage(); - await page2.setContent(codeMail.html); - const code = await page2.getByTestId("2fa").innerText(); - await page2.close(); + const code = await test.step('retrieve code', async () => { + const codeMail = await emails.next((mail) => mail.subject.includes("Login Verification Code")); + const page2 = await context.newPage(); + await page2.setContent(codeMail.html); + const code = await page2.getByTestId("2fa").innerText(); + await page2.close(); + return code; + }); - await page.getByLabel('2. Enter the resulting 6').fill(code); - await page.getByRole('button', { name: 'Turn on' }).click(); - await page.getByRole('heading', { name: 'Turned on', exact: true }); + await test.step('input code', async () => { + await page.getByLabel('2. Enter the resulting 6').fill(code); + await page.getByRole('button', { name: 'Turn on' }).click(); + await page.getByRole('heading', { name: 'Turned on', exact: true }); + }); emails.close(); }); @@ -129,13 +136,13 @@ test('2fa', async ({ context, page }) => { await page.getByLabel('Master password').fill(users.user1.password); await page.getByRole('button', { name: 'Log in with master password' }).click(); - const codeMail = await emails.next((mail) => mail.subject === "Vaultwarden Login Verification Code"); + const codeMail = await emails.next((mail) => mail.subject.includes("Login Verification Code")); const page2 = await context.newPage(); await page2.setContent(codeMail.html); const code = await page2.getByTestId("2fa").innerText(); await page2.close(); - await page.getByLabel('Verification code').fill(code); + await page.getByLabel(/Verification code/).fill(code); await page.getByRole('button', { name: 'Continue' }).click(); await expect(page).toHaveTitle(/Vaults/); @@ -144,9 +151,9 @@ test('2fa', async ({ context, page }) => { await test.step('disable', async () => { await page.getByRole('button', { name: 'Test' }).click(); await page.getByRole('menuitem', { name: 'Account settings' }).click(); - await page.getByLabel('Security').click(); + await page.getByRole('link', { name: 'Security' }).click(); await page.getByRole('link', { name: 'Two-step login' }).click(); - await page.locator('li').filter({ hasText: 'Email Turned on Verification' }).getByRole('button').click(); + await page.locator('li').filter({ hasText: 'Email Email Turned on Enter a' }).getByRole('button').click(); await page.getByLabel('Master password (required)').click(); await page.getByLabel('Master password (required)').fill(users.user1.password); await page.getByRole('button', { name: 'Continue' }).click(); diff --git a/playwright/tests/login.spec.ts b/playwright/tests/login.spec.ts index d0bba606..f7974ebf 100644 --- a/playwright/tests/login.spec.ts +++ b/playwright/tests/login.spec.ts @@ -43,16 +43,16 @@ test('Authenticator 2fa', async ({ context, page }) => { await test.step('Activate', async () => { await page.getByRole('button', { name: users.user1.name }).click(); await page.getByRole('menuitem', { name: 'Account settings' }).click(); - await page.getByLabel('Security').click(); + await page.getByRole('link', { name: 'Security' }).click(); await page.getByRole('link', { name: 'Two-step login' }).click(); - await page.locator('li').filter({ hasText: 'Authenticator app Use an' }).getByRole('button').click(); + await page.locator('li').filter({ hasText: /Authenticator app/ }).getByRole('button').click(); await page.getByLabel('Master password (required)').fill(users.user1.password); await page.getByRole('button', { name: 'Continue' }).click(); const secret = await page.getByLabel('Key').innerText(); totp = new OTPAuth.TOTP({ secret, period: 30 }); - await page.getByLabel('3. Enter the resulting 6').fill(totp.generate()); + await page.getByLabel(/Verification code/).fill(totp.generate()); await page.getByRole('button', { name: 'Turn on' }).click(); await page.getByRole('heading', { name: 'Turned on', exact: true }); await page.getByLabel('Close').click(); @@ -75,7 +75,7 @@ test('Authenticator 2fa', async ({ context, page }) => { await page.getByLabel('Master password').fill(users.user1.password); await page.getByRole('button', { name: 'Log in with master password' }).click(); - await page.getByLabel('Verification code').fill(totp.generate({timestamp})); + await page.getByLabel(/Verification code/).fill(totp.generate({timestamp})); await page.getByRole('button', { name: 'Continue' }).click(); await expect(page).toHaveTitle(/Vaults/); @@ -84,7 +84,7 @@ test('Authenticator 2fa', async ({ context, page }) => { await test.step('disable', async () => { await page.getByRole('button', { name: 'Test' }).click(); await page.getByRole('menuitem', { name: 'Account settings' }).click(); - await page.getByLabel('Security').click(); + await page.getByRole('link', { name: 'Security' }).click(); await page.getByRole('link', { name: 'Two-step login' }).click(); await page.locator('li').filter({ hasText: /Authenticator app/ }).getByRole('button').click(); await page.getByLabel('Master password (required)').click(); diff --git a/playwright/tests/organization.spec.ts b/playwright/tests/organization.spec.ts index f9363289..e620328c 100644 --- a/playwright/tests/organization.spec.ts +++ b/playwright/tests/organization.spec.ts @@ -47,7 +47,9 @@ test('Invite users', async ({ page }) => { await page.getByRole('button', { name: 'Invite member' }).click(); await page.getByLabel('Email (required)').fill(users.user2.email); await page.getByRole('tab', { name: 'Collections' }).click(); - await page.locator('label').filter({ hasText: 'Grant access to all current' }).click(); + await page.getByLabel('Permission').selectOption('edit'); + await page.getByLabel('Select collections').click(); + await page.getByLabel('Options list').getByText('Default collection').click(); await page.getByRole('button', { name: 'Save' }).click(); await expect(page.getByTestId("toast-message")).toHaveText('User(s) invited'); }); @@ -56,7 +58,9 @@ test('Invite users', async ({ page }) => { await page.getByRole('button', { name: 'Invite member' }).click(); await page.getByLabel('Email (required)').fill(users.user3.email); await page.getByRole('tab', { name: 'Collections' }).click(); - await page.locator('label').filter({ hasText: 'Grant access to all current' }).click(); + await page.getByLabel('Permission').selectOption('edit'); + await page.getByLabel('Select collections').click(); + await page.getByLabel('Options list').getByText('Default collection').click(); await page.getByRole('button', { name: 'Save' }).click(); await expect(page.getByTestId("toast-message")).toHaveText('User(s) invited'); }); @@ -135,9 +139,8 @@ test('invited with existing account', async ({ page }) => { test('Confirm invited user', async ({ page }) => { await logUser(test, page, users.user1, user1Mails); - await page.getByLabel('Switch products').click(); - await page.getByRole('link', { name: ' Admin Console' }).click(); - await page.getByLabel('Members').click(); + await page.getByRole('link', { name: 'Admin Console' }).click(); + await page.getByRole('link', { name: 'Members' }).click(); await test.step('Accept user2', async () => { await page.getByRole('row', { name: users.user2.name }).getByLabel('Options').click(); @@ -153,4 +156,5 @@ test('Confirm invited user', async ({ page }) => { test('Organization is visible', async ({ page }) => { await logUser(test, page, users.user2, user2Mails); await page.getByLabel('vault: Test').click(); + await expect(page.getByLabel('Filter: Default collection')).toBeVisible(); }); diff --git a/playwright/tests/sso_organization.spec.ts b/playwright/tests/sso_organization.spec.ts index c39fa589..26173a4e 100644 --- a/playwright/tests/sso_organization.spec.ts +++ b/playwright/tests/sso_organization.spec.ts @@ -51,7 +51,9 @@ test('Invite users', async ({ page }) => { await page.getByRole('button', { name: 'Invite member' }).click(); await page.getByLabel('Email (required)').fill(users.user2.email); await page.getByRole('tab', { name: 'Collections' }).click(); - await page.locator('label').filter({ hasText: 'Grant access to all current' }).click(); + await page.getByLabel('Permission').selectOption('edit'); + await page.getByLabel('Select collections').click(); + await page.getByLabel('Options list').getByText('Default collection').click(); await page.getByRole('button', { name: 'Save' }).click(); await expect(page.getByTestId("toast-message")).toHaveText('User(s) invited'); }); @@ -60,7 +62,9 @@ test('Invite users', async ({ page }) => { await page.getByRole('button', { name: 'Invite member' }).click(); await page.getByLabel('Email (required)').fill(users.user3.email); await page.getByRole('tab', { name: 'Collections' }).click(); - await page.locator('label').filter({ hasText: 'Grant access to all current' }).click(); + await page.getByLabel('Permission').selectOption('edit'); + await page.getByLabel('Select collections').click(); + await page.getByLabel('Options list').getByText('Default collection').click(); await page.getByRole('button', { name: 'Save' }).click(); await expect(page.getByTestId("toast-message")).toHaveText('User(s) invited'); }); @@ -163,7 +167,9 @@ test('Org invite auto accept', async ({ page }, testInfo: TestInfo) => { await page.getByRole('button', { name: 'Invite member' }).click(); await page.getByLabel('Email (required)').fill(users.user2.email); await page.getByRole('tab', { name: 'Collections' }).click(); - await page.locator('label').filter({ hasText: 'Grant access to all current' }).click(); + await page.getByLabel('Permission').selectOption('edit'); + await page.getByLabel('Select collections').click(); + await page.getByLabel('Options list').getByText('Default collection').click(); await page.getByRole('button', { name: 'Save' }).click(); await expect(page.getByTestId("toast-message")).toHaveText('User(s) invited'); });