Skip to content

Commit

Permalink
[e2e] Increase timeout and add cache for gh action
Browse files Browse the repository at this point in the history
  • Loading branch information
sim51 committed Jul 7, 2023
1 parent b5b9919 commit d8a3d47
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
25 changes: 24 additions & 1 deletion .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,43 @@ on:
pull_request:
branches: [main, dev]
jobs:
test:
e2e:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18

- name: Cache node_modules
uses: actions/cache@v3
with:
path: "node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('package-lock.json') }}

- name: Playwright version
id: playwright-version
run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./package-lock.json').dependencies['@playwright/test'].version)")" >> $GITHUB_ENV

- name: Cache playwright binaries
uses: actions/cache@v3
id: playwright-cache
with:
path: "~/.cache/ms-playwright"
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}

- name: Install dependencies
run: npm ci

- name: Install Playwright Browsers
run: npx playwright install --with-deps
if: steps.playwright-cache.outputs.cache-hit != 'true'

- name: Run Playwright tests
run: npx playwright test
if: steps.playwright-cache.outputs.cache-hit != 'true'

- uses: actions/upload-artifact@v3
if: always()
with:
Expand Down
4 changes: 2 additions & 2 deletions e2e/load-graph.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ FILES.forEach((file) => {
await page.goto(`/?gexf=${BASE_URL}${file}`);

// Wait for the graph to be fully loaded
await expect(page).toHaveTitle(`Gephi Lite - ${file}`);
await expect(page).toHaveTitle(`Gephi Lite - ${file}`, { timeout: 30000 });

// Check the screenshot
await expect(page).toHaveScreenshot(`${file}.png`);
await expect(page).toHaveScreenshot(`${file}.png`, { maxDiffPixelRatio: 0.01 });
});
});

0 comments on commit d8a3d47

Please sign in to comment.