-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
77dc07e
commit c19fe8d
Showing
8 changed files
with
258 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
# set -x | ||
|
||
THIS_FILE=$(readlink -f "${BASH_SOURCE[0]}") | ||
THIS_DIR=$(dirname "$THIS_FILE") | ||
ROOT_DIR=$(dirname "$THIS_DIR") | ||
|
||
. "$THIS_DIR/kash/kash.sh" | ||
|
||
## Parse options | ||
## | ||
|
||
PUBLISH=false | ||
while getopts "p" option; do | ||
case $option in | ||
p) # defines mongo version | ||
PUBLISH=true | ||
;; | ||
*) | ||
;; | ||
esac | ||
done | ||
|
||
## Init workspace | ||
## | ||
|
||
WORKSPACE_DIR="$(dirname "$ROOT_DIR")" | ||
init_app_infos "$ROOT_DIR" "$WORKSPACE_DIR/development/workspaces/apps" | ||
|
||
APP=$(get_app_name) | ||
VERSION=$(get_app_version) | ||
FLAVOR=$(get_app_flavor) | ||
|
||
echo "About to build ${APP} v${VERSION}-$FLAVOR ..." | ||
|
||
load_env_files "$WORKSPACE_DIR/development/common/kalisio_dockerhub.enc.env" "$WORKSPACE_DIR/development/common/SLACK_WEBHOOK_APPS.enc.env" | ||
load_value_files "$WORKSPACE_DIR/development/common/KALISIO_DOCKERHUB_PASSWORD.enc.value" | ||
|
||
## Build container | ||
## | ||
|
||
IMAGE_NAME="kalisio/$APP-e2e-tests" | ||
IMAGE_TAG="$VERSION-$FLAVOR" | ||
|
||
begin_group "Building container ..." | ||
|
||
docker login --username "$KALISIO_DOCKERHUB_USERNAME" --password-stdin < "$KALISIO_DOCKERHUB_PASSWORD" | ||
# DOCKER_BUILDKIT is here to be able to use Dockerfile specific dockerginore (app.Dockerfile.dockerignore) | ||
DOCKER_BUILDKIT=1 docker build \ | ||
--build-arg APP="$APP" \ | ||
--build-arg NODE_APP_INSTANCE="$FLAVOR" \ | ||
--build-arg SUBDOMAIN="$FLAVOR.kalisio.xyz" \ | ||
--build-arg HEADLESS=true \ | ||
-f test.Dockerfile \ | ||
-t "$IMAGE_NAME:$IMAGE_TAG" \ | ||
"$WORKSPACE_DIR" | ||
docker tag "$IMAGE_NAME:$IMAGE_TAG" "$IMAGE_NAME:$FLAVOR" | ||
|
||
if [ "$PUBLISH" = true ]; then | ||
docker push "$IMAGE_NAME:$IMAGE_TAG" | ||
docker push "$IMAGE_NAME:$FLAVOR" | ||
fi | ||
|
||
docker logout | ||
|
||
end_group "Building container ..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
## Use a builder | ||
## | ||
|
||
FROM node:16-bookworm-slim as Builder | ||
LABEL maintainer="[email protected]" | ||
|
||
COPY . /opt/kalisio | ||
|
||
# Setup ENV | ||
ARG APP | ||
ARG NODE_APP_INSTANCE | ||
ARG SUBDOMAIN | ||
ARG HEADLESS | ||
|
||
ENV APP=$APP | ||
ENV NODE_APP_INSTANCE=$NODE_APP_INSTANCE | ||
ENV SUBDOMAIN=$SUBDOMAIN | ||
ENV HEADLESS=$HEADLESS | ||
|
||
# Test environment configuration | ||
WORKDIR /opt/kalisio/ | ||
RUN \ | ||
cd /opt/kalisio/kdk && yarn && yarn link --link-folder /opt/kalisio/yarn-links && \ | ||
cd /opt/kalisio/$APP && yarn && yarn link "@kalisio/kdk" --link-folder /opt/kalisio/yarn-links | ||
|
||
## Copy to final container | ||
## | ||
|
||
FROM node:16-bookworm-slim | ||
LABEL maintainer="[email protected]" | ||
|
||
ENV APP=$APP | ||
ENV NODE_APP_INSTANCE=$NODE_APP_INSTANCE | ||
ENV SUBDOMAIN=$SUBDOMAIN | ||
ENV HEADLESS=$HEADLESS | ||
|
||
# Setup Puppeteer | ||
# https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#running-puppeteer-in-docker | ||
RUN export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt-get update \ | ||
&& apt-get install -y wget gnupg \ | ||
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ | ||
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \ | ||
&& apt-get update \ | ||
&& apt-get install -y \ | ||
google-chrome-stable \ | ||
fonts-ipafont-gothic \ | ||
fonts-wqy-zenhei \ | ||
fonts-thai-tlwg \ | ||
fonts-kacst \ | ||
fonts-freefont-ttf \ | ||
libxss1 \ | ||
xorg \ | ||
xserver-xorg \ | ||
xvfb \ | ||
libx11-dev \ | ||
libxext-dev \ | ||
--no-install-recommends \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy Puppeteer cache from builder | ||
COPY --from=Builder --chown=node:node /root/.cache/puppeteer /home/node/.cache/puppeteer | ||
|
||
# Copy from builder | ||
COPY --from=Builder --chown=node:node /opt/kalisio /opt/kalisio | ||
|
||
# From now on, run stuff as 'node' | ||
USER node | ||
|
||
# Run tests | ||
WORKDIR /opt/kalisio/$APP | ||
CMD [ "yarn", "test:client" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Ignore verything | ||
* | ||
|
||
# Except these | ||
!kdk/* | ||
!kapp/test/* | ||
!kapp/package.json | ||
|
||
# But ignore these anyway | ||
**/node_modules | ||
**/npm-debug.log | ||
**/*Dockerfile | ||
**/docker-compose* | ||
**/*dockerignore | ||
**/.git | ||
**/.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,37 +3,41 @@ import { core } from '@kalisio/kdk/test.client.js' | |
const suite = 'misc' | ||
|
||
describe(suite, () => { | ||
let runner | ||
let page | ||
let user | ||
let runner | ||
let page | ||
let user | ||
|
||
before(async () => { | ||
runner = new core.Runner(suite, { | ||
appName: 'kapp', | ||
browser: { | ||
args: ['--lang=fr'], | ||
slowMo: 2 | ||
} | ||
}) | ||
page = await runner.start() | ||
user = { | ||
email: '[email protected]', | ||
password: 'Pass;word1' | ||
} | ||
await core.login(page, user) | ||
before(async () => { | ||
runner = new core.Runner(suite, { | ||
appName: 'kapp', | ||
browser: { | ||
args: ['--lang=fr'], | ||
slowMo: 2 | ||
}, | ||
localStorage: { | ||
'k-app-welcome': false, | ||
'k-app-install': false | ||
} | ||
}) | ||
page = await runner.start() | ||
user = { | ||
email: '[email protected]', | ||
password: 'Pass;word1' | ||
} | ||
await core.login(page, user) | ||
}) | ||
|
||
it('misc', async () => { | ||
await page.click('#left-opener') | ||
await page.waitForTimeout(1000) | ||
await page.click('#miscellaneous') | ||
await page.waitForTimeout(1000) | ||
const match = await runner.captureAndMatch('misc') | ||
expect(match).beTrue() | ||
}) | ||
it('misc', async () => { | ||
await page.click('#left-opener') | ||
await page.waitForTimeout(1000) | ||
await page.click('#miscellaneous') | ||
await page.waitForTimeout(1000) | ||
const match = await runner.captureAndMatch('misc') | ||
expect(match).beTrue() | ||
}) | ||
|
||
after(async () => { | ||
await core.logout(page) | ||
await runner.stop() | ||
}) | ||
after(async () => { | ||
await core.logout(page) | ||
await runner.stop() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,49 +6,53 @@ import { type, clickAction } from '@kalisio/kdk/test/client/core/utils.js'; | |
const suite = 'webpush' | ||
|
||
describe(suite, () => { | ||
let runner | ||
let page | ||
let user | ||
let runner | ||
let page | ||
let user | ||
|
||
before(async () => { | ||
runner = new core.Runner(suite, { | ||
appName: 'kapp', | ||
browser: { | ||
args: ['--lang=fr'], | ||
slowMo: 2 | ||
} | ||
}) | ||
page = await runner.start() | ||
user = { | ||
email: '[email protected]', | ||
password: 'Pass;word1' | ||
} | ||
await core.login(page, user) | ||
before(async () => { | ||
runner = new core.Runner(suite, { | ||
appName: 'kapp', | ||
browser: { | ||
args: ['--lang=fr'], | ||
slowMo: 2 | ||
}, | ||
localStorage: { | ||
'k-app-welcome': false, | ||
'k-app-install': false | ||
} | ||
}) | ||
page = await runner.start() | ||
user = { | ||
email: '[email protected]', | ||
password: 'Pass;word1' | ||
} | ||
await core.login(page, user) | ||
}) | ||
|
||
it('webpush', async () => { | ||
await page.click('#left-opener') | ||
await page.waitForTimeout(1000) | ||
await page.click('#webpush') | ||
await page.waitForTimeout(1000) | ||
await type(page, '#title-field', 'Mon super titre') | ||
await type(page, '#body-field', 'Mon magnifique contenu') | ||
await type(page, '#icon-field', 'Ma fabuleuse icone') | ||
await type(page, '#url-field', 'Ma merveilleuse URL') | ||
await core.clickAction(page, 'push-btn') | ||
await page.waitForTimeout(1000) | ||
}) | ||
it('webpush', async () => { | ||
await page.click('#left-opener') | ||
await page.waitForTimeout(1000) | ||
await page.click('#webpush') | ||
await page.waitForTimeout(1000) | ||
await type(page, '#title-field', 'Mon super titre') | ||
await type(page, '#body-field', 'Mon magnifique contenu') | ||
await type(page, '#icon-field', 'Ma fabuleuse icone') | ||
await type(page, '#url-field', 'Ma merveilleuse URL') | ||
await core.clickAction(page, 'push-btn') | ||
await page.waitForTimeout(1000) | ||
}) | ||
|
||
it('webpush-clean', async () => { | ||
const cancelButtons = await page.$x('//button[contains(text(), "cancel")]'); | ||
for (const cancelButton of cancelButtons) { | ||
await cancelButton.click(); | ||
} | ||
await page.waitForTimeout(1000); | ||
}); | ||
it('webpush-clean', async () => { | ||
const cancelButtons = await page.$x('//button[contains(text(), "cancel")]') | ||
for (const cancelButton of cancelButtons) { | ||
await cancelButton.click() | ||
} | ||
await page.waitForTimeout(1000) | ||
}) | ||
|
||
after(async () => { | ||
await core.logout(page) | ||
await runner.stop() | ||
}) | ||
after(async () => { | ||
await core.logout(page) | ||
await runner.stop() | ||
}) | ||
}) |