cypress-cli-select 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/.github/workflows/jest.yml +12 -0
  2. package/CONTRIBUTING.md +39 -0
  3. package/LICENSE.md +21 -0
  4. package/README.md +197 -0
  5. package/assets/choose-spec-pattern-demo.gif +0 -0
  6. package/assets/cypress-cli-select-animated.gif +0 -0
  7. package/assets/print-selected-demo.png +0 -0
  8. package/assets/run-help.gif +0 -0
  9. package/assets/run-spec-tag.gif +0 -0
  10. package/assets/run-spec-title.gif +0 -0
  11. package/cypress/e2e/1-getting-started/todo.cy.js +143 -0
  12. package/cypress/e2e/2-advanced-examples/actions.cy.js +321 -0
  13. package/cypress/e2e/2-advanced-examples/aliasing.cy.js +39 -0
  14. package/cypress/e2e/2-advanced-examples/assertions.cy.js +176 -0
  15. package/cypress/e2e/2-advanced-examples/connectors.cy.js +98 -0
  16. package/cypress/e2e/2-advanced-examples/cookies.cy.js +118 -0
  17. package/cypress/e2e/2-advanced-examples/cypress_api.cy.js +211 -0
  18. package/cypress/e2e/2-advanced-examples/location.cy.js +32 -0
  19. package/cypress/e2e/2-advanced-examples/misc.cy.js +90 -0
  20. package/cypress/e2e/2-advanced-examples/navigation.cy.js +55 -0
  21. package/cypress/e2e/2-advanced-examples/network_requests.cy.js +163 -0
  22. package/cypress/e2e/2-advanced-examples/querying.cy.js +114 -0
  23. package/cypress/e2e/2-advanced-examples/spies_stubs_clocks.cy.js +220 -0
  24. package/cypress/e2e/2-advanced-examples/storage.cy.js +117 -0
  25. package/cypress/e2e/2-advanced-examples/traversal.cy.js +126 -0
  26. package/cypress/e2e/2-advanced-examples/utilities.cy.js +109 -0
  27. package/cypress/e2e/2-advanced-examples/viewport.cy.js +58 -0
  28. package/cypress/e2e/2-advanced-examples/waiting.cy.js +30 -0
  29. package/cypress/e2e/2-advanced-examples/window.cy.js +22 -0
  30. package/cypress/support/commands.js +25 -0
  31. package/cypress/support/component-index.html +14 -0
  32. package/cypress/support/component.js +24 -0
  33. package/cypress/support/e2e.js +19 -0
  34. package/cypress.config.js +25 -0
  35. package/cypress.new.config.js +26 -0
  36. package/index.js +586 -0
  37. package/package.json +46 -0
  38. package/src/components/Clock.cy.js +13 -0
  39. package/src/components/Stepper.cy.js +13 -0
  40. package/src/sortable-list.js +82 -0
  41. package/tapes/run-help.tape +94 -0
  42. package/tapes/run-spec-tag.tape +163 -0
  43. package/tapes/run-spec-title.tape +191 -0
  44. package/tests/cli-component.spec.js +409 -0
  45. package/tests/cli-e2e.spec.js +439 -0
@@ -0,0 +1,58 @@
1
+ /// <reference types="cypress" />
2
+ context('Viewport', () => {
3
+ beforeEach(() => {
4
+ cy.visit('https://example.cypress.io/commands/viewport')
5
+ })
6
+
7
+ it('cy.viewport() - set the viewport size and dimension', () => {
8
+ // https://on.cypress.io/viewport
9
+
10
+ cy.get('#navbar').should('be.visible')
11
+ cy.viewport(320, 480)
12
+
13
+ // the navbar should have collapse since our screen is smaller
14
+ cy.get('#navbar').should('not.be.visible')
15
+ cy.get('.navbar-toggle').should('be.visible').click()
16
+ cy.get('.nav').find('a').should('be.visible')
17
+
18
+ // lets see what our app looks like on a super large screen
19
+ cy.viewport(2999, 2999)
20
+
21
+ // cy.viewport() accepts a set of preset sizes
22
+ // to easily set the screen to a device's width and height
23
+
24
+ // We added a cy.wait() between each viewport change so you can see
25
+ // the change otherwise it is a little too fast to see :)
26
+
27
+ cy.viewport('macbook-15')
28
+ cy.wait(200)
29
+ cy.viewport('macbook-13')
30
+ cy.wait(200)
31
+ cy.viewport('macbook-11')
32
+ cy.wait(200)
33
+ cy.viewport('ipad-2')
34
+ cy.wait(200)
35
+ cy.viewport('ipad-mini')
36
+ cy.wait(200)
37
+ cy.viewport('iphone-6+')
38
+ cy.wait(200)
39
+ cy.viewport('iphone-6')
40
+ cy.wait(200)
41
+ cy.viewport('iphone-5')
42
+ cy.wait(200)
43
+ cy.viewport('iphone-4')
44
+ cy.wait(200)
45
+ cy.viewport('iphone-3')
46
+ cy.wait(200)
47
+
48
+ // cy.viewport() accepts an orientation for all presets
49
+ // the default orientation is 'portrait'
50
+ cy.viewport('ipad-2', 'portrait')
51
+ cy.wait(200)
52
+ cy.viewport('iphone-4', 'landscape')
53
+ cy.wait(200)
54
+
55
+ // The viewport will be reset back to the default dimensions
56
+ // in between tests (the default can be set in cypress.config.{js|ts})
57
+ })
58
+ })
@@ -0,0 +1,30 @@
1
+ /// <reference types="cypress" />
2
+ context('Waiting', () => {
3
+ beforeEach(() => {
4
+ cy.visit('https://example.cypress.io/commands/waiting')
5
+ })
6
+ // BE CAREFUL of adding unnecessary wait times.
7
+ // https://on.cypress.io/best-practices#Unnecessary-Waiting
8
+
9
+ // https://on.cypress.io/wait
10
+ it('cy.wait() - wait for a specific amount of time', () => {
11
+ cy.get('.wait-input1').type('Wait 1000ms after typing')
12
+ cy.wait(1000)
13
+ cy.get('.wait-input2').type('Wait 1000ms after typing')
14
+ cy.wait(1000)
15
+ cy.get('.wait-input3').type('Wait 1000ms after typing')
16
+ cy.wait(1000)
17
+ })
18
+
19
+ it('cy.wait() - wait for a specific route', () => {
20
+ // Listen to GET to comments/1
21
+ cy.intercept('GET', '**/comments/*').as('getComment')
22
+
23
+ // we have code that gets a comment when
24
+ // the button is clicked in scripts.js
25
+ cy.get('.network-btn').click()
26
+
27
+ // wait for GET comments/1
28
+ cy.wait('@getComment').its('response.statusCode').should('be.oneOf', [200, 304])
29
+ })
30
+ })
@@ -0,0 +1,22 @@
1
+ /// <reference types="cypress" />
2
+
3
+ context("Window", () => {
4
+ beforeEach(() => {
5
+ cy.visit("https://example.cypress.io/commands/window");
6
+ });
7
+
8
+ it("cy.window() - get the global window object", () => {
9
+ // https://on.cypress.io/window
10
+ cy.window().should("have.property", "top");
11
+ });
12
+
13
+ it("cy.document() - get the document object", () => {
14
+ // https://on.cypress.io/document
15
+ cy.document().should("have.property", "charset").and("eq", "UTF-8");
16
+ });
17
+
18
+ it("cy.title() - get the title", { tags: ["@p1", "@p2"] }, () => {
19
+ // https://on.cypress.io/title
20
+ cy.title().should("include", "Kitchen Sink");
21
+ });
22
+ });
@@ -0,0 +1,25 @@
1
+ // ***********************************************
2
+ // This example commands.js shows you how to
3
+ // create various custom commands and overwrite
4
+ // existing commands.
5
+ //
6
+ // For more comprehensive examples of custom
7
+ // commands please read more here:
8
+ // https://on.cypress.io/custom-commands
9
+ // ***********************************************
10
+ //
11
+ //
12
+ // -- This is a parent command --
13
+ // Cypress.Commands.add('login', (email, password) => { ... })
14
+ //
15
+ //
16
+ // -- This is a child command --
17
+ // Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
18
+ //
19
+ //
20
+ // -- This is a dual command --
21
+ // Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
22
+ //
23
+ //
24
+ // -- This will overwrite an existing command --
25
+ // Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
+ <meta name="viewport" content="width=device-width,initial-scale=1.0">
7
+ <title>Components App</title>
8
+ <!-- Used by Next.js to inject CSS. -->
9
+ <div id="__next_css__DO_NOT_USE__"></div>
10
+ </head>
11
+ <body>
12
+ <div data-cy-root></div>
13
+ </body>
14
+ </html>
@@ -0,0 +1,24 @@
1
+ // ***********************************************************
2
+ // This example support/component.js is processed and
3
+ // loaded automatically before your test files.
4
+ //
5
+ // This is a great place to put global configuration and
6
+ // behavior that modifies Cypress.
7
+ //
8
+ // You can change the location of this file or turn off
9
+ // automatically serving support files with the
10
+ // 'supportFile' configuration option.
11
+ //
12
+ // You can read more here:
13
+ // https://on.cypress.io/configuration
14
+ // ***********************************************************
15
+
16
+ // Import commands.js using ES2015 syntax:
17
+ import './commands'
18
+
19
+ import { mount } from 'cypress/react'
20
+
21
+ Cypress.Commands.add('mount', mount)
22
+
23
+ // Example use:
24
+ // cy.mount(<MyComponent />)
@@ -0,0 +1,19 @@
1
+ // ***********************************************************
2
+ // This example support/e2e.js is processed and
3
+ // loaded automatically before your test files.
4
+ //
5
+ // This is a great place to put global configuration and
6
+ // behavior that modifies Cypress.
7
+ //
8
+ // You can change the location of this file or turn off
9
+ // automatically serving support files with the
10
+ // 'supportFile' configuration option.
11
+ //
12
+ // You can read more here:
13
+ // https://on.cypress.io/configuration
14
+ // ***********************************************************
15
+
16
+ // Import commands.js using ES2015 syntax:
17
+ import './commands';
18
+ const registerCypressGrep = require('@bahmutov/cy-grep');
19
+ registerCypressGrep();
@@ -0,0 +1,25 @@
1
+ const { defineConfig } = require("cypress");
2
+
3
+ module.exports = defineConfig({
4
+ e2e: {
5
+ trashAssetsBeforeRuns: false,
6
+ setupNodeEvents(on, config) {
7
+ // on("before:run", (details) => {
8
+ // console.log(details);
9
+ // });
10
+ require("@bahmutov/cy-grep/src/plugin")(config);
11
+ on("task", {
12
+ log(message) {
13
+ console.log(message);
14
+ return null;
15
+ },
16
+ });
17
+ return config;
18
+ // implement node event listeners here
19
+ },
20
+ },
21
+
22
+ component: {
23
+ specPattern: "./src/components/",
24
+ },
25
+ });
@@ -0,0 +1,26 @@
1
+ const { defineConfig } = require("cypress");
2
+
3
+ module.exports = defineConfig({
4
+ e2e: {
5
+ trashAssetsBeforeRuns: false,
6
+ specPattern: "./cypress/e2e/1-getting-started/",
7
+ setupNodeEvents(on, config) {
8
+ // on("before:run", (details) => {
9
+ // console.log(details);
10
+ // });
11
+ require("@bahmutov/cy-grep/src/plugin")(config);
12
+ on("task", {
13
+ log(message) {
14
+ console.log(message);
15
+ return null;
16
+ },
17
+ });
18
+ return config;
19
+ // implement node event listeners here
20
+ },
21
+ },
22
+
23
+ component: {
24
+ specPattern: "./src/components/",
25
+ },
26
+ });