(e2e) remove some flakiness

Service worker added some flakiness, we
activate the sw only if not from the CI.
We add as well the email of the user added in a
doc to the toast message. This way we can check
if the user was added correctly, this will remove
some flakiness in some tests.
This commit is contained in:
Anthony LC
2024-06-13 14:24:56 +02:00
committed by Anthony LC
parent 14a91a5698
commit ae9555284d
9 changed files with 32 additions and 20 deletions

View File

@@ -5,7 +5,7 @@
"scripts": {
"dev": "next dev",
"build": "prettier --check . && yarn stylelint && next build",
"build:ci": "cp .env.development .env.local && yarn build",
"build:ci": "cp .env.development .env.local && cross-env NEXT_PUBLIC_CI=true yarn build",
"build-theme": "cunningham -g css,ts -o src/cunningham --utility-classes",
"start": "npx -y serve@latest out",
"lint": "tsc --noEmit && next lint",
@@ -22,6 +22,7 @@
"@openfun/cunningham-react": "2.9.3",
"@tanstack/react-query": "5.40.1",
"grapesjs-blocks-basic": "1.0.2",
"cross-env": "*",
"i18next": "23.11.5",
"lodash": "4.17.21",
"luxon": "3.4.4",

View File

@@ -102,7 +102,9 @@ export const ModalAddMembers = ({
? t('Invitation sent to {{email}}.', {
email: option.value.email,
})
: t('User added to the document.');
: t('User {{email}} added to the document.', {
email: option.value.email,
});
toast(message, VariantType.SUCCESS, toastOptions);
};

View File

@@ -17,7 +17,7 @@ export default function App({ Component, pageProps }: AppPropsWithLayout) {
const { t } = useTranslation();
useEffect(() => {
if ('serviceWorker' in navigator) {
if ('serviceWorker' in navigator && process.env.NEXT_PUBLIC_CI !== 'true') {
navigator.serviceWorker.register('/service-worker.js').catch((err) => {
console.error('Service worker registration failed:', err);
});