login command - need to run worker in cypress env

This commit is contained in:
Martin McKeaveney 2021-04-15 12:14:50 +01:00
parent 20a16e07a1
commit fe6d31d880
4 changed files with 15 additions and 18 deletions

View File

@ -1,5 +1,6 @@
context("Create an Application", () => {
it("should create a new application", () => {
cy.login()
cy.createTestApp()
cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
cy.contains("Cypress Tests").should("exist")

View File

@ -29,14 +29,3 @@ async function run() {
}
run()
// TODO: ensure that this still works
// initialiseBudibase({ dir: homedir, clientId: "cypress-test" })
// .then(() => {
// delete require.cache[require.resolve("../../server/src/environment")]
// const xPlatHomeDir = homedir.startsWith("~")
// ? join(homedir(), homedir.substring(1))
// : homedir
// run(xPlatHomeDir)
// })
// .catch(e => console.error(e))

View File

@ -24,6 +24,19 @@
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
Cypress.Commands.add("login", name => {
cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
cy.contains("Create Test User").click()
cy.get("input")
.first()
.type("test@test.com")
cy.get('input[type="password"]').type("test")
cy.contains("Login").click()
cy.wait(1000)
})
Cypress.Commands.add("createApp", name => {
cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
// wait for init API calls on visit
@ -44,12 +57,6 @@ Cypress.Commands.add("createApp", name => {
.type(name)
.should("have.value", name)
cy.contains("Next").click()
cy.get("input[name=email]")
.click()
.type("test@test.com")
cy.get("input[name=password]")
.click()
.type("test")
cy.contains("Submit").click()
cy.get("[data-cy=new-table]", {
timeout: 20000,

View File

@ -40,7 +40,7 @@
}
</script>
<form on:submit|preventDefault>
<form on:submit|preventDefault data-cy="login-form">
<Spacer large />
<Label small>Email</Label>
<Input outline bind:value={username} />