Reload page to add Category button

- I believe the cypress test is so fast that we visit the post/create
  page before the relationship CATEGORIZED is added, and therefore, we
must refresh the page.
- I am not happy about this solution, but I'm not sure what we can do...
  maybe wait for the post to be succesfully created with all it's
relationships?
This commit is contained in:
mattwr18 2020-02-18 13:33:34 +01:00
parent 0f74273b5b
commit 6f6b1534df
4 changed files with 9 additions and 4 deletions

View File

@ -27,7 +27,10 @@ export const cleanDatabase = async (options = {}) => {
Factory.define('category')
.attr('id', uuid)
.attr('icon', 'globe')
.attr('name', 'global-peace-nonviolence')
.attr('name', 'Global Peace & Nonviolence')
.sequence('slug', i => {
return `global-peace-nonviolence-${i}`
})
.after((buildObject, options) => {
return neode.create('Category', buildObject)
})

View File

@ -88,6 +88,7 @@ Then("I see a toaster with {string}", (title) => {
})
Then("I should be able to {string} a teaser image", condition => {
cy.reload()
let teaserImageUpload = "onourjourney.png";
if (condition === 'change') teaserImageUpload = "humanconnection.png";
cy.fixture(teaserImageUpload).as('postTeaserImage').then(function() {
@ -108,8 +109,8 @@ Then("I add all required fields", () => {
.type('new post')
.get(".editor .ProseMirror")
.type('new post content')
.get(".base-button")
.contains("Global Peace & Nonviolence")
.get(".categories-select .base-button")
.first()
.click()
.get('.ds-flex-item > .ds-form-item .ds-select ')
.click()

View File

@ -262,6 +262,7 @@ When(
"I click on the big plus icon in the bottom right corner to create post",
() => {
cy.get(".post-add-button").click();
cy.location("pathname").should('eq', '/post/create')
}
);

View File

@ -1,5 +1,5 @@
<template>
<div>
<div class="categories-select">
<ds-flex :gutter="{ base: 'xx-small', md: 'small', lg: 'xx-small' }">
<div v-for="category in categories" :key="category.id">
<ds-flex-item>