Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test/avr 549 playwright tests #695

Merged
merged 3 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Deploy Staging

on:
release:
types: [ published ]
types: [published]
push:
branches:
- dev
Expand All @@ -12,7 +12,7 @@ on:
permissions:
contents: read
id-token: write

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -22,8 +22,8 @@ jobs:
- name: Use Node.js 14
uses: actions/setup-node@v4
with:
node-version: '14'
cache: 'npm'
node-version: "14"
cache: "npm"

- name: Install deps
run: |
Expand All @@ -38,7 +38,7 @@ jobs:

- name: Run E2E Tests
run: |
npm run e2e
npm run e2e:stg

- name: Build SSR
run: |
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ name: Deploy to ECS

on:
release:
types: [ published ]
types: [published]
workflow_dispatch:

permissions:
contents: read
id-token: write

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -18,8 +18,8 @@ jobs:
- name: Use Node.js 14
uses: actions/setup-node@v4
with:
node-version: '14'
cache: 'npm'
node-version: "14"
cache: "npm"

- name: Install deps
run: |
Expand All @@ -35,7 +35,7 @@ jobs:
- name: Run E2E Tests
continue-on-error: true
run: |
npm run e2e
npm run e2e:live

- name: Build SSR
run: |
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/deploy_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ name: Deploy to GH Pages (dev)

on:
push:
branches: [ dev ]
branches: [dev]

permissions:
contents: read
id-token: write

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -17,8 +17,8 @@ jobs:
- name: Use Node.js 14
uses: actions/setup-node@v4
with:
node-version: '14'
cache: 'npm'
node-version: "14"
cache: "npm"

- name: Install deps
run: |
Expand All @@ -33,7 +33,7 @@ jobs:

- name: Run E2E Tests
run: |
npm run e2e
npm run e2e:dev

- name: Build Beta
run: |
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: E2E Tests
on:
workflow_dispatch:
inputs:
env:
description: "Environment to run tests against"
required: true
default: "live"
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "14"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npm run e2e:${{ github.event.inputs.env }}
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 14
37 changes: 0 additions & 37 deletions .github/workflows/test.yml

This file was deleted.

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,8 @@ testem.log
# System Files
.DS_Store
Thumbs.db
node_modules/
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
![Avrae.io](docs/avrae.png)

## Important Links

- [avrae.io](https://avrae.io)
- [Support Discord Server](http://support.avrae.io)
- [D&D Beyond Discord Server](https://dndbeyond.com/discord)
- [Build](https://travis-ci.org/avrae/avrae.io)

## Overview

This is the source code for the Angular website located at https://avrae.io. It serves as a web portal for users of the D&D Beyond Avrae Discord Bot to manage their data.
This is the source code for the Angular website located at https://avrae.io. It serves as a web portal for users of the D&D Beyond Avrae Discord Bot to manage their data.

## Local Config

Expand All @@ -34,7 +35,7 @@ Run `npm run dev:ssr`

To run end to end tests:

Run `ng e2e` or `npm run e2e`
Run `npm run e2e:<env>` where env is either `live`, `stg`, `dev` or `docker`

## Lint

Expand Down
12 changes: 12 additions & 0 deletions e2e/app.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { test, expect } from "@playwright/test";

test.describe("avrae frontpage", () => {
test.beforeEach(async ({ page }) => {
await page.goto("/");
});

test("should display welcome message", async ({ page }) => {
const paragraphText = await page.textContent("css=.about-avrae");
expect(paragraphText).toContain("I am Avrae");
});
});
35 changes: 35 additions & 0 deletions e2e/commands.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { test, expect } from "@playwright/test";
import { CommandsPage } from "./pages/commands";

test.describe("avrae commands page", () => {
let commandsPage: CommandsPage;

test.beforeEach(async ({ page }) => {
commandsPage = new CommandsPage(page);
await commandsPage.navigate();
});

test("should display a header", async () => {
const headerText = await commandsPage.getHeaderText();
expect(headerText).toEqual("Avrae Commands");
});

test("should show some modules", async () => {
const renderedModules = await commandsPage.getRenderedModules();
for (const moduleElement of await renderedModules.all()) {
expect(moduleElement);
}
});

test("should show some commands in each module", async () => {
const renderedModules = await commandsPage.getRenderedModules();
for (const moduleElement of await renderedModules.all()) {
const moduleCommands = await commandsPage.getModuleCommands(
moduleElement
);
for (const commandElement of await moduleCommands.all()) {
expect(commandElement).toBeVisible();
}
}
});
});
25 changes: 25 additions & 0 deletions e2e/pages/commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Page } from "@playwright/test";

export class CommandsPage {
readonly page: Page;

constructor(page: Page) {
this.page = page;
}

async navigate() {
await this.page.goto("/commands");
}

async getHeaderText() {
return this.page.textContent("h1");
}

async getRenderedModules() {
return this.page.locator("css=.module-container");
}

async getModuleCommands(moduleElement) {
return moduleElement.locator("css=avr-command-display");
}
}
10 changes: 0 additions & 10 deletions e2e/protractor-ci.conf.js

This file was deleted.

28 changes: 0 additions & 28 deletions e2e/protractor.conf.js

This file was deleted.

14 changes: 0 additions & 14 deletions e2e/src/app.e2e-spec.ts

This file was deleted.

11 changes: 0 additions & 11 deletions e2e/src/app.po.ts

This file was deleted.

25 changes: 0 additions & 25 deletions e2e/src/commands.e2e-spec.ts

This file was deleted.

13 changes: 0 additions & 13 deletions e2e/tsconfig.e2e.json

This file was deleted.

Loading