Skip to content

Commit

Permalink
ci(docker): fix e2e docker image backend deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
DenysKarmazynDFINITY committed Aug 16, 2024
1 parent 7fa0204 commit 6576c7d
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ jobs:
docker-build-e2e:
runs-on: ubuntu-20.04
steps:
- name: Delete unnecessary tools folder to free space
run: rm -rf /opt/hostedtoolcache

- name: Checkout
uses: actions/checkout@v4

Expand Down
7 changes: 3 additions & 4 deletions Dockerfile.e2e
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ RUN DEBIAN_FRONTEND=noninteractive apt update && apt install -y \
netcat \
ca-certificates \
build-essential \
llvm-dev \
clang \
jq \
&& rm -rf /var/lib/apt/lists/*

# Install NodeJS
Expand All @@ -29,12 +32,8 @@ ENV RUSTUP_HOME=/home/apprunner/.rustup \
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
RUN /bin/bash -c "source /home/apprunner/.cargo/env && rustc --version && cargo --version"

# Install jq
RUN apt-get install jq

# Add wasm32-unknown-unknown target
RUN /bin/bash -c "source /home/apprunner/.cargo/env && rustup target add wasm32-unknown-unknown"

# Install dfx
ENV DFX_PORT=4943
ENV DFX_VERSION=0.20.0
Expand Down
3 changes: 3 additions & 0 deletions docker/deploy
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ dfx start --background --quiet

./docker/wait-port "$DFX_PORT"

dfx canister create internet_identity
dfx canister create pouh_issuer

npm run deploy

dfx stop
33 changes: 29 additions & 4 deletions e2e/homepage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,38 @@ test.describe('logged out user', () => {
});

testWithII.describe('logged in user', () => {
testWithII.beforeEach(async ({ page, iiPage }) => {
testWithII.beforeEach(async ({ page, iiPage, context }) => {
const url = 'http://127.0.0.1:4943';
const canisterId = 'bkyz2-fmaaa-aaaaa-qaaaq-cai';
const timeout = 180000;
await iiPage.waitReady({ url, canisterId, timeout });

await page.goto(testUrl);

await iiPage.signInWithNewIdentity();
// test if adding timeout solves the issue
const iiPageCustomPromise = context.waitForEvent('page', { timeout });
await page.getByTestId('login-button').click();

const iiPageCustom = await iiPageCustomPromise;
await expect(iiPageCustom).toHaveTitle('Internet Identity', { timeout });

await iiPageCustom.locator('#registerButton').click({ timeout });
await iiPageCustom.locator('[data-action=construct-identity]').click({ timeout });

await iiPageCustom.locator('input#captchaInput').fill('a');
await iiPageCustom.locator('#confirmRegisterButton').click({ timeout });

const identity = await iiPageCustom.locator('#userNumber').textContent({ timeout });
expect(identity).not.toBeNull();

await iiPageCustom.locator('#displayUserContinue').click();
await iiPageCustom.waitForEvent('close', { timeout });
expect(iiPageCustom.isClosed()).toBe(true);

// await iiPage.signInWithNewIdentity();

await page.getByTestId('exchange-balance-output').waitFor();
await page.getByTestId('tokens-skeletons-initialized').waitFor();
await page.getByTestId('exchange-balance-output').waitFor({ timeout });
await page.getByTestId('tokens-skeletons-initialized').waitFor({ timeout });
});

testWithII('should display logged in hero and tokens', async ({ page }) => {
Expand Down

0 comments on commit 6576c7d

Please sign in to comment.