chore: reworking some more examples

This commit is contained in:
blam
2021-02-04 20:06:37 +01:00
parent 1164e40428
commit ebccd5aa90
6 changed files with 28 additions and 39 deletions
@@ -1,21 +0,0 @@
/// <reference types="cypress" />
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
/**
* @type {Cypress.PluginConfig}
*/
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
}
+5 -5
View File
@@ -15,16 +15,16 @@
*/
import cypress from 'cypress';
import path from 'path';
import config from '../cypress.json';
export async function run() {
await cypress.run({
export async function run({ watch }: { watch: boolean }) {
const command = watch ? cypress.open : cypress.run;
await command({
reporter: 'junit',
browser: 'chrome',
config: {
watchForFileChanges: true,
...config,
watchForFileChanges: watch,
},
configFile: `${__dirname}/../cypress.json`,
});
}
+1
View File
@@ -23,5 +23,6 @@ export function registerCommands(program: CommanderStatic) {
program
.command('cypress')
.description('Run cypress e2e tests')
.option('-w, --watch', 'watch/open mode')
.action(cypress);
}
-1
View File
@@ -2,6 +2,5 @@
"baseUrl": "http://localhost:7000",
"integrationFolder": "./cypress/integration",
"supportFile": "./cypress/support",
"fixturesFolder": false,
"defaultCommandTimeout": 10000
}
@@ -13,16 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// in cypress/support/index.d.ts
// load type definitions that come with Cypress module
/// <reference types="cypress" />
import 'os';
declare namespace Cypress {
interface Chainable {
/**
* Login as guest
* @example cy.loginAsGuests
*/
loginAsGuest(value: string): Chainable<Element>;
}
}
describe('Catalog', () => {
describe('default entities', () => {
it('displays the correct amount of entities from default config', () => {
cy.loginAsGuest();
cy.visit('/catalog');
cy.get('table').should('be.visible');
});
});
});
+10
View File
@@ -13,6 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/// <reference types="cypress" />
declare module 'zombie';
declare module 'pgtools';
declare namespace Cypress {
interface Chainable {
/**
* Login as guest
* @example cy.loginAsGuests
*/
loginAsGuest(): Chainable<Element>;
}
}