Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
Quickfix
  • Loading branch information
monsieurswag committed Dec 3, 2024
1 parent 30cf467 commit e1433a6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
17 changes: 7 additions & 10 deletions .github/workflows/functional-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,21 +164,18 @@ jobs:
- name: Install enterprise backend
working-directory: ${{ env.enterprise-backend-directory }}
run: poetry install
- name: Create the frontend build directory before build
working-directory: ${{ env.enterprise-backend-directory }}
run: mkdir -p ./build/frontend
- name: Create frontend environment variables file
working-directory: ${{ env.enterprise-frontend-build-directory }}
run: |
touch .env
echo PUBLIC_BACKEND_API_URL=http://localhost:8000/api >> .env
echo CI_TEST=1 >> .env
- name: Build enterprise frontend
working-directory: ${{ env.enterprise-frontend-directory }}
run: make
- name: Install Playwright browser ${{ matrix.playwright-browser }}
working-directory: ${{ env.enterprise-frontend-build-directory }}
run: pnpm exec playwright install --with-deps ${{ matrix.playwright-browser }}
- name: Create frontend environment variables file
working-directory: ${{ env.enterprise-frontend-build-directory }}
run: |
touch .env
echo PUBLIC_BACKEND_API_URL=http://localhost:8000/api >> .env
echo CI_TEST=1 >> .env
- name: Create backend environment variables file
working-directory: ${{ env.backend-directory }}
run: |
Expand Down Expand Up @@ -214,7 +211,7 @@ jobs:
nohup poetry run python manage.py runserver --settings=${{ env.enterprise-backend-settings-module }} &
- name: Run tests with browser ${{ matrix.playwright-browser }}
working-directory: ${{ env.enterprise-frontend-build-directory }}
run: pnpm exec playwright test --project=${{ matrix.playwright-browser }} -g "fuzz"
run: pnpm exec playwright test --project=${{ matrix.playwright-browser }}
env:
CI: true
- uses: actions/upload-artifact@v4
Expand Down
8 changes: 6 additions & 2 deletions frontend/src/routes/(authentication)/login/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ export const actions: Actions = {
const preferences = await preferencesRes.json();

const currentLang = cookies.get('ciso_lang') || 'en';
const preferedLang = preferences.lang;
const preferedLang = preferences.lang || 'en';

if (preferedLang && currentLang !== preferedLang) {
if (currentLang !== preferedLang) {
cookies.set('ciso_lang', preferedLang, {
httpOnly: false,
sameSite: 'lax',
Expand All @@ -134,6 +134,10 @@ export const actions: Actions = {
const next = url.searchParams.get('next') || '/';
const secureNext = getSecureRedirect(next);
const refreshQueryParam = CI_TEST ? '' : '?refresh=1';
if (currentLang != preferedLang) {
redirect(302, secureNext);
}

const redirectURL = secureNext ? `${secureNext}${refreshQueryParam}` : `/${refreshQueryParam}`;
redirect(302, redirectURL);
},
Expand Down

0 comments on commit e1433a6

Please sign in to comment.