Skip to content

Commit 3abb5af

Browse files
committed
Merge branch 'unified-desktop-gui' into tgriesser/unify/ui-data-push
* unified-desktop-gui: feat: add remove project button (#18381) fix(launchpad): prevent code colors from leaking out of reporter (#18382) Fix README on unified-desktop-gui
2 parents 6e3acff + ad1d88e commit 3abb5af

File tree

13 files changed

+225
-131
lines changed

13 files changed

+225
-131
lines changed

README.md

Lines changed: 51 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -1,142 +1,79 @@
11
<p align="center">
2-
<a href="" rel="noopener">
3-
<img width=200px height=200px src="https://i.imgur.com/FxL5qM0.jpg" alt="Bot logo"></a>
2+
<img src="https://cloud.githubusercontent.com/assets/1268976/20607953/d7ae489c-b24a-11e6-9cc4-91c6c74c5e88.png"/>
43
</p>
5-
6-
<h3 align="center">cypress</h3>
7-
8-
<div align="center">
9-
10-
[![Status](https://img.shields.io/badge/status-active-success.svg)]()
11-
[![Platform](https://img.shields.io/badge/platform-reddit-orange.svg)](https://www.reddit.com/user/Wordbook_Bot)
12-
[![GitHub Issues](https://img.shields.io/github/issues/kylelobo/The-Documentation-Compendium.svg)](https://github.com/kylelobo/The-Documentation-Compendium/issues)
13-
[![GitHub Pull Requests](https://img.shields.io/github/issues-pr/kylelobo/The-Documentation-Compendium.svg)](https://github.com/kylelobo/The-Documentation-Compendium/pulls)
14-
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](/LICENSE)
15-
16-
</div>
17-
18-
---
19-
20-
<p align="center"> 🤖 Few lines describing what your bot does.
21-
<br>
4+
<p align="center">
5+
<a href="https://on.cypress.io">Documentation</a> |
6+
<a href="https://on.cypress.io/changelog">Changelog</a> |
7+
<a href="https://on.cypress.io/roadmap">Roadmap</a>
228
</p>
239

24-
## 📝 Table of Contents
25-
26-
- [About](#about)
27-
- [Demo / Working](#demo)
28-
- [How it works](#working)
29-
- [Usage](#usage)
30-
- [Getting Started](#getting_started)
31-
- [Deploying your own bot](#deployment)
32-
- [Built Using](#built_using)
33-
- [TODO](../TODO.md)
34-
- [Contributing](../CONTRIBUTING.md)
35-
- [Authors](#authors)
36-
- [Acknowledgments](#acknowledgement)
37-
38-
## 🧐 About <a name = "about"></a>
39-
40-
Write about 1-2 paragraphs describing the purpose of your bot.
41-
42-
## 🎥 Demo / Working <a name = "demo"></a>
43-
44-
![Working](https://media.giphy.com/media/20NLMBm0BkUOwNljwv/giphy.gif)
10+
<h3 align="center">
11+
The web has evolved. Finally, testing has too.
12+
</h3>
4513

46-
## 💭 How it works <a name = "working"></a>
14+
<p align="center">
15+
Fast, easy and reliable testing for anything that runs in a browser.
16+
</p>
17+
<p align="center">
18+
Join us, we're <a href="https://cypress.io/jobs">hiring</a>.
19+
</p>
4720

48-
The bot first extracts the word from the comment and then fetches word definitions, part of speech, example and source from the Oxford Dictionary API.
21+
<p align="center">
22+
<a href="https://www.npmjs.com/package/cypress">
23+
<img src="https://img.shields.io/npm/dm/cypress.svg" alt="npm"/>
24+
</a>
25+
<a href="https://gitter.im/cypress-io/cypress">
26+
<img src="https://img.shields.io/gitter/room/cypress-io/cypress.svg" alt="Gitter chat"/>
27+
</a>
28+
<a href="https://stackshare.io/cypress">
29+
<img src="https://img.stackshare.io/misc/follow-on-stackshare-badge.svg" alt="StackShare"/>
30+
</a><br />
31+
</p>
4932

50-
If the word does not exist in the Oxford Dictionary, the Oxford API then returns a 404 response upon which the bot then tries to fetch results form the Urban Dictionary API.
33+
## What is Cypress?
5134

52-
The bot uses the Pushshift API to fetch comments, PRAW module to reply to comments and Heroku as a server.
35+
<p align="center">
36+
<a href="https://player.vimeo.com/video/237527670">
37+
<img alt="Why Cypress Video" src="https://user-images.githubusercontent.com/1271364/31739717-dbdff0ee-b41c-11e7-9b16-bfa1b6ac1814.png" width="75%" height="75%" />
38+
</a>
39+
</p>
5340

54-
The entire bot is written in Python 3.6
41+
## Installing
5542

56-
## 🎈 Usage <a name = "usage"></a>
43+
[![npm version](https://badge.fury.io/js/cypress.svg)](https://badge.fury.io/js/cypress)
5744

58-
To use the bot, type:
45+
Install Cypress for Mac, Linux, or Windows, then [get started](https://docs.cypress.io/guides/getting-started/installing-cypress.html).
5946

47+
```bash
48+
npm install cypress --save-dev
6049
```
61-
!dict word
50+
or
51+
```bash
52+
yarn add cypress --dev
6253
```
6354

64-
The first part, i.e. "!dict" **is not** case sensitive.
65-
66-
The bot will then give you the Oxford Dictionary (or Urban Dictionary; if the word does not exist in the Oxford Dictionary) definition of the word as a comment reply.
67-
68-
### Example:
69-
70-
> !dict what is love
55+
![installing-cli e1693232](https://user-images.githubusercontent.com/1271364/31740846-7bf607f0-b420-11e7-855f-41c996040d31.gif)
7156

72-
**Definition:**
7357

74-
Baby, dont hurt me~
75-
Dont hurt me~ no more.
58+
## Contributing
7659

77-
**Example:**
60+
- [![CircleCI](https://circleci.com/gh/cypress-io/cypress/tree/develop.svg?style=svg)](https://circleci.com/gh/cypress-io/cypress/tree/develop) - `develop` branch
61+
- [![CircleCI](https://circleci.com/gh/cypress-io/cypress/tree/master.svg?style=svg)](https://circleci.com/gh/cypress-io/cypress/tree/master) - `master` branch
7862

79-
Dude1: Bruh, what is love?
80-
Dude2: Baby, dont hurt me, dont hurt me- no more!
81-
Dude1: dafuq?
63+
Please see our [Contributing Guideline](./CONTRIBUTING.md) which explains repo organization, linting, testing, and other steps.
8264

83-
**Source:** https://www.urbandictionary.com/define.php?term=what%20is%20love
65+
## License
8466

85-
---
67+
[![license](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/cypress-io/cypress/blob/master/LICENSE)
8668

87-
<sup>Beep boop. I am a bot. If there are any issues, contact my [Master](https://www.reddit.com/message/compose/?to=PositivePlayer1&subject=/u/Wordbook_Bot)</sup>
69+
This project is licensed under the terms of the [MIT license](/LICENSE).
8870

89-
<sup>Want to make a similar reddit bot? Check out: [GitHub](https://github.com/kylelobo/Reddit-Bot)</sup>
71+
## Badges
9072

91-
## 🏁 Getting Started <a name = "getting_started"></a>
73+
Let the world know your project is using Cypress.io to test with this cool badge
9274

93-
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See [deployment](#deployment) for notes on how to deploy the project on a live system.
94-
95-
### Prerequisites
96-
97-
What things you need to install the software and how to install them.
98-
99-
```
100-
Give examples
101-
```
102-
103-
### Installing
104-
105-
A step by step series of examples that tell you how to get a development env running.
106-
107-
Say what the step will be
108-
109-
```
110-
Give the example
111-
```
112-
113-
And repeat
75+
[![Cypress.io](https://img.shields.io/badge/tested%20with-Cypress-04C38E.svg)](https://www.cypress.io/)
11476

11577
```
116-
until finished
78+
[![Cypress.io](https://img.shields.io/badge/tested%20with-Cypress-04C38E.svg)](https://www.cypress.io/)
11779
```
118-
119-
End with an example of getting some data out of the system or using it for a little demo.
120-
121-
## 🚀 Deploying your own bot <a name = "deployment"></a>
122-
123-
To see an example project on how to deploy your bot, please see my own configuration:
124-
125-
- **Heroku**: https://github.com/kylelobo/Reddit-Bot#deploying_the_bot
126-
127-
## ⛏️ Built Using <a name = "built_using"></a>
128-
129-
- [PRAW](https://praw.readthedocs.io/en/latest/) - Python Reddit API Wrapper
130-
- [Heroku](https://www.heroku.com/) - SaaS hosting platform
131-
132-
## ✍️ Authors <a name = "authors"></a>
133-
134-
- [@kylelobo](https://github.com/kylelobo) - Idea & Initial work
135-
136-
See also the list of [contributors](https://github.com/kylelobo/The-Documentation-Compendium/contributors) who participated in this project.
137-
138-
## 🎉 Acknowledgements <a name = "acknowledgement"></a>
139-
140-
- Hat tip to anyone whose code was used
141-
- Inspiration
142-
- References

packages/data-context/src/actions/ProjectActions.ts

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { MutationAddProjectArgs, MutationAppCreateConfigFileArgs, SpecType } from '@packages/graphql/src/gen/nxs.gen'
22
import type { FindSpecs, FoundBrowser, FoundSpec, FullConfig, LaunchArgs, LaunchOpts, OpenProjectLaunchOptions } from '@packages/types'
33
import path from 'path'
4-
import type { Maybe } from '../data/coreDataShape'
4+
import type { Maybe, ProjectShape } from '../data/coreDataShape'
55

66
import type { DataContext } from '..'
77

@@ -16,6 +16,7 @@ export interface ProjectApiShape {
1616
initializeProject(args: LaunchArgs, options: OpenProjectLaunchOptions, browsers: FoundBrowser[]): Promise<unknown>
1717
launchProject(browser: FoundBrowser, spec: Cypress.Spec, options: LaunchOpts): void
1818
insertProjectToCache(projectRoot: string): void
19+
removeProjectFromCache(projectRoot: string): void
1920
getProjectRootsFromCache(): Promise<string[]>
2021
clearLatestProjectsCache(): Promise<unknown>
2122
}
@@ -33,6 +34,14 @@ export class ProjectActions {
3334
return
3435
}
3536

37+
private get projects () {
38+
return this.ctx.coreData.app.projects
39+
}
40+
41+
private set projects (projects: ProjectShape[]) {
42+
this.ctx.coreData.app.projects = projects
43+
}
44+
3645
async setActiveProject (projectRoot: string) {
3746
this.ctx.coreData.app.activeProject = {
3847
projectRoot,
@@ -66,14 +75,14 @@ export class ProjectActions {
6675
}
6776

6877
async loadProjects () {
69-
const projectRoots = await this.ctx._apis.projectApi.getProjectRootsFromCache()
78+
const projectRoots = await this.api.getProjectRootsFromCache()
7079

71-
this.ctx.coreData.app.projects = [
72-
...this.ctx?.coreData?.app?.projects,
80+
this.projects = [
81+
...this.projects,
7382
...projectRoots.map((projectRoot) => ({ projectRoot })),
7483
]
7584

76-
return this.ctx.coreData.app.projects
85+
return this.projects
7786
}
7887

7988
async initializeActiveProject () {
@@ -107,10 +116,10 @@ export class ProjectActions {
107116
throw new Error(`Cannot add ${args.path} as a project, it is not a directory`)
108117
}
109118

110-
const found = this.ctx.projectsList.find((x) => x.projectRoot === args.path)
119+
const found = this.projects.find((x) => x.projectRoot === args.path)
111120

112121
if (!found) {
113-
this.ctx.coreData.app.projects.push({ projectRoot: args.path })
122+
this.projects.push({ projectRoot: args.path })
114123
this.api.insertProjectToCache(args.path)
115124
}
116125

@@ -136,8 +145,15 @@ export class ProjectActions {
136145
return this.api.launchProject(browser, spec, {})
137146
}
138147

139-
removeProject () {
140-
//
148+
removeProject (projectRoot: string) {
149+
const found = this.ctx.projectsList.find((x) => x.projectRoot === projectRoot)
150+
151+
if (!found) {
152+
throw new Error(`Cannot remove ${projectRoot}, it is not a known project`)
153+
}
154+
155+
this.projects = this.projects.filter((project) => project.projectRoot !== projectRoot)
156+
this.api.removeProjectFromCache(projectRoot)
141157
}
142158

143159
syncProjects () {

packages/frontend-shared/cypress/support/mock-graphql/stubgql-Mutation.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,9 @@ export const stubMutation: MaybeResolver<Mutation> = {
3535

3636
return {}
3737
},
38+
removeProject (source, args, ctx) {
39+
ctx.app.projects = ctx.app.projects.filter((p) => p.projectRoot !== args.path)
40+
41+
return ctx.app
42+
},
3843
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
code[class*="language-"],
2+
pre[class*="language-"] {
3+
@apply text-gray-500;
4+
text-shadow: $white 0px 1px;
5+
}
6+
7+
.token.property,
8+
.token.tag,
9+
.token.boolean,
10+
.token.number,
11+
.token.constant,
12+
.token.symbol,
13+
.token.deleted {
14+
@apply text-red-500;
15+
}
16+
17+
.token.selector,
18+
.token.attr-name,
19+
.token.string,
20+
.token.char,
21+
.token.builtin,
22+
.token.inserted {
23+
@apply text-jade-500;
24+
}
25+
26+
.token.entity,
27+
.token.url,
28+
.language-css .token.string,
29+
.style .token.string,
30+
.token.regex,
31+
.token.important,
32+
.token.variable {
33+
@apply text-orange-500;
34+
@apply bg-gray-50;
35+
}
36+
37+
.token.operator,
38+
.token.punctuation {
39+
@apply text-gray-500;
40+
}
41+
42+
.token.atrule,
43+
.token.attr-value,
44+
.token.class-name {
45+
@apply text-indigo-500;
46+
}
47+
48+
.token.keyword,
49+
.token.function {
50+
@apply text-purple-500;
51+
}
52+
53+
.token.comment {
54+
@apply text-gray-500;
55+
}
56+
57+
.line-numbers .line-numbers-rows {
58+
@apply border-r-0;
59+
}
60+
61+
.line-numbers-rows > span:before {
62+
@apply text-gray-200;
63+
}
64+
65+
.line-highlight {
66+
@apply bg-gray-100;
67+
68+
&:before {
69+
@apply hidden;
70+
}
71+
}
72+
73+
.test-error-code-frame pre[data-line] {
74+
@apply pl-2;
75+
@apply relative;
76+
}

packages/graphql/schemas/schema.graphql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,9 @@ type Mutation {
297297
"""Set the current navigation item"""
298298
navigationMenuSetItem(type: NavItem!): NavigationMenu
299299

300+
"""Remove project from projects array and cache"""
301+
removeProject(path: String!): App!
302+
300303
"""Set active project to run tests on"""
301304
setActiveProject(path: String!): App!
302305
triggerIpc: Boolean

packages/graphql/src/schemaTypes/objectTypes/gql-Mutation.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,19 @@ export const mutation = mutationType({
188188
},
189189
})
190190

191+
t.nonNull.field('removeProject', {
192+
type: 'App',
193+
description: 'Remove project from projects array and cache',
194+
args: {
195+
path: nonNull(stringArg()),
196+
},
197+
async resolve (_root, args, ctx) {
198+
await ctx.actions.project.removeProject(args.path)
199+
200+
return ctx.appData
201+
},
202+
})
203+
191204
t.nonNull.field('setActiveProject', {
192205
type: 'App',
193206
description: 'Set active project to run tests on',

0 commit comments

Comments
 (0)