Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
chore: fix cypress and unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
rot1024 committed Sep 28, 2021
1 parent 7af1f37 commit 97f74e9
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 7 deletions.
22 changes: 22 additions & 0 deletions cypress/plugins/index.ts
Expand Up @@ -14,6 +14,7 @@
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)

import webpackPreprocessor from "@cypress/webpack-preprocessor";
import dotenvPlugin from "cypress-dotenv";

const pluginConfig: Cypress.PluginConfig = (on, config) => {
Expand All @@ -35,6 +36,27 @@ const pluginConfig: Cypress.PluginConfig = (on, config) => {
},
});

on(
"file:preprocessor",
webpackPreprocessor({
webpackOptions: {
mode: "development",
module: {
rules: [
{
test: /\.[jt]sx?$/,
exclude: /node_modules/,
use: "babel-loader",
},
],
},
resolve: {
extensions: [".js", ".jsx", ".ts", ".tsx"],
},
},
}),
);

return config;
};

Expand Down
1 change: 0 additions & 1 deletion cypress/support/commands.ts
Expand Up @@ -85,7 +85,6 @@ Cypress.Commands.add("login", () => {
audience: config.authAudience,
client_id: config.authClientId,
grant_type: "password",
scope: "openid email profile",
},
})
.then(resp => {
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -59,6 +59,7 @@
"@babel/preset-env": "^7.12.13",
"@babel/preset-react": "^7.12.13",
"@babel/preset-typescript": "^7.12.13",
"@cypress/webpack-preprocessor": "^5.9.1",
"@graphql-codegen/cli": "^2.2.0",
"@graphql-codegen/fragment-matcher": "^3.1.0",
"@graphql-codegen/introspection": "^2.1.0",
Expand Down
8 changes: 4 additions & 4 deletions src/components/atoms/Notification/index.test.tsx
Expand Up @@ -10,21 +10,21 @@ const sampleNotification: Notification = {
text: "This is a notification for something super cool.",
};

test.skip("Notification component should be rendered", () => {
test("Notification component should be rendered", () => {
render(<NotificationBanner />);
});

test.skip("Notification component should display notification heading", () => {
test("Notification component should display notification heading", () => {
render(<NotificationBanner visible notification={sampleNotification} />);
expect(screen.getByText(/Notice/)).toBeInTheDocument();
});

test.skip("Notification component should display notification text", () => {
test("Notification component should display notification text", () => {
render(<NotificationBanner visible notification={sampleNotification} />);
expect(screen.getByText(/This is a notification/)).toBeInTheDocument();
});

test.skip("Notification component should not display anything", () => {
test("Notification component should not display anything", () => {
render(<NotificationBanner notification={sampleNotification} />);
expect(screen.getByText(/This is a notification/)).not.toBeVisible();
});
13 changes: 11 additions & 2 deletions yarn.lock
Expand Up @@ -1216,6 +1216,15 @@
tunnel-agent "^0.6.0"
uuid "^8.3.2"

"@cypress/webpack-preprocessor@^5.9.1":
version "5.9.1"
resolved "https://registry.yarnpkg.com/@cypress/webpack-preprocessor/-/webpack-preprocessor-5.9.1.tgz#2694aa832baf3984d90bcb899e1ecff377560904"
integrity sha512-cg1ikftIo7NdlRA8ocNSxWjHJlh1JlTkN9ZfXUuKWWcJgrEdYLjXk0UzY6gYbLLaFka4oIhN6SvL5Y/7iELvgg==
dependencies:
bluebird "^3.7.1"
debug "4.3.2"
lodash "^4.17.20"

"@cypress/xvfb@^1.2.4":
version "1.2.4"
resolved "https://registry.yarnpkg.com/@cypress/xvfb/-/xvfb-1.2.4.tgz#2daf42e8275b39f4aa53c14214e557bd14e7748a"
Expand Down Expand Up @@ -6132,7 +6141,7 @@ blob-util@^2.0.2:
resolved "https://registry.yarnpkg.com/blob-util/-/blob-util-2.0.2.tgz#3b4e3c281111bb7f11128518006cdc60b403a1eb"
integrity sha512-T7JQa+zsXXEa6/8ZhHcQEW1UFfVM49Ts65uBkFL6fz2QmrElqmbajIDJvuA0tEhRe5eIjpV9ZF+0RfZR9voJFQ==

bluebird@^3.3.5, bluebird@^3.5.5, bluebird@^3.7.2:
bluebird@^3.3.5, bluebird@^3.5.5, bluebird@^3.7.1, bluebird@^3.7.2:
version "3.7.2"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f"
integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==
Expand Down Expand Up @@ -7840,7 +7849,7 @@ debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.9:
dependencies:
ms "2.0.0"

debug@4, debug@^4.0.0, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2:
debug@4, debug@4.3.2, debug@^4.0.0, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2:
version "4.3.2"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.2.tgz#f0a49c18ac8779e31d4a0c6029dfb76873c7428b"
integrity sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==
Expand Down

0 comments on commit 97f74e9

Please sign in to comment.