You mean something like this: ``` name: v10 # run ...
# general-chat
a
You mean something like this:
Copy code
name: v10
# run workflow on git push and git pull
on: [push, pull_request]
jobs:
  cypress-run:
    # OS
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        # checks-out your repository so your workflow can access it
        uses: actions/checkout@v2
      - name: Run Cypress
        # GitHub Action for running Cypress end-to-end tests
        uses: cypress-io/github-action@v4
        with:
          record: true
          config-file: cypress.config.js
You also have the option to add environment variables, but I wanted to keep it as simple as possible.
c
I got this error when running something similar
Copy code
Run cypress-io/github-action@v4
  with:
    build: npm run build
    start: npm start
    record: false
    component: false
undefined:18
  },
  ^
so I'm looking for an example with all the config js and json files that just does a single GET to a website
a
Can you provide the entire .yml file?
this was to try and get anything going!
a
Question, was this a new project or an upgrade from a version prior to 10?
c
I had installed an older version and I just fired it up yesterday to see if I could get GH actions working. So I just copied the .json files out of my local directory
after upgrading to 10
a
It looks like it yelling about 2 commas in your
package.json
. Can you try removing the commas in lines 17 and 20?
c
I think that package.json was copied out of one of the examples and I stripped out most of the stuff. which left those hanging commas 😦
a
tbf I only found them because I was getting the same error when trying to do
npm i
.
c
So that's why I was looking for a barebones example
so now it's giving me other errors
a
In the
github-actions-init.yml
you have 2 scripts called
npm run build
and
npm start
, but in that
package.json
file the
build
script is for
npm run lint
(which the error says you do not have lint) and the
start
is for
node ./scripts/start.js
, but I do not see that directory in your project.
c
Yes. I know. Is there a bare bones example anywhere so I don't have to bother you good people?
a
Of a package.json or github actions?
c
github action I can clone and just add my own GET
I can see this is not for the casual user like me 😦
a
Gimme a sec, I can create one
When you say basic get command you mean you just need a simple
cy.get()
with a passing test using version 10?
And it's def for any User beginner, medium, or expert
c
Yes
From that I will build on it to interact with a JS console.
this is the simple script I have so far
it fails on line 6 but that's another story
a
If you are new to Cypress I also recommend https://learn.cypress.io. It is free and really covers a great understanding of the basics. Also, hang around here in the Discord! That's literally why we are here! To help everyone be the best tester they can be. I'm no expert, but I'll sure help when I can!
c
Fantastic! Just what I needed 🙂
your example I'm referring to
a
I also recommend on line 6 of your repo maybe doing something like
cy.get('.stdout').should('contain, 'Enter your name as appears on a prescription:').type('Graham Chiu')
c
Will definitely give it a go. but work is a calling. Thanks
I did test
'cy.type() can only be called on a single element. Your subject contained 11 elements.Learn more '
so i have to find the next input field after the stdout class
a
You can specify by adding .eq(): https://docs.cypress.io/api/commands/eq
Basically you provide the index
You'll need to specify the index, but something like
cy.get('.stdout').eq(0).should('contain, 'Enter your name as appears on a prescription:').type('Graham Chiu')
c
so, cy.get('.input').eq(-1).type('foobar{enter}') should always get the last input element?
a
correct
If you have other identifying attributes, you can use those as well. For example, an id is more specific, but it's considered best practice to add something like `data-inpu`t. Let me find the docs.
c
So, I did try .eq(-1) and also .last() but neither works (the .input classes aren't in a list so probably why), and so I'm asking for a
data-input
attribute be added.
but at least I managed to wire up the Cypress dashboard 🙂
58 Views