-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: cleanup e2e tests and add a github action
- Loading branch information
1 parent
baddb0f
commit 6a44643
Showing
13 changed files
with
146 additions
and
97 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: e2e | ||
|
||
on: | ||
# allow manual dispatch | ||
workflow_dispatch: | ||
# run on pushes to staging | ||
push: | ||
branches: | ||
- staging | ||
- autoimport | ||
|
||
jobs: | ||
e2e: | ||
name: 'Hangar E2E Tests' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: BrowserStack Env Setup | ||
uses: browserstack/github-actions/setup-env@master | ||
with: | ||
username: ${{ secrets.BROWSERSTACK_USERNAME }} | ||
access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
|
||
- name: Set up pnpm | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8 | ||
|
||
- name: Get pnpm store directory | ||
id: pnpm-cache | ||
shell: bash | ||
run: | | ||
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | ||
- name: Cache Pnpm | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store- | ||
- name: Install e2e deps | ||
env: | ||
CI: true | ||
run: (cd e2e && pnpm install --frozen-lockfile) | ||
|
||
- name: Run e2e tests | ||
env: | ||
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} | ||
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} | ||
run: (cd e2e && pnpm run browserstack-multiple) |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,17 @@ | ||
import { expect } from "chai"; | ||
|
||
Feature("Index Page"); | ||
|
||
Scenario("Test Project List", async ({ I, util, IndexPage }) => { | ||
util.openHangarPage("/"); | ||
|
||
let placeholder = await I.grabAttributeFrom(IndexPage.searchField, "placeholder"); | ||
expect(placeholder).to.not.contain("0"); | ||
|
||
I.fillField(IndexPage.searchField, "Some Value That doesnt Exist"); | ||
I.waitInUrl("query"); | ||
placeholder = await I.grabAttributeFrom(IndexPage.searchField, "placeholder"); | ||
expect(placeholder).to.contain("0"); | ||
|
||
await util.browserStackStatus(true, "Test passed"); | ||
}); |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
"strictNullChecks": false, | ||
"types": [ | ||
"codeceptjs", | ||
"chai", | ||
"node" | ||
], | ||
"declaration": true, | ||
|
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 |
---|---|---|
@@ -1,12 +1,3 @@ | ||
const { I } = inject(); | ||
|
||
class IndexPage { | ||
constructor() { | ||
//insert your locators | ||
// this.button = '#button' | ||
} | ||
// insert your methods here | ||
} | ||
|
||
module.exports = new IndexPage(); | ||
export = IndexPage; | ||
module.exports = new (class { | ||
searchField = "input[name='query']"; | ||
})(); |
This file was deleted.
Oops, something went wrong.
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,17 @@ | ||
const { I } = inject(); | ||
|
||
module.exports = new (class { | ||
url = process.env.BROWSERSTACK_LOCAL === "true" ? "http://localhost:3333" : "https://hangar.papermc.dev"; | ||
|
||
public openHangarPage(path: string) { | ||
I.amOnPage(this.url + path); | ||
I.waitForFunction(() => window["hangarLoaded"], 10); | ||
} | ||
|
||
public async browserStackStatus(passed: boolean, reason: string) { | ||
if (process.env.BROWSERSTACK_DEV === "true") return; | ||
await I.executeScript( | ||
`browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"${passed ? "passed" : "failed"}","reason": "${reason}"}}`, | ||
); | ||
} | ||
})(); |
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,5 @@ | ||
declare global { | ||
interface Window { | ||
hangarLoaded?: boolean; | ||
} | ||
} |