-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added testcafe tests and pr workflow (#279)
* added testcafe tests and pr workflow * removed outputs * debug output value * empty commit to test pr workflow * updated version for reusable workflow * removed extra line * updated version * added full image path * added CONTAINER_REGISTRY_URL & imagepath as env var in test job * corrected url for saap docs app * docker run unauthorized * pull docker image first before running * added docker run gh action * login to docker before running image * added debugging steps in docker run * run saap-docs in detached mode * removed -it tag from run tests command * adjusted test workflow to build and run tests in one job * wait for saap-docs to run before testing * keep all the steps in same job so tests can find running app * adjusted test as it doesn't run on full screen * run test on chromium * keep the chromium headless and resize the browser in test to ensure consistency * removed extra step * fixed invalid yamls * resolved pr comments * removed a console.log * added yaml with indentation * corrected indentation to render correct numbering * empty commit to run pr workflow again * checking workflow again * committing yarn.lock * commit to run workflow again, also maximize window instead of resizing * empty commit to run workflow --------- Co-authored-by: Karl Johan Grahn <6355577+karl-johan-grahn@users.noreply.github.com>
- Loading branch information
1 parent
d750a9d
commit 0104bb2
Showing
7 changed files
with
3,567 additions
and
131 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
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
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,16 @@ | ||
FROM node:22-alpine | ||
WORKDIR testcafe | ||
|
||
ENV XDG_DOWNLOAD_DIR=/opt/JDownloader/Downloads | ||
|
||
COPY src src | ||
COPY package.json package.json | ||
|
||
RUN echo "Install build deps.." \ | ||
&& apk --update --no-cache add \ | ||
chromium \ | ||
tzdata | ||
|
||
RUN yarn | ||
|
||
CMD ["yarn", "start"] |
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,12 @@ | ||
{ | ||
"name": "saap-docs-testcafe-tests", | ||
"version": "1.0.0", | ||
"dependencies": { | ||
"testcafe": "^3.3.0", | ||
"dotenv": "^16.3.1" | ||
}, | ||
"scripts": { | ||
"local": "testcafe chrome src/**.ts", | ||
"start": "testcafe chromium:headless src/**.ts" | ||
} | ||
} |
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,36 @@ | ||
import { fixture, Selector } from "testcafe"; | ||
|
||
const consentControlsDiv = Selector('.md-consent__controls'); | ||
const acceptButton = consentControlsDiv.find('button').withText('Accept'); | ||
const searchInput = Selector('input.md-search__input').withAttribute('placeholder', 'Search'); | ||
const searchResultItem = Selector('li.md-search-result__item'); | ||
const searchLabel = Selector('label.md-header__button.md-icon').withAttribute('for', '__search'); | ||
|
||
|
||
fixture("Check if yamls are valid") | ||
.page`${'http://127.0.0.1:8080/saap'}` | ||
.skipJsErrors(); | ||
|
||
test(`Accept cookies if cookies consent message is displayed`, async (t) => { | ||
await t.maximizeWindow(); | ||
|
||
const acceptButtonExists = await acceptButton.exists; | ||
|
||
if (acceptButtonExists) { | ||
await t.click(acceptButton); | ||
} | ||
|
||
const searchLabelExists = await searchLabel.exists; | ||
const searchLabelVisible = await searchLabel.visible; | ||
|
||
if (searchLabelExists && searchLabelVisible) { | ||
await t.click(searchLabel); | ||
} | ||
|
||
await t.expect(searchInput.visible).ok(); | ||
await t.click(searchInput); | ||
await t.typeText(searchInput, "```") | ||
|
||
const searchResultItemExists = await searchResultItem.exists; | ||
await t.expect(searchResultItemExists).notOk('Invalid yamls exist, failing the test'); | ||
}) |
Oops, something went wrong.