...
 
Commits (2)
......@@ -6,7 +6,9 @@ variables:
CONTAINER_NAME: "registry.gitlab.com/${CI_PROJECT_PATH}/${CI_PROJECT_NAME}"
stages:
- unit-test
- build
- e2e-test
- deploy-staging
- deploy-prod
......@@ -26,6 +28,22 @@ build-docker-image:
- docker push "${CONTAINER_NAME}:${CI_COMMIT_REF_NAME}"
- docker push "${CONTAINER_NAME}:latest"
run-webide-e2e-tests:
stage: e2e-test
image: tmaier/docker-compose
script:
- cd packages/e2e
- export WEBIDE_IMAGE="${CONTAINER_NAME}:${CI_COMMIT_REF_NAME}"
- docker-compose run e2e
run-webide-unit-tests:
stage: unit-test
image: node:12-alpine
script:
- cd packages/server
- npm ci
- npm run test
provision-server:
stage: .pre
image: willhallonline/ansible:2.8-alpine
......
FROM alekzonder/puppeteer:latest as puppeteer
WORKDIR /app
COPY package.json package.json
COPY package-lock.json package-lock.json
COPY jest-puppeteer.config.js jest-puppeteer.config.js
COPY test test
RUN npm ci
ENTRYPOINT [ "npm", "run", "test" ]
version: '3'
services:
webide:
image: "${WEBIDE_IMAGE}"
environment:
- DATA_DIR=/tmp
volumes:
- /tmp:/tmp
logging:
driver: none
e2e:
build: .
environment:
- API_HOST=http://webide:8080
volumes:
- /tmp:/tmp
depends_on:
- webide
......@@ -2,7 +2,7 @@ module.exports = {
launch: {
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
'--disable-setuid-sandbox'
],
defaultViewport: {
width: 1920,
......
......@@ -46,7 +46,7 @@ exports.getInputValue = id => {
//
// Application specific utils
//
exports.API_HOST = 'http://127.0.0.1:8080';
exports.API_HOST = process.env['API_HOST'] || 'http://127.0.0.1:8080';
exports.API_ROOT = `${exports.API_HOST}/api`;
exports.fetchExamples = async () => (await fetch(`${exports.API_HOST}/static/examples/list`)).json();
......@@ -107,6 +107,6 @@ exports.verifyWithCompilationError = async (action, done) => {
await page.click('#editor');
await page.keyboard.type('asdf');
expect(await action()).toEqual('Error: ');
expect(await action()).toContain('Error: ');
done();
};
......@@ -7,19 +7,24 @@ const API_ROOT = commonUtils.API_ROOT;
const getInnerText = commonUtils.getInnerText;
const getInputValue = commonUtils.getInputValue;
const createResponseCallback = commonUtils.createResponseCallback;
const sleep = commonUtils.sleep;
const clearText = commonUtils.clearText;
describe('Share', () => {
beforeAll(() => jest.setTimeout(60000));
it('should generate a link', async done => {
await page.goto(API_HOST);
await page.click('#editor');
await clearText(page.keyboard);
await page.keyboard.type('asdf');
const responseCallback = createResponseCallback(page, `${API_ROOT}/share`);
await page.click('#share');
await responseCallback;
const actualShareLink = await page.evaluate(getInputValue, 'share-link');
const expectedShareLink = `${API_HOST}/p/v5JfXNf6G2-HSdkQhQk8lQ`;
const expectedShareLink = `${API_HOST}/p/sIpy-2D9ExpCojwuBNw_-g`;
expect(actualShareLink).toEqual(expectedShareLink);
done();
......@@ -46,7 +51,7 @@ describe('Share', () => {
// Check the code is correct. Note, because we are getting inner text we will get
// a line number as well. Therefore the expected value has a '1' prefix
const actualCode = await page.evaluate(getInnerText, 'editor');
expect(actualCode).toEqual(`1${v0State.code}`);
expect(actualCode).toContain(`1${v0State.code}`);
// Check compile configuration
await page.click('#command-select');
......@@ -146,7 +151,7 @@ describe('Share', () => {
// Check the code is correct. Note, because we are getting inner text we will get
// a line number as well. Therefore the expected value has a '1' prefix
const actualCode = await page.evaluate(getInnerText, 'editor');
expect(actualCode).toEqual(`1${v1State.state.editor.code}`);
expect(actualCode).toContain(`1${v1State.state.editor.code}`);
// Check compile configuration
await page.click('#command-select');
......
This diff is collapsed.