Skip to content

Commit

Permalink
FI-1237 feat: run tests via Playwright
Browse files Browse the repository at this point in the history
  • Loading branch information
uid11 committed Jul 9, 2024
1 parent 63199a9 commit 92ed9ea
Show file tree
Hide file tree
Showing 161 changed files with 1,666 additions and 7,537 deletions.
6 changes: 4 additions & 2 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ ignorePatterns: [bin/forks/*/package, build, local]
rules:
class-methods-use-this: off
complexity: [error, {max: 10}]
consistent-return: off
curly: [error, all]
default-param-last: off
dot-notation: off
Expand All @@ -45,6 +46,7 @@ rules:
import/no-nodejs-modules:
- error
- allow:
- node:async_hooks
- node:child_process
- node:crypto
- node:fs
Expand Down Expand Up @@ -85,12 +87,11 @@ rules:
- src/*/index.ts
- src/*/internal.ts
- src/bin/*.ts
- src/config.ts
- src/createLocator.ts
- src/esm/*.ts
- src/getModulesGraph.ts
- src/globby.ts
- src/index.ts
- src/testcafe.ts
- src/types/extends.ts
missingExports: true
unusedExports: true
Expand Down Expand Up @@ -163,6 +164,7 @@ rules:
'@typescript-eslint/class-literal-property-style': error
'@typescript-eslint/consistent-generic-constructors': error
'@typescript-eslint/consistent-indexed-object-style': error
'@typescript-eslint/consistent-return': error
'@typescript-eslint/consistent-type-assertions':
[error, {assertionStyle: as, objectLiteralTypeAssertions: never}]
'@typescript-eslint/consistent-type-definitions': [error, type]
Expand Down
19 changes: 2 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
FROM node:20.3.1-alpine AS node

FROM alpine:3.19.1

COPY --from=node /usr/lib /usr/lib
COPY --from=node /usr/local/lib /usr/local/lib
COPY --from=node /usr/local/include/node/[^o]* /usr/local/include/node/
COPY --from=node /usr/local/include/node/openssl/*[^s] /usr/local/include/node/openssl/
COPY --from=node /usr/local/include/node/openssl/archs/linux-x86_64 /usr/local/include/node/openssl/archs/linux-x86_64
COPY --from=node /usr/local/bin /usr/local/bin

RUN apk --no-cache upgrade && \
apk --no-cache add \
bash libevent chromium firefox xwininfo xvfb dbus eudev ttf-freefont fluxbox procps tzdata icu-data-full
FROM mcr.microsoft.com/playwright:v1.45.1-noble

COPY ./build/node_modules/e2ed /node_modules/e2ed

Expand All @@ -25,10 +12,8 @@ WORKDIR /

COPY ./node_modules/@types/node /node_modules/@types/node

RUN adduser -D user
RUN adduser --system --group --no-create-home user

USER user

EXPOSE 1337 1338

ENTRYPOINT ["/node_modules/e2ed/bin/dockerEntrypoint.sh"]
1 change: 1 addition & 0 deletions autotests/bin/runDocker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ docker run \
--label $CONTAINER_LABEL \
--rm \
--shm-size=512m \
--user $(id -u) \
--volume $MOUNTDIR:$MOUNTDIR \
--workdir $DIR \
$WITH_DEBUG \
Expand Down
2 changes: 1 addition & 1 deletion autotests/packs/allTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const pack: Pack = {
skipTests,
takeFullPageScreenshotOnError: false,
takeViewportScreenshotOnError: true,
testFileGlobs: ['./autotests/tests/**/*.ts', '!**/*.skip.ts'],
testFileGlobs: ['**/autotests/tests/*/selectorCustomMethods.ts', '!**/*.skip.ts'],
testIdleTimeout: 20_000,
testTimeout: 60_000,
viewportHeight: 1080,
Expand Down
3 changes: 0 additions & 3 deletions autotests/tests/e2edReportExample/browserData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@ import {
getBrowserConsoleMessages,
getBrowserJsErrors,
navigateToPage,
setPageElementsIgnoredOnInterfaceStabilization,
waitForInterfaceStabilization,
} from 'e2ed/actions';

test('correctly read data from browser', {meta: {testId: '14'}}, async () => {
await navigateToPage(E2edReportExample);

await setPageElementsIgnoredOnInterfaceStabilization(['.retry']);

await waitForInterfaceStabilization(100);

await createClientFunction(() => {
Expand Down
20 changes: 0 additions & 20 deletions autotests/tests/internalTypeTests/selectors.skip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,31 +38,11 @@ locatorIdSelector(3); // eslint-disable-line @typescript-eslint/no-magic-numbers

// ok
htmlElementSelector.filterByLocatorId('id') satisfies Selector;
// ok
htmlElementSelector.parentByLocatorId('id') satisfies Selector;
// ok
htmlElementSelector.childByLocatorId('id') satisfies Selector;
// ok
htmlElementSelector.siblingByLocatorId('id') satisfies Selector;
// ok
htmlElementSelector.nextSiblingByLocatorId('id') satisfies Selector;
// ok
htmlElementSelector.prevSiblingByLocatorId('id') satisfies Selector;

// ok
htmlElementSelector.filterByLocatorParameter('prop', 'value') satisfies Selector;
// ok
htmlElementSelector.findByLocatorParameter('prop', 'value') satisfies Selector;
// ok
htmlElementSelector.parentByLocatorParameter('prop', 'value') satisfies Selector;
// ok
htmlElementSelector.childByLocatorParameter('prop', 'value') satisfies Selector;
// ok
htmlElementSelector.siblingByLocatorParameter('prop', 'value') satisfies Selector;
// ok
htmlElementSelector.nextSiblingByLocatorParameter('prop', 'value') satisfies Selector;
// ok
htmlElementSelector.prevSiblingByLocatorParameter('prop', 'value') satisfies Selector;

// ok
void htmlElementSelector.getLocatorId();
Expand Down
2 changes: 1 addition & 1 deletion autotests/tests/main/exists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ test('exists', {meta: {testId: '1'}, testIdleTimeout: 35_000, testTimeout: 90_00
waitForResponse(({statusCode}) => statusCode === OK_STATUS_CODE),
]);

await pressKey('enter', {stabilizationInterval: 300});
await pressKey('enter');

const [requestWithQuery, successfulResponse] = await requestsPromises;

Expand Down
10 changes: 5 additions & 5 deletions bin/dockerEntrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ onExit() {

trap "onExit" EXIT

if [[ -d "./node_modules/e2ed" ]]
then
echo "Temporarily hide locally installed e2ed package:"
mv --verbose ./node_modules/e2ed ./node_modules/_e2ed
fi
#if [[ -d "./node_modules/e2ed" ]]
#then
# echo "Temporarily hide locally installed e2ed package:"
# mv --verbose ./node_modules/e2ed ./node_modules/_e2ed
#fi

if [[ -z $E2ED_DEBUG ]]
then
Expand Down
Loading

0 comments on commit 92ed9ea

Please sign in to comment.